VB code to disable save button after saving a form
-
Please I will like to know if this code written is okay. seems to be having error. The aim is to prevent user from making any changes on form after saving.
CUSTOMER RESERVATION BILLLING (cmdSave, Command2)
If cmdSave.Caption = "Save" Then
Adodc1.Recordset.AddNew
txt.SetFocus
'Disenablebuttons
cmdsave.Enabled = True
cmdAddNew.Caption = "Cancel"
cboClassofRoom.Locked = False
txtCustomer_Name.Locked = False
txtRoomNo.Locked = False
txtCustomer_Address.Locked = False
txtPhone_number.Locked = False
txtAmountPaid.Locked = False
txtCheckin.Locked = False
txtDuration.Locked = False
txtDate.Locked = False
txtReceptionist.Locked = False
Else
Adodc1.Recordset.CancelUpdate
cmdsave.Enabled = False
cmdAdd.Caption = "Add"
'enablebuttons
cboClassofRoom.Locked = True
txtCustomer_Name.Locked = True
txtRoomNo.Locked = True
txtCustomer_Address.Locked = True
txtPhone_number.Locked = True
txtAmountPaid.Locked = True
txtCheckin.Locked = True
txtDuration.Locked = True
txtDate.Locked = True
txtReceptionist.Locked = True
End IF
End Sub -
Please I will like to know if this code written is okay. seems to be having error. The aim is to prevent user from making any changes on form after saving.
CUSTOMER RESERVATION BILLLING (cmdSave, Command2)
If cmdSave.Caption = "Save" Then
Adodc1.Recordset.AddNew
txt.SetFocus
'Disenablebuttons
cmdsave.Enabled = True
cmdAddNew.Caption = "Cancel"
cboClassofRoom.Locked = False
txtCustomer_Name.Locked = False
txtRoomNo.Locked = False
txtCustomer_Address.Locked = False
txtPhone_number.Locked = False
txtAmountPaid.Locked = False
txtCheckin.Locked = False
txtDuration.Locked = False
txtDate.Locked = False
txtReceptionist.Locked = False
Else
Adodc1.Recordset.CancelUpdate
cmdsave.Enabled = False
cmdAdd.Caption = "Add"
'enablebuttons
cboClassofRoom.Locked = True
txtCustomer_Name.Locked = True
txtRoomNo.Locked = True
txtCustomer_Address.Locked = True
txtPhone_number.Locked = True
txtAmountPaid.Locked = True
txtCheckin.Locked = True
txtDuration.Locked = True
txtDate.Locked = True
txtReceptionist.Locked = True
End IF
End SubSeriously? Did you even read your code?
'Disenablebuttons (This should read DISABLE BUTTONS)
cmdsave.Enabled = True ??????????Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak -
Seriously? Did you even read your code?
'Disenablebuttons (This should read DISABLE BUTTONS)
cmdsave.Enabled = True ??????????Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiakcmdsave.Enabled = False