Solved

How Do I Use A Checkbox In A DBGrid

Posted on 1998-10-13
7
209 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 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…

778 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