September 8th, 2002, 10:29 PM
Placing a Checkbox in a FlexGrid Cell
I have a MSFlexGrid control on my form. How can I place a checkbox control on specified cells of the grid upon loading? I have this sample code, but doesn't do the way I intend it to:
Dim intNextIndex As Integer
For I = 1 To 10
For J = 1 To 5
' Find the next available index
intNextIndex = Check1().Count + 1
' Add the new checkbox on the form
' Position the checkbox on the flexgrid's cell
.Top = MSFlexGrid1.Top + MSFlexGrid1.CellTop
.Left = MSFlexGrid1.Left + MSFlexGrid1.CellLeft
.Width = MSFlexGrid1.CellWidth
.Height = MSFlexGrid1.CellHeight
' By default, the new checkbox is not visible
.Visible = True
I have an invisible checkbox control placed on the form already, called Check1, with Index = 0. This code is just part of a long code which puts data and formats them on the grid all at run-time. The checkboxes are loaded dynamically from row 1 to 10, from column 1 to 5. Since checkboxes are not easily placed in the grid cells like simple text does, I have to load them during run-time. The next available index of a checkbox control array is taken, then the new checkbox is loaded and positioned in the specified cell.
Does anyone have a suggestion why this doesn't work?
September 8th, 2002, 11:30 PM
good example in vb-helper.com
September 9th, 2002, 12:58 AM
Placing a Checkbox in a FlexGrid Cell
Thank you, dinesh for the attached sample. That answered my question! I have another question though: I need to determine the name/caption of the row and the column where the user clicked. These will be passed as parameters to another form. How can I do that?
Thanks again in advance!
September 9th, 2002, 01:04 AM
Flexgrid1.Text = is the text which contains the Clicked Cell
?MSFlexGrid1.TextMatrix(0,Flexgrid1.Col ) = Give u the Column name of the currently clicked Cell
I'm not sure whether I answerd RU question.
September 9th, 2002, 03:56 AM
Thanks again, dinesh. Yes, you answered my question very well. I just modified your code to get different row and column names. I hope to contact you again in case I have new questions regarding flexgrid manipulations.
September 9th, 2002, 04:49 AM
Yes UR welcome.
I learn lot from this forum.So I'm willing to help the people,from the little things that I know.
September 18th, 2002, 02:45 AM
Hello again dinesh. It's me daneb. I just want to ask how can I trigger the click event of the picture containing the checkbox in the flexgrid cell? I put a code in the Picture_Click() event, but it doesn't fire when I click on a flexgrid cell; instead the code located in the MSFlexGrid_Click() event is the one being activated. The flexgrid's click event overrides the picture's click event. How can I make the picture respond to an event such as this? Thanks!
September 18th, 2002, 03:31 AM
That is bcos we Set MSFlexGrid1.CellPicture = picUnchecked
After that picture is a part of the msflexgrid.
September 18th, 2002, 03:40 AM
Hi. So, is there no way that the picture box can respond to the click or to any event? Can we place the picture box on top of each cell of the grid, instead of embedding it in the flexgrid?
September 18th, 2002, 03:49 AM
Yes u can
There is a sample which I put combo box on the flex grid.
I will attached it for u.
August 22nd, 2016, 06:46 AM
Re: Placing a Checkbox in a FlexGrid Cell
i am using MSFlexgrid object, and using it for read / Write from CSV file.
I want to set data type of columns of grid objects, like Column 1 Contains only String data type, 2nd column should contains Bool (True/False, 0/1), etc.. Is this possible?
For bool i want to give checkbox.
Or is there any other Active X Objects available?
Any help really appreciated
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!