M
Mike Johnson
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
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