Community discussion forum

VB6 Runtime error 381 subsript out of range Error

  • 22 days ago

    Private Sub Command1_Click() With MSHFlexGrid1 .Rows = 10 .Cols = 10 For i = 1 To 10 For j = 1 To 10 .TextMatrix(i, j) = i & " " & j Next j .Rows = .Rows + 1 Next i

    End With

    End Sub

    this is my vb6 code giving Runtime Error Substript Out of Range please help me Thank you Pramod

    Post was edited on 04/11/2009 10:41:46 Report abuse
  • 22 days ago

    Private Sub Command1_Click() With MSHFlexGrid1 .Rows = 10 .Cols = 10 For i = 1 To 10 For j = 1 To 10 .TextMatrix(i, j) = i & " " & j Next j .Rows = .Rows + 1 Next i

    End With

    End Sub

    this is my vb6 code giving Runtime Error Substript Out of Range please help me Thank you Pramod

  • 21 days ago

    The cells in the grid start at 0,0 not 1,1 so your loops need to be For i = 0 to 9 not 1 to 10.

Post a reply

Enter your message below

Sign in or Join us (it's free).

We'd love to hear what you think! Submit ideas or give us feedback