Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Experts*
Posted

You can put both strings in the dropdown, such as:

Team 1 (Dan Jones)

Team 2 (Bob Jones)

 

or

 

Team 1, Dan Jones coach

Team 1, Bob Jones coach

 

or something similar.

 

There are many 3rd party controls that support multiple columns in a dropdown. If you want some, search google and I'm sure you can find some that include source (just a guess) and/or are free.

 

-nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted
Is there still a listview control in .NET? I remember doing a:
lvwMain.ColumnHeaders.Add , , "Team", 4000

in VB 6. Can I still do something like that?

Thanks,

Tehon

  • *Experts*
Posted

There is still a ListView, yes. If you want a multi-column list you can also use a ListBox which supports multiple columns using a tab stop.

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted (edited)
How do I specify each column? I can create each column, but how do I say I want this in the second coloumn and this in the third and so on? Edited by tehon3299

Thanks,

Tehon

  • *Experts*
Posted

Here's a sample to set tabstops in a standard Listbox.

 

// Declare the SendMessage API to set the tab stops
// You can put this at the top of a form
private const int LB_SETTABSTOPS = 0x192;
[DllImport("user32", EntryPoint="SendMessage")]
	private static extern int SendMessageTabStops(int handle, int msg, int tabCount, int[] tabStops);

// ... in Form_Load:
int[] tabStops = new int[] {0, 50, 100};
listBox1.Items.Add("dan\tjones\tMe");
listBox1.Items.Add("bob\tjones\tHim");
listBox1.Items.Add("hagatha\tjones\tHer");
SendMessageTabStops(listBox1.Handle.ToInt32(), LB_SETTABSTOPS, tabStops.Length, tabStops);

 

The above creates three tabstops. One at 0 pixels (left aligned), one at 50 pixels and one at 100 pixels. You can create as many as you want. If you don't know C# syntax, let me know and I can convert to VB.NET (maybe). Not sure how to do a tab character in VB.NET, maybe it's still vbTab? Wishful thinking... :)

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

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...