Results 1 to 3 of 3

Thread: [RESOLVED] Array with object names

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2010
    Posts
    133

    Resolved [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
    Last edited by azsx123; Jan 30th, 2010 at 09:22 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width