Solved

checkbox for my datagrid in vb6

Posted on 2009-07-10
15
1,507 Views
Last Modified: 2012-05-07
I have a column in my datagrid that I would like to display as a checkbox.  It is my 5th column.  I am using vb6.  Is there a way to turn that column into a checkbox answer.
0
Comment
Question by:al4629740
  • 7
  • 5
  • 3
15 Comments
 
LVL 10

Expert Comment

by:3_S
Comment Utility
see example
http://www.codeguru.com/vb/gen/vb_database/datagrid/article.php/c7587/

Basicly you have to link a checkbox onto your datagrid.

If you need more explanation feel free to ask.
0
 

Author Comment

by:al4629740
Comment Utility
Can you provide a little more help?  How do I link a checkbox onto the datagrid?
0
 

Author Comment

by:al4629740
Comment Utility
raised points
0
 
LVL 13

Expert Comment

by:game-master
Comment Utility


good afternoon?
are u stock on using the datagrid??

u can use msFlexgrid and u can add some tweak to add a checkbox
on a desired column u want....

game-master
0
 
LVL 10

Expert Comment

by:3_S
Comment Utility
to add a checkbox in datagrad add one checkbox on your form and set index property of checkbox to 0
Then with the provided code you create an array of checkboxes into your datagrid.
One thing you must pay attention to is that your datagrid can scroll and that you must link the correct checkbox to the corresponding record in you datagrid.

The site on codeguru has an example. Do you need another example?
0
 

Author Comment

by:al4629740
Comment Utility
So thats the only option?
0
 

Author Comment

by:al4629740
Comment Utility
Its like a floating checkbox?
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 10

Expert Comment

by:3_S
Comment Utility
Yes no other option when using datagrid.
You can use 3rd party component if you want but I don't know a free one to solve your problem.

It's kind of a floating checkbox. you put a checkbox into the column, one for each row.
0
 
LVL 13

Expert Comment

by:game-master
Comment Utility


like what i have said before...
if u want to see checkbox on ur grid, then use flexgrid rather that datagrid...


game-master
0
 

Author Comment

by:al4629740
Comment Utility
Is it hard to switch it over to flexgrid?  What changes in my code?  If its too much to do, then I may just abort the whole thing.
0
 
LVL 13

Expert Comment

by:game-master
Comment Utility


adding data to flexgrid from the database it very easy to do...
0
 

Author Comment

by:al4629740
Comment Utility

Would this bind the datasource?

      rec.CursorType = adOpenDynamic
      rec.CursorLocation = adUseClient
      rec.LockType = adLockOptimistic
      rec.Open esql, conn, , , adCmdText



     
        Set MSFlexGrid1.DataSource = rec
0
 
LVL 13

Accepted Solution

by:
game-master earned 400 total points
Comment Utility


unfortunately it does not work in that way...

but to add data to the flexgrid is as simple as this way...


rec.CursorType = adOpenDynamic
      rec.CursorLocation = adUseClient
      rec.LockType = adLockOptimistic
      rec.Open esql, conn, , , adCmdText


do until rec.eof
 
 myFlexgrid.additem rec!field1 & vbtab & rec!field2 & vbtab & rec!field3  ...

rec.movenext
loop


game-master
0
 

Author Closing Comment

by:al4629740
Comment Utility
Would the checkbox be a floating for the MSFlexGrid also?
0
 
LVL 13

Expert Comment

by:game-master
Comment Utility


yes it will...
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…

772 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

10 Experts available now in Live!

Get 1:1 Help Now