Hello,
I know this may look strange but is there a way I can add the value of a control (ex. a value of a textbox) in the forms' Caption field from the Property Sheet?
Thank you
what do you mean?
you can add code to the textbox afterupdate event to set the caption of the form.
you can also add code to the form's current event to set the caption.
Hello and thank you for your quick reply.
I was thinking of making my form more effective by changing the normal text we type in the Caption line (generally is the form's name) with a value that is showing in a text box.
In my case, I would like to show the last name of the selected client. This record is stored in a textbox named txtLName.
as I have said you can add code to the Form's current event and on the textbox afterupdate event.
bring your form in design view.
on property sheet, select from the combobox, Form.
on the Event tab, On Current, choose Code Builder.
Code:
Private Sub Form_Current()
Me.Caption = Me.txtLName & ""
End Sub
save and run your form.
again, select txtLName from the combobox on property sheet.
on the Event tab, After Update, choose Code Builder.
Code:
Private Sub txtLName_AfterUpdate()
Me.Caption = Me.txtLName & ""
End Sub