0
votes

So here's the thing; I'm making this home-made sign-up thing for a school project.

I've got first name, last name, date of birth, SS number among other things.

I can send data to another form's listbox Dim SSID = (tx_SSP.Text) Datbase_of_User_Information.ListBox1.Items.Add(SSID)

However this will only add ONE item to the listbox. I know there's a way to add in a multi-column data thing into the list ex: SSID | Fname | Lname | DoB

Something like the above.

But I've tried doing Listbox1.AddItem("row1 col1", SSID) and it didn't work.

1
if your data comes from a database you can bind it to a DataGridView and let it create the columns and rows with one line of code - Ňɏssa Pøngjǣrdenlarp
ListBox is a very simple control which cannot account for "proper" columns. The right approach here would be relying on another control, like ListView or DataGridView, which does have such a capability. If you want to rely on ListBox anyway (and set the columns "manually" by putting spaces in between), you can rely on AddRange. For example: Dim source As Object() = New Object() {"1 2 3", "4 5 6", "7 8 9"} and yourListBox.Items.AddRange(source). Alternatively, you might use the DataSource property; example: yourListBox.DataSource = source. - varocarbas

1 Answers

1
votes

I had this same problem and I kind of cheated by just putting all the values together into one string and using tabs.

Listbox1.Items.Add(SSID & " " & Fname & " " & Lname & " " & DoB)

I've heard a better solution would be to use a ListView if you want a true multi-column solution.