Enabling/Disabling Buttons
From: Roshawn (udrago_at_bellsouth.net)
Date: 02/04/04
- Next message: Yasutaka Ito: "Re: Enumerating non-ui components from the given form instance"
- Previous message: Mark Hebbel: "Problem with the .Visible property of a ToolbarButton and the button size"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 4 Feb 2004 09:15:42 -0600
Hi,
I'm having trouble enabling/disabling buttons. I have several buttons on my
form (Add, Edit, OK, Cancel, Delete, and Save). When I click a particular
button (Edit), I'd like all buttons except two (OK and Cancel) to be
disabled. And if either OK or Cancel are clicked, I'd like the other
buttons to be enabled while OK and Cancel are disabled. I've tried to
implement this functionality in a utility method but to no avail. Could it
be that my code is faulty or that I've placed the utility method in the
wrong order (the other code included works great as I've already tested it)?
Here's my code:
**************************
Select Case CType(sender, Button).Name
'code for other buttons omitted
Case "btnEdit"
EnableButtons(False) ' utility method
row = dvCustomers.AddNew()
row.BeginEdit()
Case "btnOK"
.EndCurrentEdit()
EnableButtons(True)
Case "btnCancel"
.CancelCurrentEdit()
EnableButtons(True)
End Select
Private Sub EnableButtons(ByVal blnEnable as Boolean)
btnAdd.Enabled = blnEnable
btnCancel.Enabled = blnEnable
btnEdit.Enabled = blnEnable
btnDelete.Enabled = blnEnable
btnSave.Enabled = blnEnable
btnOK.Enabled = Not blnEnable
btnOK.Enabled = Not blnEnable
End Sub
***************************
Thanks,
Roshawn
- Next message: Yasutaka Ito: "Re: Enumerating non-ui components from the given form instance"
- Previous message: Mark Hebbel: "Problem with the .Visible property of a ToolbarButton and the button size"
- Messages sorted by: [ date ] [ thread ]