Hi,
I create form and from few mwnu option create instance of it with diferent nama of instance. It is a data input form and I use it for input data in 5 tables with diferent column names, so I have to know the name of instance. Menu option coud open only one instance in a time. need help, I'm very new in C#.
All the best from Croatia....


VulpesRank #55 · 29.2K reputationPosted Jun 9, 2014, 7:59 AM EDT
VulpesRank #55 · 29.2K reputationPosted Jun 9, 2014, 7:02 AM EDT
So it sounds like your database code will need a switch statement with cases for each possible name to determine which table/columns are relevant for that particular instance.
As you create each instance, you can of course set its Name property which will overwrite the one set in the Properties Box.
However, rather than using Name, you might like to consider using the Tag property instead as that's not normally used for any other purpose.
GoGi FeboRank #4,008 · 372 reputationPosted Jun 9, 2014, 7:20 AM EDT
this.name return name of form....
********** code *********
frmVrPredmeta fVP;
private void mnuVrPred_Click(object sender, EventArgs e)
{
if(fVP == null)
{
fVP = new frmVrPredmeta();
fVP.MdiParent = this;
fVP.FormClosed += new FormClosedEventHandler(fVP_FormClosed);
fVP.Show();
!! THIS is what I want to know !! Name of instance !!
In this case the name of instance is -> fVP <-
and I want to read this FROM instance, after fVP.Show()
}
else
{
fVP.Activate();
}
}
void fVP_FormClosed(object sender, EventArgs e)
{
fVP = null;
}
GoGi FeboRank #4,008 · 372 reputationPosted Jun 9, 2014, 11:12 AM EDT
I'm very very new in C#, but this how you easy and elegant solve this "problem" is fantastic. Oooohohoho, meny C# "guru" broken teeth on this.... and they stil don't know how to solve this......
Hahahahahahaha, I'll send you chocolate.... :), Thx again