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

x
?
Solved

DataGrid control 6.0, Buttonclick

Posted on 1998-09-22
8
Medium Priority
?
379 Views
Last Modified: 2013-12-25
The datagrid control has a buttonclick event. This event is fantastic if you want a combo box to appear. But how?
0
Comment
Question by:osthus
  • 4
  • 3
8 Comments
 

Expert Comment

by:GrimmVB
ID: 1487070
If you set a button then dbGrid_buttonclick becomes an option. Use this to pop up a list of choices, for example.  To tell you the truth, it's essentially an add for dbgrid pro, which actually has built in functionality.
0
 

Expert Comment

by:GrimmVB
ID: 1487071
heh,
'how' was the question I believe... oops.  I hate dbgstandard, it is just good enough to make you want dbgpro.
Create your grid, assign your button in properties / layout.
Also create a dbcombo with .visible=false. Then double click the grid, and select the 'buttonclick' procedure which has appeared.  Enter code there, something like..

dbcombo.top=currentcell.top
dbcombo.left=currentcell.left
dbcombo.visible=true

That's it!!  This is something I thought I would use at some point like yourself, but really unless you buy dbgPro there are too many other, better user interfaces.
0
 
LVL 5

Expert Comment

by:chewhoung
ID: 1487072
At form's activate event, set Button property to true for the columns you want combo box like the one below as an example:

grdDataGrid.Columns(2).Button = True
grdDataGrid.Columns(3).Button = True


On the grid BeforeColEdit event, put the following code:

    If grdDataGrid.Columns(ColIndex).DataField = "TransactionType" Or grdDataGrid.Columns(ColIndex).DataField = "Bank" Then
        ' Let the user edit by entering a key.
        If KeyAscii <> 0 Then Exit Sub
     
        ' Otherwise, cancel built-in editing and call the
        ' ButtonClick event to drop down List1.
        Cancel = True
        grdDataGrid_ButtonClick (ColIndex)
    End If

For my example grdDataGrid.Columns(2) bound to datafield "TransactionType" and grdDataGrid.Columns(3) bound to datafield "Bank". If user click on the button on these 2 fields, ButtonClick event will be called to display the list for user to select a value.
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!

 
LVL 5

Expert Comment

by:chewhoung
ID: 1487073
Download this file for more example:

ftp://ftp.apexsc.com/pub/files/dbgridsk.exe
0
 
LVL 5

Expert Comment

by:chewhoung
ID: 1487074
For detail how to extract the file I mention:

http://www.apexsc.com/dbgrid/survivalkit.html
0
 

Author Comment

by:osthus
ID: 1487075
The question was how to show the combo box when the buttonclick event is fired
0
 
LVL 5

Accepted Solution

by:
chewhoung earned 400 total points
ID: 1487076
Download this file for more example :

ftp://ftp.apexsc.com/pub/files/dbgridsk.exe

Tutorial 8 is a project with combo box feature in grid.
0
 

Expert Comment

by:GrimmVB
ID: 1487077
My answer shows a combo box.  There is no actual function/box built into the button, it's just there so you can access the buttonclick procedure.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

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…
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…
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…
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…
Suggested Courses

877 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