473,666 Members | 2,087 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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.ca ption="hgghjghj g"
' 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
5 12676
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.ca ption="hgghjghj g"
' 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

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.theProgressB ar
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.c om<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Nov 21 '05 #3
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
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.theProgressB ar
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.c om<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Nov 21 '05 #5
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.theProgressB ar
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.c om<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1896
by: iggie | last post by:
Hello, everyone. How can I display text from another form that currently has the focus. I'm doing a search in sql 2000, to dot it. I call a search form and query my criteria, when it founds the value a display this on a list view. Next, when the user selects the row, I want that to display the information on the main form.
3
7533
by: fh1996 | last post by:
Form.Owner and Form.Parent, what's the difference between them? Form.ShowDialog() and Form.Show(), when to use which? Form.Activated(), what does it mean when saying a Form is "activated"? Thanks!
3
2676
by: Mike Johnson | last post by:
I'm new to VB.Net and programming. I just brought VB.Net Standard I'm working on a small program for work. I've created two forms the first is named Forms1 and the second is named SettingsForm on forms1 I've placed two components a NotifyIcon and FileSystemWatcher. I created a event handler called onchanged which responds to file being created in a certain directory. Now my problem is I can't figure out how to change the label.text...
6
9156
by: Roger Ries via DotNetMonster.com | last post by:
I'm trying to change the text in a label from another form. lblInfo.Text = "ABC" Works for the form your currently in but how the heck do you change that label information from another form. Later --
4
1841
by: RSH | last post by:
I have a basic framework where I have a frmMain which is my main form that is opened when the application is run. Upon a button click I have a second from that is opened as such: Form FormB = new Form2(); FormB.Show(); That form has a label called "label1" which I would like to write to from frmMain. I tried the somewhat logical (but inncorrect) syntax:
1
1915
LacrosseB0ss
by: LacrosseB0ss | last post by:
Hey folks; I have 2 forms (form1 and form2). Form2 is a print view of Form1. The user fills out form1 (textboxes and such) and submits to Form2 for reviewing/printing before submitting to a database. I am trying to go the other way, from Form2 to Form1 for revising and such. However, all the objects on Form2 are labels and the contents of these are not passed. Can labels not be posted using form method=post ? I would try using javascript...
1
1616
by: aman909 | last post by:
Hello, I have a unbound text box on a form. This gives a total from a calculation. I would like this total from the unbound text box to appear on another form. I just need the total on the other form, not the calculation. How do i do this?
28
2887
Ericks
by: Ericks | last post by:
I want to highlight new data that has been entered in my database since a last meeting so it is easy to see in a subform’s table what info is new. In my database I have a table called CompoundsObservations and that contains a date field called DateOfInfoAdded. There is another table called LastMeetingDate with only one field, a date field called LastMeeting. This table only serves the purpose to register the last meeting's date and should be...
61
7053
by: groovygirl3003 | last post by:
The database is designed to record all Dvd's in my collection and monitor them when friends take them, kind of like a rental system. The tables/forms in question are DVD's (a table storing all information about the Dvd's) and rentals (the basic rental details, who, when etc) and rental details (the list of films) The DVD table/form has an availability check box (yes/no) to state whether the dvd is avialable or not. The Rentals form has...
0
8449
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8876
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8784
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8642
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7387
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4371
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.