How to insert more than one rows of data to Access??
All my textboxes are created during runtime and I want to add the text in textboxes to database.
some times i want 3 rows and some times maybe 10 rows
This is the code to create textboxes.
For Me.count = count To number
Dim label1 = New Label
With label1
.Name = "lblNo" & count
.Size = New Size(32, 26)
.Location = New Point(x, y)
' .Font = txtNum1.Font
.TextAlign = HorizontalAlignment.Center
.Text = count & "."
.TabStop = False
Controls.Add(label1)
End With
x += 53
Dim myTextBox2 = New TextBox
With myTextBox2
.Name = "txtNum" & count
.Size = New Size(50, 26)
.Location = New Point(x, y)
'.Font = txtNum1.Font
.TextAlign = HorizontalAlignment.Center
.MaxLength = 4
Controls.Add(myTextBox2)
End With
x += 75
Dim myTextBox3 = New TextBox
With myTextBox3
.Name = "txtBig" & count
.Size = New Size(50, 26)
.Location = New Point(x, y)
' .Font = txtNum1.Font
.TextAlign = HorizontalAlignment.Center
.MaxLength = 6
Controls.Add(myTextBox3)
End With
x += 70
Dim myTextBox4 = New TextBox
With myTextBox4
.Name = "txtSmall" & count
.Size = New Size(50, 26)
.Location = New Point(x, y)
'.Font = txtNum1.Font
.TextAlign = HorizontalAlignment.Center
.MaxLength = 6
Controls.Add(myTextBox4)
End With
x = 12
y += 25
Next
If count > 11 Then
MessageBox.Show("Maximum rows are 10", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End If