Solved

How can I fill Columnheads in a Combobox

Posted on 1999-01-27
9
773 Views
Last Modified: 2013-12-26
I can add Columnheads, but I can't fill the Columnheads with a value.
(VB 6.0, Combobox Microsoft Forms 2.0 Object Library)

Any help would be great!
0
Comment
Question by:Zimmerli
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 

Author Comment

by:Zimmerli
ID: 1490002
Edited text of question
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1490003
Yep, you are right. You can only do that using data binding with a database.
BTW: Forms2 may only be used inside office VBA. See license agreement
0
 

Author Comment

by:Zimmerli
ID: 1490004
-What control do you use, if you want a combobox with a header (not with a data binding with a database)?
-Is it possible to use a listbox instead of a combobox?
-I use ms forms because i want to use 2 columns. are there other controls (comboboxes) which support 2 (or more) columns

btw: for a good solution i would increase the points to 100
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 13

Expert Comment

by:Mirkwood
ID: 1490005
Use the listview control. Put the listview in detailed mode.
The control is located in the Microsoft common control library

0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1490006
Take also a look at this code:

Take a look at the following code. It simulates the access dropdown combo.
Add a combobox and a grid control (Project/add components/Microsoft Databound Grid Control) and a timer to a form and use the code below

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 CB_SHOWDROPDOWN = &H14F

Dim m_bWasVisible As Boolean

Private Sub Combo1_DropDown()
    m_bWasVisible = DBGrid1.Visible
    Timer1.Enabled = True
End Sub

Private Sub DBGrid1_Click()
    Combo1.SetFocus
End Sub

Private Sub dbgrid1_LostFocus()
    DBGrid1.Visible = False
End Sub

Private Sub Form_Click()
    If (DBGrid1.Visible) Then
        DBGrid1.Visible = False
    End If
End Sub

Private Sub Form_Load()
    Timer1.Enabled = False
    Timer1.Interval = 50
    DBGrid1.AllowAddNew = False
    DBGrid1.AllowDelete = False
    DBGrid1.AllowUpdate = False
    DBGrid1.EditActive = False
    DBGrid1.Visible = False
End Sub

Private Sub Timer1_Timer()
    Timer1.Enabled = False
    If (m_bWasVisible) Then
        SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, 0, 0
    Else
        DBGrid1.Visible = True
        DBGrid1.SetFocus
    End If

End Sub

0
 

Author Comment

by:Zimmerli
ID: 1490007
Thanks a lot!
now i have just one last problem:
- I want to use a Combobox with 2 columns (I don't need any headers there) - It works fine with the ms forms 2 combobox - but you wrote that i should use it just with VBA. Is there another combobox which supports more then one column?

btw: you have to answer the question - otherwise I can't give you the points if you just add a comment.
0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 100 total points
ID: 1490008
See comments below for answers.

Sorry I don't know any other freeware combobox that has multiple columns. Comboboxes are not that easy to write since the use a larger window area than the area of the control itself when they dropdown.
0
 

Author Comment

by:Zimmerli
ID: 1490009
Thanks a lot!
now i have just one last problem:
- I want to use a Combobox with 2 columns (I don't need any headers there) - It works fine with the ms forms 2 combobox - but you wrote that i should use it just with VBA. Is there another combobox which supports more then one column?

btw: you have to answer the question - otherwise I can't give you the points if you just add a comment.
0
 

Author Comment

by:Zimmerli
ID: 1490010
Adjusted points to 100
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month6 days, 3 hours left to enroll

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question