Can I place a combo box in any type of grid control ????

Posted on 2002-06-01
Last Modified: 2010-05-02

Can I place a combo box in any type of grid control? My requirement is to place a combo box in a grid control. For example we have an option to view the check box in list view control, In the same way I want to insert a combo box. I have to insert 3 combo boxes in 3 coloumns. Is it possible?, If yes how and in which control?

Please provide me the source code also.

Hope I will get the solution for this problem.

Thanks in advance.
Question by:sharibabu
LVL 70

Accepted Solution

Éric Moreau earned 100 total points
ID: 7048618
Add a ListBox and make its visible property to False.

'Add this code to the form declaration

Option Explicit
Dim intColIdx As Integer
'This will contain the index for the current  cell in the dbgrid
Dim blnListShow As Boolean 'is the list showing or not

Private Sub DBGrid1_ButtonClick(ByVal ColIndex As Integer)
Dim intTop As Integer
intColIdx = ColIndex
If blnListShow = False Then 'if the list is not showing then...
blnListShow = True
List1.Left = DBGrid1.Columns(ColIndex).Left + 360
intTop = DBGrid1.Top + (DBGrid1.RowHeight * (DBGrid1.Row +2))
List1.Top = intTop
List1.Width = DBGrid1.Columns(ColIndex).Width + 15
                    List1.Visible = True
Else 'if the list is show, hide it
            blnListShow = False
             List1.Visible = False
End If
End Sub

Private Sub Form_Load()
  blnListShow = False 'initialize
End Sub

Private Sub List1_Click()
  DBGrid1.Columns(intColIdx).Text = List1.Text
  'set the value of the dbgrid
  List1.Visible = False 'hide the list
End Sub

Private Sub List1_LostFocus()
  blnListShow = False
  List1.Visible = False
End Sub
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7048963
I suppose there is no chance of you ever maintaining your questions, is there?

Questions Asked 5
Last 10 Grades Given  
Question Grading Record 0 Answers Graded / 0 Answers Received

LVL 16

Expert Comment

ID: 7049061
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.


Author Comment

ID: 7050389
Hi emoreau,

Thanks for your answer to my question. I am sorry to say that I am unable to get the output with your sample code, may be I have done wrong with your sample code to get the output. If possible, why don't you send an sample application to my email "". So that it can be used by me to solve my problem.

One more requirement to my question is, rows will come dynamically depending on the no.of records in the database.

Hope you will understand and send me the sample application.

LVL 70

Expert Comment

by:Éric Moreau
ID: 7051608
Have you considered using a DataRepeater control? To use it, you need to build your own OCX control that contains every controls (like textbox, combo, ...) to make a line of details.

Have a look at;en-us;Q250577;en-us;Q197428
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7055375
Do you need help maintaining your open questions or shall we just get the EE Moderator to award the points to emoreau and be done with it.  For the record:
How to access plpgsql functions from vb?? Date: 09/13/2001 11:56PM PST
How to Connect Postgres from Visual Basic??? Date: 09/13/2001 05:33AM PST
Crystal Reports Problem... Urgent Date: 04/24/2002 05:42AM PST
Date Function Problem... Very Urgent... Date: 05/04/2002 08:37AM PST


LVL 70

Expert Comment

by:Éric Moreau
ID: 7128829
Any progress?
LVL 70

Expert Comment

by:Éric Moreau
ID: 7297408
This question appears to be abandoned. A question regarding it will be left in the CleanUp
area; if you have any comment about the question, please leave it here.

Unless there is objection or further activity, one of the moderators will be asked to accept the comment
of <emoreau>.

The link to the Community Support area is:


Expert Comment

ID: 7373251

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Link a textbox in excel to a cell with more than 255 characters. 5 93
VBA filters 2 61
Problem to With line 4 57
Set email body to html using vbscript 6 41
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…

777 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