I have a Windows Form1 with label and i want to update the Form label text from the class file.
I can able to get the Form1 controls from the class file but it is not updating the value in the Form.
VB.net
Below is the Form1:
Below is my Class:
After the execution of code also it is not updating the label text to "Updation from Class1".
Any help is appreciated.
Regards,
Suresh
I can able to get the Form1 controls from the class file but it is not updating the value in the Form.
VB.net
Below is the Form1:
VB.NET:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim obj As New Class1()
End Sub
End Class
Below is my Class:
VB.NET:
Public Class Class1
Public Sub New()
Dim frm As New Form1
My.Application.DoEvents()
frm.Refresh()
frm.Label1.Refresh()
frm.Label1.Text = "Updation from Class1"
frm.Label1.Refresh()
frm.Refresh()
My.Application.DoEvents()
End Sub
End Class
After the execution of code also it is not updating the label text to "Updation from Class1".
Any help is appreciated.
Regards,
Suresh