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

x
?
Solved

How Do I Use A Checkbox In A DBGrid

Posted on 1998-10-13
7
Medium Priority
?
223 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 100 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

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

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…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

927 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