English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

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?

2007-06-08 18:48:57 · 3 answers · asked by Shayonâ?¢ 2 in Computers & Internet Programming & Design

@ nBrEaD

1stly, I'd specifically asked that the label 'LblTrial', that needs to be displayed on 'FrmDIsplay', needs to be created dynamically i.e. using codes. The caption too needs to be specified dynamically.

2ndly, I think the solution you've given to me pertains to Visual Basic.NET. I need a solution that pertains to Visual Basic 6.0.

Btw, thanks for the effort.

2007-06-08 19:25:37 · update #1

@ Mark G and Roby A

Guys, I think there's one thing that everyone of u is missing...
I wish to create the label at runtime. The label is not supposed to be present when I run the program. The label is supposed to be created and displayed only after a button is clicked.

For example, say every time a user clicks a button, a label saying 1, 2, 3, 4,... should keep appearing. How do you think I can achieve that?

2007-06-09 08:00:02 · update #2

3 answers

To handle the label captioning use the FormLoad event. In this event assign the caption you want to the lable.

For opening forms with a command buton....
You will need two forms....

Form1 with a command button, you will use this buttons click event to execute code which will load the second form

each time the button sub routine fires

dimention a variable (frm2 for example) as a new form2

load frm2
then show frm2


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

If we give you any more help than this WE will have written your code. So what grade will WE get?

2007-06-09 01:55:11 · answer #1 · answered by MarkG 7 · 0 0

make a new form name it FrmQuery,
add another form (form2), in form2 add a label name it LblTrial and save this 2nd form as FrmDisplay(dont forget to change the name), and then change the label(LblTrial)text to the text Hello World!
then in the first form, add a button, name it CmdSearch, double click the button and add the following code
'
Private Sub CmdSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdSearch.Click
Dim oForm As FrmDisplay
oForm = New FrmDisplay()
oForm.Show()
oForm = Nothing
End Sub
End Class
'

2007-06-09 02:15:13 · answer #2 · answered by Anonymous · 0 0

on the click event of the cmdSearch enter the following

frmDisplay!lblTrial.caption= "Hello World"
frmDisplay.show

2007-06-09 14:00:21 · answer #3 · answered by Roby A 1 · 0 0

fedest.com, questions and answers