Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How can I fill Columnheads in a Combobox

Posted on 1999-01-27
9
Medium Priority
?
779 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
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

916 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