Solved

How Do I Use A Checkbox In A DBGrid

Posted on 1998-10-13
7
204 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…

747 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

7 Experts available now in Live!

Get 1:1 Help Now