DIGIT-ARC read-only archive · snapshot: July 23, 2026

Some Visual Basic 6 doubts..

6 posts · originally from https://geek.digit.in/community/threads/some-visual-basic-6-doubts.59932/

Shayon
Shayon Original post #1
Jun 9, 2007 at 12:24 PM
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
Jun 9, 2007 at 5:19 PM
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... :)
Shayon
Shayon #3
Jun 10, 2007 at 12:22 AM
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!!
RCuber
RCuber #4
Jun 10, 2007 at 12:59 AM
Check if this one helps. Link
Shayon
Shayon #5
Jun 10, 2007 at 9:21 AM
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!! :)
RCuber
RCuber #6
Jun 10, 2007 at 1:52 PM
^^ Thanks :) ,

Happy Coding.. ;)