ok first of all i have 1 array here
Dim JD = {"0", "LIE"}
then i have 3 textboxes that i put in array too
Dim ColJD1 As TextBox() = {Me.JD1_1, Me.JD1_2, Me.JD1_3}
then i use those arrays in a subroutine :
Sub fillword(ByVal num1, ByVal qtychar, ByVal num2, ByVal i, ByVal Coltxtbox)
If Strings.Mid(My.Computer.FileSystem.ReadAllText("SAVE.txt"), Strings.InStr(My.Computer.FileSystem.ReadAllText("SAVE.txt"), num1), qtychar) = num2 & ".True" Then
For test = 1 To Strings.Len(JD(i))
For Each txtbox In Coltxtbox
Dim a As String = Strings.Mid(JD(i), test, 1)
MsgBox(a)
txtbox.Text = i => here is the problem
i = i + 1
Next
Next
End If
End Sub
Sub loadgame1()
fillword("1", 6, "1", 1, ColJD1)
End Sub
Private Sub Button_click bla bla
loadgame1()
End Sub
It's throwing error : "Object variable or With block variable not set."
any kind of help is greatly appreciated
@w0051977 actually the variable name is "test" and not "uji"
After receiving Hans suggestion i did modify the code but it still throws error : i changed the code :
Dim JD = {"0", "RIA"}
Dim ColJD1 As TextBox()
Sub fillarray()
InitializeComponent()
ColJD1 = {JD1_1, JD1_2, JD1_3}
End Sub
Sub fillword(ByVal num1, ByVal qtychar, ByVal num2, ByVal i, ByVal Coltxtbox)
fillarray()
If Strings.Mid(My.Computer.FileSystem.ReadAllText("SAVE.txt"), Strings.InStr(My.Computer.FileSystem.ReadAllText("SAVE.txt"), num1), qtychar) = num2 & ".True" Then
For test = 1 To Strings.Len(JD(i))
For Each txtbox In Coltxtbox => Now the problem moves here , it throws error "Object reference not set to an instance of an object."
Dim a As String = Strings.Mid(JD(i), test, 1)
MsgBox(a)
txtbox.Text = i
i = i + 1
Next
Next
End If
End Sub
Sub loadgame1()
fillword("1", 6, "1", 1, ColJD1)
End Sub
Private Sub Button_click bla bla
loadgame1()
End Sub