Solved

dbgrid buttonclick code sample

Posted on 1997-06-04
5
587 Views
Last Modified: 2012-06-27
I'd just want to have some sample code wherein you use the buttonclick event of a dbgrid that will pulldown a combo box and then update the contents of the column (with the button) based on the user selection.
0
Comment
Question by:junlabao
5 Comments
 
LVL 1

Expert Comment

by:DarkAge
ID: 1426875
What version 4 or 5?
0
 

Expert Comment

by:delhaye
ID: 1426876
Could you B more explicit ?
You have a DBGrid, a button and a ComboBox ?
And so what ?
0
 

Author Comment

by:junlabao
ID: 1426877
I'm using VB 5.  I've got both a dbgrid and a combox control.  In the office, we deal with a lot of codes such as product codes, client codes, ..., etc.  It would really help if we are able to let users click a button from a column in a dbgrid and he will be presented with the available codes from a combo box.  Since I've gathered that it is impossible to put a combobox in a dbgrid control (ala Access in datasheet view), we are stumped on how to do this.  I've checked and there is a property in the dbgrid wherein you you are able to specify to show a button whenever the column in the dbgrid has the focus.  Based on the help files, once the button is clicked a "buttonclick event" will be trigered and you can add code to pulldown a combo box.  The problem is that help doesn't have any sample code.
0
 
LVL 2

Accepted Solution

by:
Jagar earned 70 total points
ID: 1426878
I'm not really sure if this is what you looking for, but how about this:  Make the combobox invisible.  Then in the click event of the databound grid move the combobox to the right position on the screen and fill it with the appropriate codes.  Then after the user picks on of these codes in the combobox make it invisible again and copy the code that they picked to the DBGrid.  If you do this make sure the combobox appears on top of the DBGrid, with the ZOrder if necessary.
0
 

Author Comment

by:junlabao
ID: 1426879
It would be best if you can provide me with sample code for the buttonclick event of the bounded dbgrid.  How would I let the code know which column currently has the focus (since you will copying the contents of the combobox to the column with the button)?
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

856 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