3 replies
by smd&ms Accepted solution
by tony hopkinson Accepted solution
the BindingNavigator component (it in the Data section of the toolbox) is teh tool of choice cookie cutter wise, pop one on, set it to the same datasource as your grid? and Bob is your mother's sister's brother.
Search is a tad more complicated.
If you want to search in the data you have that's driving the grid, this should help
http://www.programmersheaven.com/mb/VBNET/293286/293286/find-data-in-data-table/
if you mean search as in query out the data from sql server to poulate the grid, that's a whole 'nother ball game.
by mydiab Accepted solution
Let us assume you are using text boxes and by pushing the next and previous button you will move throught an array of previously built records maybe from a database select. Remember this is a simple solution a bound dataset would be what you shooting for. first you will need a structure as
Private Structure Config
Dim ServerName As String
Dim DBName As String
Dim FileSize As String
End Structure
next you will need to bind the structure to a array as in
Dim strArray(1) As Config
Add a varible to maintain a key or bookmark of the current record in the array
Dim strArrayCurrentKey As Int16
next you will add you next and previous buttons to the form and add some code to each as shown below.
Private Sub CmdNextRecord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdNextRecord.Click
strArrayCurrentKey = strArrayCurrentKey + 1
If strArrayCurrentKey > UBound(strArray, 1) Then
strArrayCurrentKey = UBound(strArray, 1)
End If
Call LoadNewRecord()
End Sub
Private Sub CmdLastRecord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdLastRecord.Click
strArrayCurrentKey = UBound(strArray, 1)
Call LoadNewRecord()
End Sub
Now you will need a sub to load the textboxes
Private Sub LoadNewRecord()
TxtServer.Text = strArray(strArrayCurrentKey).ServerName
TxtDBName.Text = strArray(strArrayCurrentKey).DBname
TxtFileSize.Text = strArray(strArrayCurrentKey).FileSize
End Sub
The textboxes will now change by pressing the next and Previous buttons.
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending