By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,010 Members | 2,774 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,010 IT Pros & Developers. It's quick & easy.

How to change label.text from on form in another form

P: n/a
Hello,
How do i change a label in another form from another one?
in vb6 i use to do this:

form1:
private sub label1_change()
form2.label1.caption="hgghjghjg"
' and the label in form2 is changed by the value i wanted
end sub

How do i do the same in vb.net???
Thanks, for help
best regars
Luis


Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Luis Ramos wrote:
Hello,
How do i change a label in another form from another one?
in vb6 i use to do this:

form1:
private sub label1_change()
form2.label1.caption="hgghjghjg"
' and the label in form2 is changed by the value i wanted
end sub

How do i do the same in vb.net???
Thanks, for help
best regars
Luis


how is it setup? Is form2 a member of Form1? If so on form2 make a
Property to do it for you.

Form2:
public property SetLabel1 as String
get
return label1.text
end get
set (value as string)
label1.text = value
end set
end property
Nov 21 '05 #2

P: n/a

I just recently needed to do the something similar. I needed to update a
progress bar and a label on a form while the code was executing in a
function in a separate module. I may have not done it the correct way, but
it seems to work. I declared a Public variable for the label and the
progress bar.

in the module

Public objProgressBar as progressbar
Public objLabel as Label
on the form the progress bar and label or located I assigned each to the
Public Variables

objProgressBar = me.theProgressBar
objLabel = me.theLabel

that made the properties of the two available throughout the project

objLabel.text = "Whatever you wish, from where ever you wish"
Worked for me.
Thomas

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Nov 21 '05 #3

P: n/a
Luis,

It depends heavily what kind of form that you use in this situation.
MDI,
ShowDialog
or
Show.

Where it is with the ShowDialog the most easiest in a correct OOP way to do.

Therefore can you tell what is your reason for this.

Cor
Nov 21 '05 #4

P: n/a
I just recently needed to do the something similar. I needed to update a
progress bar and a label on a form while the code was executing in a
function in a separate module. I may have not done it the correct way, but
it seems to work. I declared a Public variable for the label and the
progress bar.

in the module

Public objProgressBar as progressbar
Public objLabel as Label
on the form the progress bar and label or located I assigned each to the
Public Variables

objProgressBar = me.theProgressBar
objLabel = me.theLabel

that made the properties of the two available throughout the project

objLabel.text = "Whatever you wish, from where ever you wish"
Worked for me.
Thomas

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Nov 21 '05 #5

P: n/a
I just recently needed to do the something similar. I needed to update a
progress bar and a label on a form while the code was executing in a
function in a separate module. I may have not done it the correct way, but
it seems to work. I declared a Public variable for the label and the
progress bar.

in the module

Public objProgressBar as progressbar
Public objLabel as Label
on the form the progress bar and label or located I assigned each to the
Public Variables

objProgressBar = me.theProgressBar
objLabel = me.theLabel

that made the properties of the two available throughout the project

objLabel.text = "Whatever you wish, from where ever you wish"
Worked for me.
Thomas

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.