PC Review


Reply
Thread Tools Rate Thread

Changing Label text property on another form, post #2

 
 
Mike Johnson
Guest
Posts: n/a
 
      17th May 2004
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 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
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 FileSystemWatcher1_Created(ByVal sender As System.Object, ByVal e
As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Created

Beep()

'Display SettingsForm dialog if it is not already displayed.

If mSettingsForm Is Nothing Then

mSettingsForm = New SettingsForm

mSettingsForm.ShowDialog()

Else

If mSettingsForm.Visible = False Then

mSettingsForm.Visible = True

End If

mSettingsForm.Activate()

End If

'Update label on Settings Form.

mSettingsForm.UpDateLabel("This is a test")

End Sub

The code below is on the second form called SettingsForm.

Public Sub UpDateLabel(ByVal LabelText As String)

Label1.Text = LabelText

End Sub


 
Reply With Quote
 
 
 
 
Wayne Taylor
Guest
Posts: n/a
 
      17th May 2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 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
> 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 FileSystemWatcher1_Created(ByVal sender As System.Object, ByVal

e
> As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Created
>
> Beep()
>
> 'Display SettingsForm dialog if it is not already displayed.
>
> If mSettingsForm Is Nothing Then
>
> mSettingsForm = New SettingsForm
>
> mSettingsForm.ShowDialog()
>
> Else
>
> If mSettingsForm.Visible = False Then
>
> mSettingsForm.Visible = True
>
> End If
>
> mSettingsForm.Activate()
>
> End If
>
> 'Update label on Settings Form.
>
> mSettingsForm.UpDateLabel("This is a test")
>
> End Sub
>
> The code below is on the second form called SettingsForm.
>
> Public Sub UpDateLabel(ByVal LabelText As String)
>
> Label1.Text = LabelText
>
> End Sub
>
>



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      17th May 2004
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


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      17th May 2004
* "Mike Johnson" <(E-Mail Removed)> 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/>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing BackColor Property of Main Form Label from SubForm Access User Microsoft Access Forms 10 21st Apr 2008 08:36 PM
Changing Label text property on another form Mike Johnson Microsoft VB .NET 3 17th May 2004 03:29 PM
Changing Text property on label from dynamic imagebutton Henke Microsoft ASP .NET 1 5th May 2004 04:48 PM
Changing text box property from another form =?Utf-8?B?c2hhbA==?= Microsoft VB .NET 2 3rd Mar 2004 11:35 AM
ccsclass property for text label on web form within VS.NET 2003 FrodoBaggins Microsoft Dot NET 2 23rd Feb 2004 11:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:56 PM.