Hi. I got 2 things in my project. A form class, and a separate class. I wanna be able to change the data of the form using this separate class or any other class for that matter. For example, I'm trying to change the backcolor of a picturebox using this separate class. However during design time, I'm getting a "Use of unassigned local variable error MyForm." Here is what I have in my class module:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
namespace AStar_Pathfinding
{
class modMain
{
public bool Running = false;
public bool Done = false;
public void Main()
{
frmMain MyForm;
MyForm.picMain.BackColor = Color.FromArgb(0, 0, 0);
}
}
}
In bold is my error. As for the form itself, I have made all my object modifiers public just so they are accessible. The form itself is just this:
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AStar_Pathfinding
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
private void frmMain_Load(object sender, EventArgs e)
{
}
}
}
I haven't called the Main() just yet though until I get pass this issue. Thanks in advance.