VB6 Runtime error 381 subsript out of range Error

loop , flexgrid , vb6 India
  • 11 years 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

  • 11 years 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

  • 11 years 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).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The generation of random numbers is too important to be left to chance.” - Robert R. Coveyou