[Solved] Loop at top and bottom of Gridview
Posted
#1
(In Topic #893)
Enthusiast

I am currently using this code to move a blue highlighter bar in a grid
Code
' Gambas class file
RowCount As Integer = 0
NewRow As Integer = 1
Public Sub Form_Open()
NoSale.LoadNoSaleReason
GridView1.Select(0, 1) ' Set to the First row
RowCount = GridView1.Rows.Count
End
Public Sub Form_KeyPress()
Select Case Key.Code
Case Global.Key_ArrowUp
If NewRow <= RowCount Then
GridView1.Select(NewRow, 1)
NewRow -= 1
Else
GridView1.Select(RowCount, 1)
Endif
Case Global.Key_ArrowDown
If NewRow <= RowCount Then
GridView1.Select(NewRow, 1)
NewRow += 1
Else
GridView1.Select(0, 1)
Endif
Case Global.Key_Enter, Key.Return
'process the selected reason
End Select
End
but I can not seem to capture the bottom and top of the loop correctly (the highlight line would disappear) if someone could advise how to capture this I would be most grateful
Posted
Guru

And this line looks wrong for arrow-up…
If NewRow <= RowCount Then
Maybe something like this?…
Code (gambas)
Posted
Enthusiast

BruceSteers said
I'd forget that NewRow arg, if i press down, then press up the NewRow won't be right.
And this line looks wrong for arrow-up…
If NewRow <= RowCount Then
Maybe something like this?…Code (gambas)
BruceSteers that works perfectly thank you so much and it is so simple as well. I would never had though of something like that
I am LOVING Gambas its so much easier to work with then VB.net 2008 and 2019
1 guest and 0 members have just viewed this.



