[RESOLVED] global Function Generate Erroe
It s global method
We pass Form object in this function when we compile Programmer system generate error message
'System.Windows.Forms.Form' does not contain a definition for 'SaveValues'
SaveValues() and ClearValues exist in all forms we want we just pass Form Object in Function
private void button1_Click(object sender, System.EventArgs e)
{
Form1 f1 = new Form1();
DentMode(f1);
}
public string DentMode(System.Windows.Forms.Form frmName)
{
frmName.SaveValues();
SecondName.ClearValues();
}
Re: global Function Generate Erroe
SaveValues may exist in all the forms you create but is does not exist in the standard .NET Windows.Form which is what you are passing as an argument in your DentMode method.
What you need to do is create your own form (eg myForm) which inherits the standard form add your SaveValues method to it.
Then declare all forms as myForm and then
DentMode(myForm frmName)
instead of
DentMode(Form frmName)
Edit:
or
public string DentMode(System.Windows.Forms.Form frmName)
to
public string DentMode(Form1 frmName)
Re: global Function Generate Erroe
Savevalues,EditValues,DeleteValues function exist in all standard .NET Windows.Form
DentMode function exist in Standard Module /Global Class/General Class
frmName is Form type Parameter
public string DentMode(System.Windows.Forms.Form frmName,Mode)
if (Mode == "A")
{
frmName.SaveValues();
}
else if (Mode =="E")
{
frmName.EditValues();
}
else if (Mode =="D")
{
frmName.DeleteValues();
}
required is:
when User enter Standard Windows Form object and Mode in DentMode Function Parameter system check if mode = "A" then execute Passing form SaveValues Function
Re: global Function Generate Erroe
Quote:
Originally Posted by Waseemalisyed
Savevalues,EditValues,DeleteValues function exist in all standard .NET Windows.Form
No they don't.
Form Browser Show me where they exist.
Do you know the difference between:
Form1 frmName;
and
Form frmName;