## How to replace a caption in vb6 if it is left blank

Asked By 50 points N/A Posted on -

Hello guys,

I am just a beginner in Visual Basic 6. I would like to ask that if there is a caption in vb6 and in that caption there is a textbox which will be empty but when the user fills it the caption will be replaced.

Thank you all.

SHARE
Answered By 10 points N/A #144995

## How to replace a caption in vb6 if it is left blank

Hi Donnaa,

Changing caption is very easy you can make it with only one line of code. For example you create a new form with a caption of "Form 1", you want to change its caption using a textbox so you can change it at runtime. This the code to change the caption.

Form1.caption = Textbox1.Text

"Form1" is the name of the form you want to change the caption and "Textbox1" is the textbox with the text to change the caption of Form1.

You can put this in a command button events or any events you want. You can also change the caption of buttons, labels and frames. I hope this will help you.