Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27513

Textboxes as array

$
0
0
Hello guys once again.
I have a problem to code textboxes as an array.What I mean.

I have 3 textboxes and I am trying to group them using some kind of index, so having textbox(j) instead of textbox1, textbox2, textbox3.
I would like to have something like this because i want to use some loop instructions.

I have written the following code as an example.
In brief the code is this
If textbox1 and textbox2 is numeric then textbox3="done"
Else
give a msgbox("blah....")
---------
Dim J As Integer
Dim txt As TextBox()

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For Me.J = 0 To 1
If Not IsNumeric(txt(J).Text) Then
MsgBox("PLEASE ENTER ONLY NUMBERS!", MsgBoxStyle.Critical, "WARNING")
Else
TextBox3.Text = "done"
End If
Next J
end sub

-------------

When i run this code i get a message "NullReferenceException was unhandeled etc"

Viewing all articles
Browse latest Browse all 27513

Trending Articles