A
Al & Cay Grant
Hello All,
I have several textboxes on a form. A user clicks a button and the
information from the texboxes is stored as an array.
The textbox1 which has a name is then inserted into a listbox.
The textboxes are then cleared for another name to be entered. When this
second name is entered the array needs to have a second row with the second
person added.
The seconds persons name also needs to be added to the listbox.
How do I do this please?
Additem does not work with arrays, and list, just adds the current line?
So far I have the following, but as I addrows the lsitbox only displays the
most recent addition and blanks the previous rows.
Private Sub CommandButtonAddOffender_Click()
Dim OffenderArray As Variant
ListBox2.ColumnCount = 10
ListBox2.ColumnWidths = "100;0;0;0;0;0;0;0;0;0"
i = ListBox2.ListCount
ReDim OffenderArray(i, 10)
OffenderArray(i, 0) = TextBox1.Value & " " & TextBox2.Value
OffenderArray(i, 1) = TextBox1.Value
OffenderArray(i, 2) = TextBox2.Value
OffenderArray(i, 3) = TextBox3.Value
OffenderArray(i, 4) = TextBox4.Value
OffenderArray(i, 5) = TextBox5.Value
OffenderArray(i, 6) = TextBox6.Value
OffenderArray(i, 7) = TextBox7.Value
OffenderArray(i, 8) = TextBox8.Value
OffenderArray(i, 9) = TextBox9.Value
ListBox2.List() = OffenderArray
Call ClearBoxes
End Sub
Help!
Thanks
-Al
I have several textboxes on a form. A user clicks a button and the
information from the texboxes is stored as an array.
The textbox1 which has a name is then inserted into a listbox.
The textboxes are then cleared for another name to be entered. When this
second name is entered the array needs to have a second row with the second
person added.
The seconds persons name also needs to be added to the listbox.
How do I do this please?
Additem does not work with arrays, and list, just adds the current line?
So far I have the following, but as I addrows the lsitbox only displays the
most recent addition and blanks the previous rows.
Private Sub CommandButtonAddOffender_Click()
Dim OffenderArray As Variant
ListBox2.ColumnCount = 10
ListBox2.ColumnWidths = "100;0;0;0;0;0;0;0;0;0"
i = ListBox2.ListCount
ReDim OffenderArray(i, 10)
OffenderArray(i, 0) = TextBox1.Value & " " & TextBox2.Value
OffenderArray(i, 1) = TextBox1.Value
OffenderArray(i, 2) = TextBox2.Value
OffenderArray(i, 3) = TextBox3.Value
OffenderArray(i, 4) = TextBox4.Value
OffenderArray(i, 5) = TextBox5.Value
OffenderArray(i, 6) = TextBox6.Value
OffenderArray(i, 7) = TextBox7.Value
OffenderArray(i, 8) = TextBox8.Value
OffenderArray(i, 9) = TextBox9.Value
ListBox2.List() = OffenderArray
Call ClearBoxes
End Sub
Help!
Thanks
-Al