SBendBuckeye
Programmer
Hello All,
We have a Windows form with a couple dozen comboboxes and textboxes on it. Included in these controls are a handful of comboboxes which display static data. The underlying tables behind the Sql Server stored procedures include an nvarchar(4000) column named Details. The users want a Details button which when clicked will pop up the Details data for the currently selected item in the currently selected combobox.
To simplify things, lets say that they are Combo1, Combo2, Combo3 and Combo4 and the associated button is cmdDetails. There are a couple dozen controls on the form in total. I don't want to have to do a bunch of event coding so here is what I have done so far:
A. Set up GotFocus event for Combo1, ..., Combo4 to enable cmdDetails
B. Set up LostFocus event for Combo1, .l.., Combo4 to disable cmdDetails
The problem is that when I click cmdDetails the LostFocus in B above disables it so its Click Event is cancelled by the system. Is there any way to determine whether the mouse was clicked within the control rectangle for cmdDetails so that I cannot disable the button in that case? Maybe something like this:
Thanks in advance for any ideas, suggestions, etc!
Have a great day!
j2consulting@yahoo.com
We have a Windows form with a couple dozen comboboxes and textboxes on it. Included in these controls are a handful of comboboxes which display static data. The underlying tables behind the Sql Server stored procedures include an nvarchar(4000) column named Details. The users want a Details button which when clicked will pop up the Details data for the currently selected item in the currently selected combobox.
To simplify things, lets say that they are Combo1, Combo2, Combo3 and Combo4 and the associated button is cmdDetails. There are a couple dozen controls on the form in total. I don't want to have to do a bunch of event coding so here is what I have done so far:
A. Set up GotFocus event for Combo1, ..., Combo4 to enable cmdDetails
Code:
Private Sub cmbStructureClassification_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbStructureClassification.GotFocus, cmbExposureCategory.GotFocus, cmbTopographicCategory.GotFocus, cmbSeismicZone.GotFocus
'Save currently active control in module level variable
mDetailsControl = CType(sender, ComboBox)
[b]Me.cmdDetails.Enabled = True[/b]
End Sub
Code:
Private Sub cmbStructureClassification_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbStructureClassification.LostFocus, cmbExposureCategory.LostFocus, cmbTopographicCategory.LostFocus, cmbSeismicZone.LostFocus
[b]Me.cmdDetails.Enabled = False[/b]
End Sub
Code:
Private Sub cmbStructureClassification_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbStructureClassification.LostFocus, cmbExposureCategory.LostFocus, cmbTopographicCategory.LostFocus, cmbSeismicZone.LostFocus
'Following is PseudoCode
MouseClickedInCommandButton = IsMouseOverCommandButton
If Not MouseClickedInCommandButton Then
Me.cmdDetails.Enabled = False
End If
End Sub
Have a great day!
j2consulting@yahoo.com