问题描述:

I have a flexgid with 3 columns. I need to make the first column a checkbox column so that users can check and uncheck there. And i need the other column values which are checked. ` MSFlexGridBrg.Width = "3200"

For Bea = 1 To NbBearg

MSFlexGridBrg.Rows = NbBearg + 1

MSFlexGridBrg.Cols = 3

 'MSFlexGridBrg.CellFontName = "Wingdings"

MSFlexGridBrg.TextMatrix(0, 0) = "Select"

If MainUnitIn Then

MSFlexGridBrg.TextMatrix(0, 2) = "Cu (N)"

Else

MSFlexGridBrg.TextMatrix(0, 2) = "Cu (lbf)"

End If

MSFlexGridBrg.Row = 1

MSFlexGridBrg.col = 1

MSFlexGridBrg.TextMatrix(0, 1) = "Bearing No."

MSFlexGridBrg.Row = Bea

MSFlexGridBrg.Text = Bea & ". "

MSFlexGridBrg.col = 1

MSFlexGridBrg.TextMatrix(MSFlexGridBrg.Row, 2) = Cu_Value_Estimate(Bea)

Next`

The output is attached as the image. I want the column named Select as the Checkbox column.

网友答案:

You can't do that in your current first column, as it is a fixed column which doesn't allow edit. Add a new column and inside your formatting loop (which isn't clearly to see in your code sample, but i see there is the next at the very bottom) use a standard formatting code:

   If myBooleanVar = True Then  
       MSFlexGridBrg.TextMatrix(i, 0) = "Yes"  
   Else  
       MSFlexGridBrg.TextMatrix(i, 0) = "No"  
   End If 

If you need to use the first cell of the column to select all the rows, you may use the MSFlexGridBrg_Click() and then check for MSFlexGridBrg.MouseCol = -1 and MSFlexGridBrg.MouseRow = -1 - but a checkbox won't never appear.

相关阅读:
Top