Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 148
  • Last Modified:

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


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.
1 Solution
Éric MoreauSenior .Net ConsultantCommented:
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
Anthony PerkinsCommented:
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

Richie_SimonettiIT OperationsCommented:
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

sharibabuAuthor Commented:
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.

Éric MoreauSenior .Net ConsultantCommented:
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
Anthony PerkinsCommented:
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


Éric MoreauSenior .Net ConsultantCommented:
Any progress?
Éric MoreauSenior .Net ConsultantCommented:
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:

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now