Hello Again Good People.
I have a Data Grid View Called (DGVPaymentsOut) and 5 Buttons Called
CmdFirst, CmdPrevious, CmdNext, CmdLast, CmdClear
When my form loads the (DGVPaymentsOut) is populated with the data in my SQL Database.
When I click any one of the buttons Lets say "CmdNext" Then the next Row in my DGV is highlighted everything is working Fine.
But if I initiate a search from a textbox called (TxtFilter) The DGV shows only the Records/rows with what is inserted into the textbox.
Now here is where I have the issue None of the Buttons work except the CmdClear which Re-Populates all of the records. But the rest of the buttons do not work for the Data Grid View
If I click Any of the Buttons (CmdNext, CmdLast, CmdPrevious, or CmdFirst). the Data Grid View stays on the first row only and does not move.
But When I close and reload the form all the buttons work as intended until I do a search from the textbox.
I Hope any of you Good People Can Tell me what is missing or what I have done Wrong
Kind Regards
Gary
The Code I have at the moment>>>
Private Sub CmdFirst_Click(sender As Object, e As EventArgs) Handles CmdFirst.Click
PaymentsOutBindingNavigator.MoveFirstItem.PerformClick()
Label14.Text = PaymentsOutBindingNavigator.PositionItem.Text
Label15.Text = PaymentsOutBindingNavigator.CountItem.Text
ColourChange()
End Sub
Private Sub CmdPrevious_Click(sender As Object, e As EventArgs) Handles CmdPrevious.Click
PaymentsOutBindingNavigator.MovePreviousItem.PerformClick()
Label14.Text = PaymentsOutBindingNavigator.PositionItem.Text
Label15.Text = PaymentsOutBindingNavigator.CountItem.Text
ColourChange()
End Sub
Private Sub CmdNext_Click(sender As Object, e As EventArgs) Handles CmdNext.Click
PaymentsOutBindingNavigator.MoveNextItem.PerformClick()
Label14.Text = PaymentsOutBindingNavigator.PositionItem.Text
Label15.Text = PaymentsOutBindingNavigator.CountItem.Text
ColourChange()
End Sub
Private Sub CmdLast_Click(sender As Object, e As EventArgs) Handles CmdLast.Click
PaymentsOutBindingNavigator.MoveLastItem.PerformClick()
Label14.Text = PaymentsOutBindingNavigator.PositionItem.Text
Label15.Text = PaymentsOutBindingNavigator.CountItem.Text
ColourChange()
End Sub
Public Sub LoadGrid(Optional Query As String = "")
If Query = "" Then
SQL.ExecQuery("SELECT * FROM PaymentsOut;")
Else
SQL.RunQuery(Query)
End If
'Error Handling
If SQL.HasException(True) Then Exit Sub
'Load DGV ( DGVPaymentsOut )
DGVPaymentsOut.DataSource = SQL.SQLDT
End Sub
Private Sub FindCompany()
SQL.AddParam("@Item", "%" & TxtFilter.Text & "%")
'Load The DataGridView ( DGVPaymentsOut ) Where Company Name = TxtFilter/Company Name
LoadGrid("SELECT * FROM PaymentsOut WHERE Company LIKE @Item;")
End Sub
Private Sub TxtFilter_TextChanged(sender As Object, e As EventArgs) Handles TxtFilter.TextChanged
FindCompany()
End Sub