Is it possible to have multiple textbox use one timer. What I have is a tabcontrol that shows a datagrid. I have text boxes to filter the grid. so I use a timer control for the keyup on the textbox. Just wanted to clean up the code and maybe get rid of 10 timers. lol
That si for one tab that has two textboxes on it. can they use the same timer? of course each textbox would fire alone.Code:Private Sub TxtMachineSearchQuick_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TxtMachineSearchQuick.KeyUp 'Restart the filter delay. Me.Timer1.Stop() Me.Timer1.Start() End Sub Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick Me.Timer1.Stop() LicensesBindingSource.Filter = "Machine Like '" & TxtMachineSearchQuick.Text & "%'" End Sub Private Sub TxtUserIDSearchQuick_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TxtUserIDSearchQuick.KeyUp 'Restart the filter delay. Me.Timer2.Stop() Me.Timer2.Start() End Sub Private Sub Timer2_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer2.Tick Me.Timer2.Stop() LicensesBindingSource.Filter = "UserID Like '" & TxtUserIDSearchQuick.Text & "%'" End Sub




Reply With Quote
