Solved

Adding Checkbox Control to Flexgrid

Posted on 2002-06-18
8
459 Views
Last Modified: 2012-08-14
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.
0
Comment
Question by:GautamMukherjee
8 Comments
 

Expert Comment

by:ajax625
ID: 7087624
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

0
 

Expert Comment

by:ajax625
ID: 7087631
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

0
 
LVL 43

Expert Comment

by:TimCottee
ID: 7087842
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
0
 

Author Comment

by:GautamMukherjee
ID: 7092577
Sorry Tim that not solved my problem
0
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

 
LVL 43

Expert Comment

by:TimCottee
ID: 7092653
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.
0
 

Accepted Solution

by:
ajax625 earned 50 total points
ID: 7094730
The real problem when u use a bitmap, instead of a font/text is that  when u r ready to read the values of the grid, tryin to figure out what cell is checked and whats unchecked, u have to compare the names of the bitmap that u used. If u r using a resource (.res) to store the bitmap and loadin 'em in the grid, ur problem increases because u have nothing to compare with.

I have always used symbolic fonts to achieve this and never had a problem. If however ur sceptical about using certain fonts, u might wanna use symbols like #,@ etc.

.TextMatrix(.Row, .Col) = "#"

anyway cheers

0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7911156
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
0
 

Expert Comment

by:SpideyMod
ID: 7967822
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…

757 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

20 Experts available now in Live!

Get 1:1 Help Now