Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
Hi guys, may i know any way make the combo in VB.Net contain multicolumns when user click on drop down? Is there any OCX or components can do it in VB.NET?
  • Leaders
Posted

you mean so that there's text with another column next to it, or so that there's a drop down list of text?

eg:

text1 | text2

text3 | text4

or:

text1

text2

text3

text4

because for the drop down list i know thats a case of setting the combobox's properties to "dropdownlist", then when you do something like....

ComboBox1.Items.Add(TextBox1.Text)'Add to combobox

the list gets longer as you add the text to it.

Posted

my problem is the click on combo drop down, instead appear 1 columns, i want 2 or 3 columns.

Example :

 

 

Text1 Text 2 Test 3

 

Not

Text1

Text2

Text3

 

Beside this, as i know in VB.net contain Combo Version 2, may i know how to used it? Thanks

  • *Experts*
Posted

I've never seen this feature in a ComboBox, but that doesn't mean it doesn't exist. I do know you can do this in a ListBox. Here's some VB6 code that works by setting the TabStops. I tried this on a ComboBox with no luck, but maybe it will spark something...

 

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const LB_SETTABSTOPS As Long = &H192

Private Sub Form_Load()
   Dim Tabs(2) As Long
   Tabs(0) = 0
   Tabs(1) = 50
   Tabs(2) = 150
   SendMessage List1.hwnd, LB_SETTABSTOPS, CLng(UBound(Tabs)) + 1, Tabs(0)
   List1.AddItem "hello" & vbTab & "world" & vbTab & "dan"
   List1.AddItem "hello" & vbTab & "world" & vbTab & "dan"
   List1.AddItem "hello" & vbTab & "world" & vbTab & "dan"
End Sub

 

Note that the tabstop numbers (0, 50, 150) are always in Pixels (as far as I can tell).

 

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