Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

The topic probably describes my problem, but as a matter of form:

How do I show two columns in a Listbox.

i.e

 

I use: txtboxName, textboxBirth, textboxCity as input

 

I want some thing like this:


Name:       Birth                        City

John         12/12/1973             Paris
Carl          05/11/2004             Hamburg
Paul          01/02/1980            New York
Per            02/02/1975           Oslo

 

a code example would have been appreciated.

Edited by torg
Posted

That sounds like a good Idea, I`ll try that. meanwhile, I`ve come up with some code that I could have used instead:

 


Public Class......
.
.
.
Dim bill(2) As Budget

   Structure Budsjett
       Dim mystring1 As String
       Dim mystring2 As String
       Dim mystring3 As String
   End Structure
,
,
,
Public Sub .......

Bill(0).mystring1 = "Mystring"
Bill(1).mystring2 = "Another String"
Bill((2).mystring3 = "Yet another String"

Dim formatstring As String = "{0,-15}{1,0}{2,15}"

       Listbox1.Items.Clear()

       Listbox1.Items.Add(String.Format(formatstring, Bill(0).mystring1 , Bill(1).mystring2 , Bill(2).mystring3))

 

the drawback is that I want to populate the listbox with several columns from one mdb table. Any idea about how to do that?

 

This only gives me the data from column Expences

ListBox1.DataSource = dsTenLast.Tables("dtTenLast")
ListBox1.DisplayMember = "expencetype"

  • *Experts*
Posted

You could also look into using a DataGrid control; you can easily

load in a DataSet and display the info, and it would probably do

what you're asking about. I would suggest reading up on it.

Posted
I`ve already tried that, and It works fine. But somehow, don`t ask why, I`ve decided to use Listbox., or atleast try to. Provided that it satisfies my needs

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...