Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Navigation command buttons with Flexgrid.... 2

Status
Not open for further replies.

graphix03

Technical User
Oct 8, 2003
189
0
0
US
Hi,

Does anyone knows how to combine navigation command
buttons with Flexgrid (i'm not sure if I state this
correctly), but the idea is if the user clicked on
first, or prev, or next or last buttons, then the record
also moved accordingly on the flexgrid.

am I making any sense? any input would be greately appreciated. as you can see i can create the procedure
for these separately, but I am working to get
them act together, and so far it has not working.

my code for the flexgrid on click is this:

private sub flexgrid_click()
dim i as interger
dim x as interger
x = flexgrid.row
flexgrid.selectionmode = flexselectionbyrow
with flexgrid
for i = 1 to x
text1.text = flexgrid.textmatrix(i,1)
next
end with
end sub

code for navigation button:
private sub navbuttons()
dim i as integer
for i = 0 to 3
cmdnavigate(i).enabled = true
next

private sub cmdnavigate_click(index as integer)
with rs(i already created a recordset to populate the flexgrid, here I am not sure I have to rewrite the sql
again to re-create the same recordset again),
select case index
case 0
.movefirst
case 1
if not .bof then .movefirst
else
.moveprevious
case 2
if not .eof then .movenext
else
.movelast
case 3
.movelast
end select
end with






 
If I understand you correctly and you are talking about navigation via the rows. Then try something like this.

First: grid.row=0 'or 1 with headers (fixed rows)
next: grid.row=grid.row+1
prev: grid.row=grid.row-1
last: grid.row=grid.rows-1

You can use the .toprow property to ensure that the selected row is always visible on the grid.

If I missed the mark please clarify.

zemp
 
Thank zemp, i think you got something there, so let me try.
thanks so much for helping me. i'm impressed that you understand what I am trying to explain.
 
Okay, I have changed the cmdNavigate_Click()
procedure as zemp suggested above, it works,
but the text on the row of the flexgrid is
not highlighed as I clicked on the navigation
buttons.

also, when I clicked on the last navigation
button, it would go to the last row which is
always empty and tried to insert the
empty row. Thus, it produces the error "Type mismatch".
any idea why it would go to the row that has no data?

any input would be greatly appreciated.

Private Sub cmdNavigate_Click(Index As Integer)
With flexgrid
Select Case Index
'First
Case 0
.Row = 1
Call flexgrid_Click
'Previous
Case 1
.Row = .Row - 1
Call flexgrid_Click
'Next
Case 2
.Row = .Row + 1
Call flexgrid_Click
'Last
Case 3
.Row = .Rows - 1
Call flexgrid_Click
End Select

End With

End Sub
 
You might have to highlight the row manually. Look into the .rowsel property. I can give you more info on Monday when I am at my development machine.

zemp
 
thanks zemp, i will look around too to see if i
can find any solution to this problem. thanks much
for your extra effort.
 
To select an entire row, set the col property to 0 and the colsel property to the last column index
Code:
grid.Col = 0
grid.ColSel = grid.Cols-1


Meddle not in the affairs of dragons,
for you are crunchy, and good with mustard.
 
Thanks tsdryden, I will try your way. thanks much for
helping me.
 
That's what we're here for!

Meddle not in the affairs of dragons,
for you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top