Solved

Adding Checkbox Control to Flexgrid

Posted on 2002-06-18
8
465 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
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!

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
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…

740 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