Quote Originally Posted by Shaggy Hiker View Post
First off, you probably want to find something other than a listbox. While you CAN put two columns into a listbox, it usually looks terrible to do so. A better option would be a ListView in Details mode, which handles multiple columns much nicer. Another alternative is the DataGridView. Those take a bit of tweaking to make them look like anything other than a grid, but you have lots of layout options. The DGV tends to be a little easier to use than the ListView, but can be a bit harder to make look nice, unless you want the grid appearance.

As for dealing with the string, I'd certainly be breaking it out into an array if I were doing it, unless the string comes from some place that gives me options before it ever became a string.
Here's what i meant. Works with any font...

Code:
Imports System.Runtime.InteropServices

Public Class Form1

    <DllImport("user32.dll")> _
  Private Shared Function SendMessage( _
    ByVal hWnd As IntPtr, _
    ByVal wMsg As Integer, _
    ByVal wParam As IntPtr, _
    ByVal lParam As IntPtr) As Integer
    End Function

    Private Sub SetTabStops(ByVal listBox As ListBox, ByVal tabStops() As Integer)
        Const LB_SETTABSTOPS As Integer = &H192
        Dim pinnedValues As GCHandle
        pinnedValues = GCHandle.Alloc(tabStops, GCHandleType.Pinned)
        Dim ptr As IntPtr = pinnedValues.AddrOfPinnedObject()
        SendMessage(listBox.Handle, LB_SETTABSTOPS, New IntPtr(tabStops.Length), ptr)
        pinnedValues.Free()
        listBox.Refresh()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ListBox1.Items.Add("Product" & vbTab & "Description" & vbTab & "Price")
        ListBox1.Items.Add("BLT" & vbTab & "Sandwich with bacon, lettuce and tomatoes" & vbTab & "7")
        ListBox1.Items.Add("PZVES" & vbTab & "Pizza with tomato sauce, cheese and ham" & vbTab & "12")
        ListBox1.Items.Add("BRGCH" & vbTab & "Cheese Burger" & vbTab & "9")
        ListBox2.Items.AddRange(ListBox1.Items)
        SetTabStops(ListBox2, New Integer() {70, 240})
    End Sub

End Class