How can I put tabindex for datagrid so that I can go to the next cell with tab?
How can I put tabindex for datagrid so that I can go to the next cell with tab?
Hi Maryam,
I did a little searching via google and came across this:
Hi Kevin,
Is it MS flexgrid control ? If not please ignore my comment.
If so then you can use the TextMatrix property. ControlName.TextMatrix(1,2)=3 will put 3 into the Row2 and Column3 (rows and columns start counting from 0)
A sample code might be like the following one: Control name is flxControl in sample code.
code:
Private Sub UserForm_Initialize()
Dim rng As Range
Dim cll As Range
Dim i As Long
'Assuming data range is "E2:H18" on sheet1
Set rng = Sheet1.Range("E2:H18")
'flxControl is the flexgrid control name
With Me.flxControl
.ColWidth(0) = 300
.Rows = rng.Rows.Count + 1
.Cols = rng.Columns.Count + 1
'Row Numbers
For i = 1 To .Rows - 1
.TextMatrix(i, 0) = i + rng.Cells(1, 1).Row - 1
Next i
'Column Letters - simplified: doesn't work correctly after Z
For i = 1 To .Cols - 1
.TextMatrix(0, i) = Chr(64 + i + rng.Cells(1, 1).Column - 1)
Next i
'TextMatrix(Row,Column) : TextMatrix(0,0) is the top-left cell of flexgrid
For Each cll In rng.Cells
.TextMatrix(cll.Row - rng.Cells(1, 1).Row + 1, cll.Column - rng.Cells(1, 1).Column + 1) = cll.Value
Next cll
End With
End Sub
Don't know if it will answer your question but it might prompt one of the good guys for a responce.
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
I am using datagrid not MSflexgrid and I dont find text matrix property for datagrid!
Dear Maryam
Could you please send me a sample of datagrid?
Thanks
attached is datagrid.
any solution for this? tabindex for dataGrid?