Consulting

Results 1 to 6 of 6

Thread: how to put tabindex for rows of data Grid?

  1. #1

    how to put tabindex for rows of data Grid?

    How can I put tabindex for datagrid so that I can go to the next cell with tab?

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,059
    Location
    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

  3. #3
    I am using datagrid not MSflexgrid and I dont find text matrix property for datagrid!

  4. #4
    VBAX Contributor
    Joined
    May 2007
    Posts
    128
    Location
    Dear Maryam

    Could you please send me a sample of datagrid?

    Thanks

  5. #5
    attached is datagrid.

  6. #6
    any solution for this? tabindex for dataGrid?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •