[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GridView horizontal scrolling on touchscreens


Hi KK

To give users the ability to do that, swap the column widths and data values programmatically.

Out of the box, that is not a function of the gridview object.

Cheers,  Kevin RITCH

Public Sub SwapColumns(Col1 As Integer, Col2 As Integer)
  Dim iAsRow As Integer
  Dim sTempTitle, sTempText As String
  Dim iTempWidth As Integer

  ' 1. Swap Titles
  sTempTitle = GridView1.Columns[Col1].Title
  GridView1.Columns[Col1].Title = GridView1.Columns[Col2].Title
  GridView1.Columns[Col2].Title = sTempTitle

  ' 2. Swap Widths
  iTempWidth = GridView1.Columns[Col1].Width
  GridView1.Columns[Col1].Width = GridView1.Columns[Col2].Width
  GridView1.Columns[Col2].Width = iTempWidth

  ' 3. Swap Cell Data Row by Row
  For iAsRow = 0 To GridView1.Rows.Max
    sTempText = GridView1[iAsRow, Col1].Text
    GridView1[iAsRow, Col1].Text = GridView1[iAsRow, Col2].Text
    GridView1[iAsRow, Col2].Text = sTempText
  Next
End

On 2026-08-12 3:00 am, KKing wrote:

I'd like users to be able scroll horizontally by dragging on Gridview cell left or right is this possible?

References:
GridView horizontal scrolling on touchscreensKKing <kicking177@xxxxxxxxx>