Apologies if there are already answers out there for this, but I've dug a lot and found little.

I'm trying to implement a watchdog system on a C# .NET 4.5 Windows Forms Application. Basically, I have a form with various buttons, text displays, etc, that connects to an external device. I have a timer on the main form that should check the device for changes every 250ms or so.

I've lumped all MainPage form code, including the timer, into one class, and the code for the external device into its own class that inherits from MainPage. Trouble is, I want to be able to have the timer's Tick() function call a method from the Device class. Here's simplified code:

```
namespace MyApplication
{
    public partial class MainPage : Form
    {
        public MainPage()
        {
            InitializeComponent();
        }

        public static void SetTextBox(string Message)
        {
            Textbox_Status.Text = Message;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            Device.DeviceCheck();
        }
    }

    public class Device : MainPage
    {
        public void DeviceCheck()
        { 
            //Do other stuff here
            SetTextBox("Some text");
        }
    }
}

```

Naturally, I can't call `Device.DeviceCheck` from within the timer because it's not static. However, if I declare DeviceCheck static, I now get an error that `Textbox_Status` is not static. If I try to declare it static, Visual Studio gets VERY mad at me!

Originally, I had dumped everything into the same class and it all worked fine, but that is very ugly code. Is there a better way?

EDIT: The extra snag = more than one thing in the form that needs to be changed by DeviceCheck()

So what I left out of the simplified code: in addition to the SetTextBox() method, I also have a method in the form that sets some indicators, based on information from DeviceCheck:

```
    public void SetImages(string Image)
    {
        switch(Image)
        {
            case "Green":
                Image_BlackDim.Visible = true;
                Image_RedDim.Visible = true;
                Image_GreenDim.Visible = false;
                break;
            case "Red":
                Image_BlackDataKeyDim.Visible = true;
                Image_RedDataKeyDim.Visible = false;
                Image_GreenDataKeyDim.Visible = true;
                break;
            case "Black":
                Image_BlackDim.Visible = false;
                Image_RedDim.Visible = true;
                Image_GreenDim.Visible = true;
                break;
            case "None":
            default:
                Image_BlackDim.Visible = true;
                Image_RedDim.Visible = true;
                Image_GreenDim.Visible = true;
                break;
        }
    }

```

Naturally all my indicators are also put in place when I construct the form, so they can't be static either. So having `DeviceCheck` return the string message to be displayed works, but I can't really have it ALSO return the string that `SetImages()` uses. 

Well... I could, by returning a struct with multiple strings, but is there a better way?

**EDIT:** Here's my working solution, based on Eric's advice:

I start out with a struct for the status elements:

```
public struct Dev_status
    {
        public string Indicator1;
        public string Indicator2;
        public DK_status(string indicator1, string indicator1)
        {
            this.Indicator1 = indicator1;
            this.Indicator2 = indicator2;
        }
    }

    public static Dev_status status = new Dev_status(Device.Messages.thing1_offline,Device.Messages.thing2_offline);

```

The indicators now grab the messages from `status`:

```
    public void SetStatusBoxes()
    {
        Textbox_thing1_Status.Text = status.Indicator1;
        Textbox_thing2_Status.Text = status.Indicator2;
    }

    public void SetImages()
    {
        string IndicatorColor = "None";
        if (status.Indicator2 == Device.Messages.GreenThing) IndicatorColor = "Green";
        else if (status.Indicator2 == Device.Messages.RedThing) IndicatorColor = "Red";
        else if (status.Indicator2 == Device.Messages.BlackThing) IndicatorColor = "Black";

        switch(IndicatorColor)
        {
            case "Green":
                Image_BlackDim.Visible = true;
                Image_RedDim.Visible = true;
                Image_GreenDim.Visible = false;
                break;
            case "Red":
                Image_BlackDim.Visible = true;
                Image_RedDim.Visible = false;
                Image_GreenDim.Visible = true;
                break;
            case "Black":
                Image_BlackDim.Visible = false;
                Image_RedDim.Visible = true;
                Image_GreenDim.Visible = true;
                break;
            case "None":
            default:
                Image_BlackDim.Visible = true;
                Image_RedDim.Visible = true;
                Image_GreenDim.Visible = true;
                break;
        }
    }

```

And the timer just calls the `DeviceCheck` method and sets the indicators:

```
    private void timer1_Tick(object sender, EventArgs e)
    {
        status = Device.DeviceCheck();
        SetStatusBoxes();
        SetImages();
    }

```

Finally, `DeviceCheck` sets values for the status struct which is public, static, and inherited by the `Device` class:

```
    public static void DeviceCheck()
    {
        //Code that checks the device status
        status.Indicator1 = CheckDeviceConnected();
        status.Indicator2 = CheckDeviceType();
    }

```

This works pretty seamlessly. In the end I didn't need to return values from `DeviceCheck` after all. I'll still mark that idea as accepted though, since it led me in the right direction.