How to update StatusStrip from class to form?

165 views
Skip to first unread message

musa.biralo

unread,
Dec 20, 2008, 11:30:15 AM12/20/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Hello:

Please forgive my question. I have interest to learn but not the
knowledge to solve. Hope to get help..

I have a Form1 with StatusStrip and a Class1 class-file in a project.
I want to pass a string message from my Class1 to my Form1. Please
help me. I am trying in VB.NET

If you could direct me to similar example that will work too.

Many thanks.
musa biralo

ARUN KUMAR

unread,
Dec 20, 2008, 10:32:48 PM12/20/08
to DotNetDe...@googlegroups.com

Hello Musa,

Many ways available to pass string to form1 from calss1 but now I am tell one simple way to pass string to form1

Assume your status strip contain Label

Public Class Class1

     Sub New()

        'you can directly access the label *see below   

        Form1.ToolStripStatusLabel1.Text = "This message from class1"

    End Sub

 End Class


Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim s As Class1 = New Class1

 End Sub

End Class

When user click the button then appered that message in status label

*Note : That faclity avliable when Modifiers for Status label is Public or Friend


2008/12/20 musa.biralo <musa....@gmail.com>



--
Regards
*******************
*C.Arun Kumar *
*******************


musa.biralo

unread,
Dec 21, 2008, 3:25:22 PM12/21/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Hi Arun,
Thanks for the reply and explain things.

With your help I was able to get things but what i noticed that the
StatusLabel is not updating. I have several status notice at several
steps of the code in class (Not form) and none of them are updating.

I was able to get status update in simple example.

Your help or any direction to the web will be highly appreciated.

Thanks again Arun.


On Dec 20, 10:32 pm, "ARUN KUMAR" <carunkumar1...@gmail.com> wrote:
> Hello Musa,
>
> Many ways available to pass string to form1 from calss1 but now I am tell
> one simple way to pass string to form1
>
> Assume your status strip contain Label
>
> Public Class Class1
>
> Sub New()
>
> 'you can directly access the label *see below
>
> Form1.ToolStripStatusLabel1.Text = "This message from class1"
>
> End Sub
>
> End Class
>
> Public Class Form1
>
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
> AsSystem.EventArgs)
> Handles Button1.Click
>
> Dim s As Class1 = New Class1
>
> End Sub
>
> End Class
>
> When user click the button then appered that message in status label
>
> *Note : That faclity avliable when Modifiers for Status label is Public or
> Friend
>
> 2008/12/20 musa.biralo <musa.bir...@gmail.com>

kanmani24

unread,
Dec 24, 2008, 11:12:14 PM12/24/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
I don't how Arun's solution worked. It was not working for me. What I
did was like below.

Public Class Form1

'' Windows Form Designer generated code is hidden

Private WithEvents c1 As class1

Private Sub UpdateStatusStrip(ByVal msg As String) Handles
c1.UpdateStatus
Label1.Text = msg
End Sub

End Class

Public Class class1
Public Sub New()

End Sub

Public Event UpdateStatus(ByVal msg As String)

Private Sub DoSomething()

' Where ever I need to send an update to UI
Call UpdateStatus("Show my message")

End Sub

End Class
Reply all
Reply to author
Forward
0 new messages