i have a windows form named "customer.cs" in which i have a textbox named "phonetxt", i have a class in model named myclass.cs ,i have some lines of code in "customer.cs",
private void customerphone_Leave(object sender, EventArgs e)
{
if (customerphone.Text != "Enter Phone Number" && customerphone.Text == "")
{
this.customerphone.Text = "Enter Phone Number";
this.customerphone.ForeColor = Color.DarkGray;
errorcustomerphone.Icon = Properties.Resources.err;
errorcustomerphone.SetError(customerphone, "Enter Phone Number");
}
else
{
errorcustomerphone.Icon = Properties.Resources.ok;
errorcustomerphone.SetError(customerphone, "Enter Phone Number");
}
}
i want a method that will call in customer.cs
methodfortext("customerphone","errorcustomerphone","Enter PhoneNumber");
//that will send these parameters to myclass.cs
methodfortext(string controlname, string errorname , string name)
{
//i want
controlname.Text = name;
errorname.Icon = Properties.Resources.err;
}
someone help me please,i'm new in c#.hope u people got what i want.