Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2004
  • Last Modified:

checkbox for my datagrid in vb6

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
al4629740
Asked:
al4629740
  • 7
  • 5
  • 3
1 Solution
 
3_SCommented:
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
 
al4629740Author Commented:
Can you provide a little more help?  How do I link a checkbox onto the datagrid?
0
 
al4629740Author Commented:
raised points
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
game-masterCommented:


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
 
3_SCommented:
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
 
al4629740Author Commented:
So thats the only option?
0
 
al4629740Author Commented:
Its like a floating checkbox?
0
 
3_SCommented:
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
 
game-masterCommented:


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


game-master
0
 
al4629740Author Commented:
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
 
game-masterCommented:


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

Would this bind the datasource?

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



     
        Set MSFlexGrid1.DataSource = rec
0
 
game-masterCommented:


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
 
al4629740Author Commented:
Would the checkbox be a floating for the MSFlexGrid also?
0
 
game-masterCommented:


yes it will...
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 7
  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now