Solved

Adding Checkbox Control to Flexgrid

Posted on 2002-06-18
8
461 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

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