Some Visual Basic 6 doubts..

Status
Not open for further replies.

Shayon

Broken In
Well.I have a button 'CmdSearch' in a form named 'FrmQuery'. My requirement is that whenever I click on the 'CmdSearch' Button, a new form named 'FrmDisplay' should load and the string "Hello World!" should be written as the caption of the label 'LblTrial', that needs to be dynamically created using code, on 'FrmDisplay'.

Can anybody help me out with the kinda code I'd need to write? :)
 

deepak.krishnan

In the zone
First of all keep a label box named lbltrial in frmquery and just delete the caption of the label. Then give this code in the click property of the command button.
Code:
Private Sub cmdsearch_Click()
Dim frmdisplay As New frmquery
frmdisplay.Show
frmdisplay.lbltrial.Caption = "Hello World!"
End Sub

Also if you want to change the caption of the new form that is created during the program run, just give the following code:
Code:
frmdisplay.Caption = "New Caption"

I think this should help you out... :)
 
OP
Shayon

Shayon

Broken In
deepak.krishnan said:
First of all keep a label box named lbltrial in frmquery and just delete the caption of the label. Then give this code in the click property of the command button.
Code:
Private Sub cmdsearch_Click()
Dim frmdisplay As New frmquery
frmdisplay.Show
frmdisplay.lbltrial.Caption = "Hello World!"
End Sub
Also if you want to change the caption of the new form that is created during the program run, just give the following code:
Code:
frmdisplay.Caption = "New Caption"
I think this should help you out... :)

Dude, Wot I specifically wish to do is create the labels at runtime. The label is not supposed to be created before the program is being run!!
 
OP
Shayon

Shayon

Broken In
charangk said:
Check if this one helps. Link

Dude, that's an awesome link! I think I'll be able to figure the rest myself. Am not on my comp right now, so can't try it out. But I think the link can enable me to do things the way I want. Thanks a lot, again!! :)
 
Status
Not open for further replies.
Top Bottom