473,947 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing Label text property on another form, post #2

Thanks for the quick responses. I'm having trouble understanding. I've
included the code I using. perhaps someone can tell me what I'm doing wrong.
My original question was,

I'm new to VB.Net and programming. I just bought 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 FileSystemWatch er. 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
property on form two (SettingsForm) from the Event Handler. Can someone
please help me? Thanks in advance.
Maybe some more info would help. Both forms are separate. I didn't create
one from the other. I think that's what someone was asking.

The following code is on the first form, called Form1

Public Sub FileSystemWatch er1_Created(ByV al sender As System.Object, ByVal e
As System.IO.FileS ystemEventArgs) Handles FileSystemWatch er1.Created

Beep()

'Display SettingsForm dialog if it is not already displayed.

If mSettingsForm Is Nothing Then

mSettingsForm = New SettingsForm

mSettingsForm.S howDialog()

Else

If mSettingsForm.V isible = False Then

mSettingsForm.V isible = True

End If

mSettingsForm.A ctivate()

End If

'Update label on Settings Form.

mSettingsForm.U pDateLabel("Thi s is a test")

End Sub

The code below is on the second form called SettingsForm.

Public Sub UpDateLabel(ByV al LabelText As String)

Label1.Text = LabelText

End Sub
Nov 20 '05 #1
3 1598
Hi Mike,

Can we chat via Messager...? If you have no objections, use my e-mail
address (remove online). I would like to compare notes with you, if you
don't mind, Messager is quicker than NG....

You may want to read the following MSDN article.
http://msdn.microsoft.com/library/de...adingToNET.asp

Thanks.
"Mike Johnson" <jo*****@bellso uth.net> wrote in message
news:OJ******** ******@TK2MSFTN GP09.phx.gbl...
Thanks for the quick responses. I'm having trouble understanding. I've
included the code I using. perhaps someone can tell me what I'm doing wrong. My original question was,

I'm new to VB.Net and programming. I just bought 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 FileSystemWatch er. 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 property on form two (SettingsForm) from the Event Handler. Can someone
please help me? Thanks in advance.
Maybe some more info would help. Both forms are separate. I didn't create
one from the other. I think that's what someone was asking.

The following code is on the first form, called Form1

Public Sub FileSystemWatch er1_Created(ByV al sender As System.Object, ByVal e As System.IO.FileS ystemEventArgs) Handles FileSystemWatch er1.Created

Beep()

'Display SettingsForm dialog if it is not already displayed.

If mSettingsForm Is Nothing Then

mSettingsForm = New SettingsForm

mSettingsForm.S howDialog()

Else

If mSettingsForm.V isible = False Then

mSettingsForm.V isible = True

End If

mSettingsForm.A ctivate()

End If

'Update label on Settings Form.

mSettingsForm.U pDateLabel("Thi s is a test")

End Sub

The code below is on the second form called SettingsForm.

Public Sub UpDateLabel(ByV al LabelText As String)

Label1.Text = LabelText

End Sub

Nov 20 '05 #2
Hi Mike,

You use the structure of a normal show while doing a showdialog

The most easy way for a showdialog is in Form1

dim frm2 as new form2
frm2.Labeltext = whatever String in form1
frm2.showdialog (me)
frm2.dispose

Labeltext is a public string which you mostly set under the form designer
code as
Public Labeltext as String

That

Label1.text = Labeltext stays

I hope that helps?

Cor
Nov 20 '05 #3
* "Mike Johnson" <jo*****@bellso uth.net> scripsit:
Thanks for the quick responses. I'm having trouble understanding. I've
included the code I using. perhaps someone can tell me what I'm doing wrong.
My original question was,


Why not stay in the original thread?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4

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

Similar topics

4
2459
by: Tony W | last post by:
Hi, I am trying to write a simple application to retrieve data from the Windows registry and insert it into textboxs on a windows form. So far I have one namespace containing two classess. The first class handles the form generation - (this was done using GUI form designer).
5
10552
by: Sambo | last post by:
I have two forms, frmMain and frmSettings. I have a label in frmMain that i would like to change from frmSettings. So when the user clicks the command button in frmSettings then a value from a string is used to change the text in the label control on the frmMain form. Any help would be appreciated, thanks!
1
3364
by: Henke | last post by:
Hello, I have one ImageButton controls which I initialize in Page_Load and declare on class level. ImageButton save = new ImageButton(); save.ImageUrl = "save.gif" save.Click += new ImageClickEventHandler(this.save_click); This ImageButton is added to a dynamic table which is also
1
9258
by: nospamjac | last post by:
Hi, Is there a way to update the text of an asp:label on a webform without refreshing the entire page? What is called by button clicks and other events that refresh a webform control? See the example WebForm1.aspx and WebForm1.aspx.cs code below: WebForm1.aspx =======================================================
3
2712
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...
7
2991
by: Sakharam Phapale | last post by:
Hi All, How to preserve the old font properties while changing new one? I posted same question 2 months back, but I had very small time then. eg. "Shopping for" is a text in RichTextBox and already formatted as "Shopping" ---Bold "for" -----Regular Now I want to underline whole text by preserving old style i.e. Bold and
6
6885
by: AMP | last post by:
Hello, I have an mdi program with a child form ("A") and another child ("B"). I want to change the text of a label on A by changing an item from a combobox on B. I can code the comboBox1_SelectedIndexChanged that is on B but I dont know how to send that info to the label on A.I cant seem to access A from B. Help Thanks Mike
5
3801
by: g6023 | last post by:
Hi All Newbie to C# I am afraid The array of panel dispays OK but I am having problems with accessing the controls within. My panels each have a number of label controls. How do I set, say, the Name.Text property in List<Panel> ListPanelArray
0
9983
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
11348
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10693
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
9889
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
8256
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
7431
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
6332
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4539
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3543
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.