Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How can I fill Columnheads in a Combobox

Posted on 1999-01-27
9
Medium Priority
?
776 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Technology Partners: 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

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…
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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

719 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