squinton87
New member
I have two questions for anyone who can throw some idea's my way:
Question 1:
I am currently working on a control with three combo box's. This control will be nested on a form, and I want the on-board timer to track how long each control is active. I am trying to use the focus events of the combobox's to determine if the control is active so the program will know when the timer should be started and stopped. My problem is, for example, when the user causes the text property of the combo boxes to change, the folowing code runs:
which calls this sub-routine:
As you can see, there are points in this sub-routine that can cause the focus to shift, as well as fire the text changed event. While this all happens faster than is really noticable, I would like to eliminate the extra cycles if at all possible. Any suggestions?
Question 2:
As I mentioned in question one, I am adding this control to a form, to be more clear I am adding multiple instances of this control to a single form, and I am trying to use the focus events to determine which of the controls within the form are active; however, when the form itself is no longer the active application, whether it is minimized, behind another application or otherwise, all of the timers stop. I want whichever control was active at the time that the form was deactivated, to continue as if nothing changed. Any suggestions?
Question 1:
I am currently working on a control with three combo box's. This control will be nested on a form, and I want the on-board timer to track how long each control is active. I am trying to use the focus events of the combobox's to determine if the control is active so the program will know when the timer should be started and stopped. My problem is, for example, when the user causes the text property of the combo boxes to change, the folowing code runs:
VB.NET:
Public Sub cmb_TextChange(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbJobNo.TextChanged, cmbSubNo.TextChanged, cmbTask.TextChanged
Call ColorCheck()
End Sub
which calls this sub-routine:
VB.NET:
Private Sub ColorCheck()
If tmrTask.Enabled = True Then
SetColors(Drawing.Color.Green, Drawing.Color.White)
ElseIf cmbJobNo.Text <> "" And cmbSubNo.Text <> "" And cmbTask.Text <> "" Then
SetColors(Drawing.Color.LightGreen, Drawing.Color.Black)
ElseIf cmbJobNo.Text = "" Then
cmbSubNo.Enabled = False
cmbTask.Enabled = False
cmbSubNo.Text = ""
cmbTask.Text = ""
SetColors(Drawing.Color.Yellow, Drawing.Color.Black)
ElseIf cmbSubNo.Text = "" Then
cmbSubNo.Enabled = True
cmbTask.Enabled = False
cmbTask.Text = ""
SetColors(Drawing.Color.Yellow, Drawing.Color.Black)
ElseIf cmbTask.Text = "" Then
cmbTask.Enabled = True
SetColors(Drawing.Color.Yellow, Drawing.Color.Black)
End If
End Sub
As you can see, there are points in this sub-routine that can cause the focus to shift, as well as fire the text changed event. While this all happens faster than is really noticable, I would like to eliminate the extra cycles if at all possible. Any suggestions?
Question 2:
As I mentioned in question one, I am adding this control to a form, to be more clear I am adding multiple instances of this control to a single form, and I am trying to use the focus events to determine which of the controls within the form are active; however, when the form itself is no longer the active application, whether it is minimized, behind another application or otherwise, all of the timers stop. I want whichever control was active at the time that the form was deactivated, to continue as if nothing changed. Any suggestions?