Welcome to Gaia! ::


I'm trying to make the list box look like

. . . .
. . . .
. . . .
. . . .
. . . .
. . . .

etc


my code for that, so far, is


Dim i As Integer = 0
Dim j As Integer = 0
ListBox2.Items.Clear()
Do While i < 4 And j < 10
seats(j, i) = ". "
ListBox2.Items.Add(seats(j, i))
i += 1
If i = 3 And j < 10 Then
i = 0
j += 1

End If
Loop

The problem is that instead of going
. . . . . . . . . . . .

it's going
.
.
.
.
.
.
.
.
.
.
ListBoxes don't do what you want. You probably want a ListView or to roll your own control.
psychic stalker
roll your own control.

What is this?
Dudironimis
psychic stalker
roll your own control.

What is this?
Hard mode.
psychic stalker
Dudironimis
psychic stalker
roll your own control.

What is this?
Hard mode.

Well I'm in a "beginning VB" class, so I think that's a bit out of my league.
my professor gave us this code for it
Dim rowStr As String
ListBox2.Items.Clear()
For row As Integer = 0 To 9
rowStr = ""
For seat As Integer = 0 To 3
rowStr &= " ."
If seat = 1 Then
rowStr &= " "
End If
Next
ListBox2.Items.Add(rowStr)
Next

but i wasn't sure how to edit the periods after this code, so I tried to emulate it with my code...didn't work.
Dudironimis
psychic stalker
Dudironimis
psychic stalker
roll your own control.

What is this?
Hard mode.

Well I'm in a "beginning VB" class, so I think that's a bit out of my league.
my professor gave us this code for it
Dim rowStr As String
ListBox2.Items.Clear()
For row As Integer = 0 To 9
rowStr = ""
For seat As Integer = 0 To 3
rowStr &= " ."
If seat = 1 Then
rowStr &= " "
End If
Next
ListBox2.Items.Add(rowStr)
Next

but i wasn't sure how to edit the periods after this code, so I tried to emulate it with my code...didn't work.
What he's doing there is concatenating the strings with periods together. (That's what & means in VB. " ." & " ." becomes " . .") Then, he adds that string as a row to the ListBox.

What you were doing is adding a bunch of periods as separate list items on the assumption that they would march together in rows. That's not how ListBox works. A ListBox only has rows. It doesn't have columns. You can't create a grid of items within a ListBox.

You can create something that acts like a ListBox and does rows and columns, but, as I said, that's "Hard Mode."

Quick Reply

Submit
Manage Your Items
Other Stuff
Get GCash
Offers
Get Items
More Items
Where Everyone Hangs Out
Other Community Areas
Virtual Spaces
Fun Stuff
Gaia's Games
Mini-Games
Play with GCash
Play with Platinum