Solved

How Do I Use A Checkbox In A DBGrid

Posted on 1998-10-13
7
207 Views
Last Modified: 2013-12-25
Using VB5 (and/or VB6) I have written a program to track monies owed by certain companies.  
I have to track overdue amounts, which I have dome using SQL.
I have loaded the outstanding amounts and details into a DB grid.  Now I need to be able to use some form of a checkbox or the like within the grid to state whether or not the amount has been paid, and thus remove it from the recordsource (the latter I think I can do ok).
Basically, I need to know the best way to perform the reconcilintion part 9ie - the checkboxes)

Hope someone can help!!!!


0
Comment
Question by:nu2vb
7 Comments
 
LVL 3

Expert Comment

by:vmano
ID: 1496885
I had to do similar thing in a project which i worked on. but we switched to MSFlexGrid just 'coz it's difficult with DBGrid. and as far as i know both are pretty much same functionality wise.
In MSFlexGrid you have a property called "CellPicture" which you can use to load a checkbox (checked/uncheked) picture depending on the field value. if you are open to this option, let me know.

vmano
0
 
LVL 3

Expert Comment

by:TheAnswerMan
ID: 1496886
I use TrueGridPro.. which which is mad by the same punks who gave you dbGrid.

It has a feature that you can do similar to VManos, except that it doesnt load up a picture.. it is internal and can automatically change on clicking it.

I use the feature of adding a bitmap, though, becasue i like the
ability to put Checks.. or X's or dots.. or whatever in my checkboxes.  

It also has some good unbound features.

If you cant do that.. then Vmanos cellPicture will do it.. i dont know if it will change for you or you have to code for it or not , though.
0
 

Author Comment

by:nu2vb
ID: 1496887
Thanks guys for your help.  I don't have TrueGridPro, so I'll have to give that one a miss (though it sounds good).  I have no idea about how to use the form20.dll, so i'll have to let that one go.

The FlexGrid may be my only option, and if it's worked before, what the heck, I'll give it a go.

If you could vmano, please give me the details on how to proceed.  I'd really appreciate it.

And thanks again all of you for your input - It all helps!!!!!

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 3

Expert Comment

by:vmano
ID: 1496888
nu2vb,
you have to find .bmp of checked and unchecked and then you can load those images in to your MSFlexGrid like this:
(field1 can be a boolean or number)
if data1!field1 = 1 or Yes then
   MSFlexGrid.col = 1
   MSFlexGrid.row = 1
   set MSFlexGrid.cellpicture = LoadPicture("C:\checked.bmp")
else 'the value is zero or no
   MSFlexGrid.col = 1
   MSFlexGrid.row = 1
   set MSFlexGrid.cellpicture = LoadPicture("C:\unchecked.bmp")
endif

you can put the same code in the MSFlexGrid click event.

let me know if you want any other details,
vmano
 

 
0
 

Expert Comment

by:vinoopauls
ID: 1496889
You can try this too
have a listbox containing 2 values 'Yes' and 'No' and keep it invisible
On the buttonclick event for the particular cell make it visible and have the user click the required value into the cell. This will remove the need for all the bmps

0
 

Author Comment

by:nu2vb
ID: 1496890
Thanks for all your help guys!
I'm going to try the above couple of suggestions in my program and hopefully get it working!

I appreciate all of your help..........
0
 
LVL 3

Accepted Solution

by:
BGillham earned 50 total points
ID: 1496891
DBGrid does not support this feature. Now you have two choices.
1. Buy a grid that does support this feature.
2. Place a checkbox on you form and when the column receives focus make the checkbox visible and Move it over the Cell. On LostFocus display True / False or whatever.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DIR issue 7 51
VB6 code to programmatically convert pdf to excel 21 70
SSRS expression Issue finding a string 10 66
Add and format columns in vb6 7 46
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now