Click here to Skip to main content
15,896,557 members
Home / Discussions / C#
   

C#

 
GeneralRe: Enhancing UI layout using TableLayoutPanel Programmatically? Pin
Member 232448316-Oct-08 11:35
Member 232448316-Oct-08 11:35 
GeneralRe: Enhancing UI layout using TableLayoutPanel Programmatically? Pin
Dave Kreskowiak16-Oct-08 12:04
mveDave Kreskowiak16-Oct-08 12:04 
GeneralRe: Enhancing UI layout using TableLayoutPanel Programmatically? Pin
Member 232448317-Oct-08 9:29
Member 232448317-Oct-08 9:29 
GeneralRe: Enhancing UI layout using TableLayoutPanel Programmatically? Pin
Dave Kreskowiak17-Oct-08 12:49
mveDave Kreskowiak17-Oct-08 12:49 
QuestionReference Question Pin
SRogers8816-Oct-08 7:49
SRogers8816-Oct-08 7:49 
AnswerRe: Reference Question Pin
Dave Kreskowiak16-Oct-08 10:42
mveDave Kreskowiak16-Oct-08 10:42 
GeneralRe: Reference Question Pin
SRogers8816-Oct-08 10:53
SRogers8816-Oct-08 10:53 
GeneralRe: Reference Question Pin
Dave Kreskowiak16-Oct-08 11:58
mveDave Kreskowiak16-Oct-08 11:58 
GeneralRe: Reference Question Pin
SRogers8816-Oct-08 12:14
SRogers8816-Oct-08 12:14 
GeneralRe: Reference Question Pin
Dave Kreskowiak16-Oct-08 13:57
mveDave Kreskowiak16-Oct-08 13:57 
Questionsafe management of unmanaged resources in C# Pin
arcabid16-Oct-08 7:43
arcabid16-Oct-08 7:43 
AnswerRe: safe management of unmanaged resources in C# Pin
Dave Kreskowiak16-Oct-08 10:09
mveDave Kreskowiak16-Oct-08 10:09 
QuestionSerialPort auto find? Pin
Dirso16-Oct-08 6:30
Dirso16-Oct-08 6:30 
AnswerRe: SerialPort auto find? Pin
Dan Neely16-Oct-08 6:44
Dan Neely16-Oct-08 6:44 
Question[Message Deleted] Pin
Hesham Yassin16-Oct-08 6:16
Hesham Yassin16-Oct-08 6:16 
AnswerRe: how to get a variable content from html body using C#? Pin
Vimalsoft(Pty) Ltd16-Oct-08 6:58
professionalVimalsoft(Pty) Ltd16-Oct-08 6:58 
AnswerRe: how to get a variable content from html body using C#? Pin
Paul Conrad16-Oct-08 7:44
professionalPaul Conrad16-Oct-08 7:44 
GeneralMessage Closed Pin
16-Oct-08 7:48
Hesham Yassin16-Oct-08 7:48 
GeneralRe: how to get a variable content from html body using C#? Pin
Paul Conrad16-Oct-08 7:49
professionalPaul Conrad16-Oct-08 7:49 
QuestionUpdating StatusStrip text from class Pin
Brad Wick16-Oct-08 5:47
Brad Wick16-Oct-08 5:47 
AnswerRe: Updating StatusStrip text from class Pin
Simon P Stevens16-Oct-08 6:02
Simon P Stevens16-Oct-08 6:02 
GeneralRe: Updating StatusStrip text from class Pin
Brad Wick16-Oct-08 6:36
Brad Wick16-Oct-08 6:36 
AnswerRe: Updating StatusStrip text from class Pin
Dirso16-Oct-08 6:55
Dirso16-Oct-08 6:55 
GeneralRe: Updating StatusStrip text from class Pin
DaveyM6916-Oct-08 7:07
professionalDaveyM6916-Oct-08 7:07 
AnswerRe: Updating StatusStrip text from class [modified] Pin
DaveyM6916-Oct-08 7:01
professionalDaveyM6916-Oct-08 7:01 
This is a perfect situation for using your own custom event. Something like this:

Create a delegate and event
public delegate void ConnectionChangedEventHandler(object sender, ConnectionEventArgs e);
public event ConnectionChangedEventHandler ConnectionChanged;

and a ConnectionEventArgs class
public class ConnectionEventArgs
{
    public ConnectionEventArgs(bool isConnected)
    {
        m_IsConnected = isConnected;
    }
    private bool m_IsConnected;
    public bool IsConnected
    {
        get { return m_IsConnected; }
    }
}

then make the InternetConnection call a method
private void InternetConnectionAvailable()
{
    OnConnectionChanged(new ConnectionEventArgs(true));
}
protected virtual void OnConnectionChanged(ConnectionEventArgs e)
{
    if (ConnectionChanged != null)
    ConnectionChanged(this, e);
}

Now you can subscribe to the ConnectionChanged event and update the StatusStrip
MyClassInstance.ConnectionChanged += new MyClass.ConnectionChangedEventHandler(MyClassInstance_ConnectionChanged);
void MyClassInstance_ConnectionChanged(object sender, ConnectionEventArgs e)
{
    // Set status strip
}


[edit] This is (obviously) also reusable for when it's not available too
private void InternetConnectionUnavailable()
{
    OnConnectionChanged(new ConnectionEventArgs(false));
}


Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)

modified on Thursday, October 16, 2008 1:07 PM

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.