[RESOLVED] Array with object names
Hi, I'm having problems regarding using arrays on object names. for example, i have a textbox named txtBox1.text and a array declared as a(2). I what to transfer the value of the textbox to the array using loop. Here's my code that works.
Code:
'Checks if txt11N.text field is empty
'If txt11N.text has a value, checks if txtCat1.text has a value
'If txtCat1.text has a value, checks txt11P.text
'If all fields are filled up, transfers them to an array
If txt11N.Text <> "" Then
If txtCat1.Text = "" Then
MessageBox.Show("Please fill in Category 1", "Error!", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
'
Else
If txt11P.Text = "" Then
MessageBox.Show("Please enter price of item 1.1", "Error!", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
Category(1) = txtCat1.Text
Item1(1) = txt11N.Text
End If
End If
End If
This is the code or somewhat the code of what i want to do
Code:
'Checks if txt11N.text field is empty
'If txt11N.text has a value, checks if txtCat1.text has a value
'If txtCat1.text has a value, checks txt11P.text
'If all fields are filled up, transfers them to an array
If txt11N.Text <> "" Then
If txtCat1.Text = "" Then
MessageBox.Show("Please fill in Category 1", "Error!", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
'
Else
If txt11P.Text = "" Then
MessageBox.Show("Please enter price of item 1.1", "Error!", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End If
If Counter >= 4 Then
Category(Counter) = txtCat(Counter).Text
Item1(Counter) = txt1(Counter)N.Text
Counter = counter+1
End if
Re: Array with object names
Code:
Dim someArray(2) As String
someArray(0) = TextBox1.Text
someArray(1) = TextBox2.Text
someArray(2) = ""
Re: Array with object names