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
Load Check1(intNextIndex)
' Position the checkbox on the flexgrid's cell
With Check1(intNextIndex)
.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
End With
Next J
Next I
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?
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, 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.
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!
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?
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.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.