I m trying to make a method and call it everytime I want my textboxes to go blank in my form.
The code I ve tried is listed below
In the main(form) code:
_BlankSpaces.NineBlankTextboxes( ref txtSup.Text, ref txtSupName.Text, ref txtSupCode.Text, ref txtZenonName.Text, ref txtZenonCode.Text, ref txtInAmount.Text, ref Combo_Mech_El.Text, ref txtDescr.Text, ref txtID.Text);
/* Instead of:
txtSup.Text = "";
txtSupName.Text = "";
txtSupCode.Text = "";
txtZenonName.Text = "";
txtZenonCode.Text = "";
txtInAmount.Text = "";
Combo_Mech_El.Text = "";
txtDescr.Text = "";
txtID.Text = ""; */
//And In the Class I call:
namespace WarehouseManagementToolv1.Secondary
{
public class BlankSpaces
{
//public string Blank1, Blank2, Blank3, Blank4, Blank5, Blank6, Blank7, Blank8, Blank9;
public void NineBlankTextboxes(ref string blank1, ref string blank2, ref string blank3, ref string blank4,
ref string blank5, ref string blank6, ref string blank7, ref string blank8, ref string blank9)
{
blank1 = "";
blank2 = "";
blank3 = "";
blank4 = "";
blank5 = "";
blank6 = "";
blank7 = "";
blank8 = "";
blank9 = "";
}
}
}
When I run it the massage I get is:
A property or indexer may not be passed as an out or ref parameter
Property "Text" access returns temporary value. "ref" argument must be an assignable variable, field or an array element.