Hello all,
I'm new here and this would be my first post! I'm quite the beginner at C# programming, so I'm sorry if this is a no-brainer. Also I searched and couldn't find any relavent material, if a post exists that solves this problem, feel free to direct me there and close this thread.
I'm making a grading program that takes X number of scores, averages them, then finds the equivilent letter grade. I have everythingworking except the empty text box checker. I use a seperate class for the bulk of my error checking (entitled Class1.cs). In said class I have a method that checks the Form1 textboxes for empty values. So far I've tried:
CODE
public void emptyTextMethod()
{
if (Form1.txtName.Text==String.Empty)
{
MessageBox.Show("Please enter a name.");
}//end if
}//end method
Thats really the only way I know how to call it. However, when I attempt that code, it states "that an object is required for the nonstatic field, method, or property." I'm not sure what this error is and have searched google for an answer, but found nothing that applies to the code I'm working on.
I've also tried declaring Form1 in Class1 and calling the Textbox by name, ie:
CODE
Form1 Form1Object=new Form1();
....
if (Form1Object.txtName.Text==String.Empty)
{
MessageBox.Show("Please enter a name.");
}//end if
However I get a Stack Overflow Exception and don't know how to solve it. Any tips would be greatly appreciated!
~Vaune