Public Class frmInvoice
Private Sub frmInvoice_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Backup_GAPDataSet.qryInvoice' table. You can move, or remove it, as needed.
'Me.QryInvoiceTableAdapter.Fill(Me.Backup_GAPDataSet.qryInvoice)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.QryInvoiceBindingSource.Filter = "MIRCrDate = '" & Me.txtDate.Text & "'"
End Sub
End Class
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.QryInvoiceBindingSource.Filter = "MIRCrDate = '" & Me.txtDate.Text & "'"
Me.QryInvoiceTableAdapter.Fill(Me.Backup_GAPDataSet.qryInvoice)
End Sub
That looks like a good start, but you should probably not reload data from database each time button is clicked. Instead you can load the data in background once form loads.i do get the result i want but just curious i am on the correct path![]()
Private Sub frmInvoice_Load(sender As Object, e As EventArgs) Handles MyBase.Load GetDataAsync() End Sub Private Async Sub GetDataAsync() Await Task.Run(Function() Me.QryInvoiceTableAdapter.Fill(Me.Backup_GAPDataSet.qryInvoice)) End Sub
As you can see it is declared. Perhaps your forum profile is wrong when saying you use .Net 4.5 ? There are of course other ways to perform async operations in older .Net frameworks.Triedgave an error " 'GetDataAsync' is not declared. It may be inaccessible due to its protection level. "VB.NET:GetDataAsync()
Settings (top-right menu) > Edit Profile (left menu).Ahmmmm ! didn't know what put in since am not much of a "Programming guy". sorry about that and how do i correct it ?
Change load call to:Hi jmcilhinney,
without the filter shows all the data how can i stop it from loading when the form loads and rather display them as the text box is filled-in.
Threading.ThreadPool.QueueUserWorkItem(AddressOf GetData)
Private Sub GetData(state As Object) Me.QryInvoiceTableAdapter.Fill(Me.Backup_GAPDataSet.qryInvoice) End Sub
Public Class frmSearch
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Backup_GAPDataSet.qryMIR' table. You can move, or remove it, as needed.
'Me.QryMIRTableAdapter.Fill(Me.Backup_GAPDataSet.qryMIR)
[COLOR=#ff0000]Threading.ThreadPool.QueueUserWorkItem(AddressOf GetData)[/COLOR]
End Sub
[COLOR=#ff0000] Private Sub GetData(state As Object)
Me.QryMIRTableAdapter.Fill(Me.Backup_GAPDataSet.qryMIR)
End Sub[/COLOR]
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
txtTicket.Text = ""
txtPNR.Text = ""
End Sub
Private Sub txtPNR_TextChanged(sender As Object, e As EventArgs) Handles txtPNR.TextChanged
Me.QryMIRBindingSource.Filter = "PNR Like '%" & Me.txtPNR.Text & "%'"
End Sub
Private Sub txtTicket_TextChanged(sender As Object, e As EventArgs) Handles txtTicket.TextChanged
Me.QryMIRBindingSource.Filter = "TicketNumber Like '%" & Me.txtTicket.Text & "%'"
End Sub
End Class
I don't know about your filter expression, but same code just setting a relevant filter works as expected here.the form opens up faster without loading the data but as i type into the text box nothing happens.