Link to home
Start Free TrialLog in
Avatar of GautamMukherjee
GautamMukherjee

asked on

Adding Checkbox Control to Flexgrid

Hi Friends

I wann a solution for how can i add checkbox to a flex grid control.

I am having 6 columns on which first two column with contain text data and remaining four will be check box. So suggest me how I can add checkbox control when I am populating data in flex grid.

I tried with controll array, but my checkbox is not displaying on flexgrid, it is geting displayed on form.

And i wann it to displayed it should not hide if i leave the cell.
Avatar of ajax625
ajax625

I would do it slightly differently :
There always poses a problem when trying to position a checkbox upon a grid esp when the grid shows vertical scrollers.

what id like to suggest is that u set the text of the cell to look like check or uncheck in the click event of the grid

Private Sub MSFlexGrid1_Click()
With MSFlexGrid1
    .CellFontName = "wingdings"
    .CellAlignment = flexAlignCenterCenter
    .CellFontSize = 16
    If .TextMatrix(.Row, .Col) = vbNullString Then
        .TextMatrix(.Row, .Col) = "ü"
    Else
        .TextMatrix(.Row, .Col) = vbNullString
    End If
End With
End Sub

Subsequently upon save u go thru a routine that'll check the values in the grid and make sense of it

I would do it slightly differently :
There always poses a problem when trying to position a checkbox upon a grid esp when the grid shows vertical scrollers.

what id like to suggest is that u set the text of the cell to look like check or uncheck in the click event of the grid

Private Sub MSFlexGrid1_Click()
With MSFlexGrid1
    .CellFontName = "wingdings"
    .CellAlignment = flexAlignCenterCenter
    .CellFontSize = 16
    If .TextMatrix(.Row, .Col) = vbNullString Then
        .TextMatrix(.Row, .Col) = "ü"
    Else
        .TextMatrix(.Row, .Col) = vbNullString
    End If
End With
End Sub

Subsequently upon save u go thru a routine that'll check the values in the grid and make sense of it

The method for using a flexgrid in combination with any editing control; textbox, combobox, checkbox etc is detailed here.

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q241355
Avatar of GautamMukherjee

ASKER

Sorry Tim that not solved my problem
Now that I look at the question again it probably won't solve your problem. Unfortunately whilst the link I provided is great for certain things it doesn't really help much in respect of checkboxes. The only solutions that work with this rather than a commercial grid product which have this functionality is to simulate a checkbox using two bitmaps. If you have an image of a selected and unselected checkbox, you can then use the .CellPicture property of a specified cell to make it appear as if there is a checkbox in the cell. You then need to store a value that corresponds with the displayed image. This can work quite effectively though it is not a perfect solution.
ASKER CERTIFIED SOLUTION
Avatar of ajax625
ajax625

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DanRollins
Hi GautamMukherjee,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept ajax625's comment(s) as an answer.

GautamMukherjee, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange