Solved

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

Posted on 2002-06-01
9
135 Views
Last Modified: 2010-05-02
Hello,

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.
Hari.
0
Comment
Question by:sharibabu
[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
9 Comments
 
LVL 70

Accepted Solution

by:
É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
                 List1.SetFocus
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
0
 
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

Anthony
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7049061
listening...
0
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!

 

Author Comment

by:sharibabu
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 "hari@anion.com". 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.

Regards,
Hari.
0
 
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
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q250577
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q197428
0
 
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  
http://www.experts-exchange.com/jsp/qShow.jsp?ta=dbgen&qid=20182742
How to Connect Postgres from Visual Basic??? Date: 09/13/2001 05:33AM PST
http://www.experts-exchange.com/jsp/qShow.jsp?ta=dbgen&qid=20182379
Crystal Reports Problem... Urgent Date: 04/24/2002 05:42AM PST  
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20293086
Date Function Problem... Very Urgent... Date: 05/04/2002 08:37AM PST  
http://www.experts-exchange.com/jsp/qShow.jsp?ta=php&qid=20297019

Anthony





0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 7128829
Any progress?
0
 
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:
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt

DO NOT ACCEPT THIS COMMENT AS AN ANSWER.
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7373251
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
to transfer string from C lanaguage to VBA 4 85
VBA filters 2 81
Notepad++ how to remove delimiter : from beggning of the line? 3 135
Add and format columns in vb6 7 83
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

734 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