J
Jeff
..NET 2.0
I've created a window consisting of a treeview control and a tabcontrol.
When a leave in the treeview is clicked then the code should check if the
specific tabpage already exists in the tabcontrol and give it focus if it
exists. Or else if it doesn't exists then add the tagpage to the tabcontrol.
Below is the code which checks if a tabpage already exists and if it does
then give it focus... If you have a suggestion on improving the code below
or other suggestions (maybe .NET has some built in features which can handle
this??) then please share them with me
private bool GetTab(string tab)
{
bool value = false;
int index = 0;
foreach (TabPage c in tabMain.Controls )
{
if (c.Text == tab)
{
value = true;
tabMain.SelectedIndex = index;
}
index++;
}
return value;
}
any suggetions?
I've created a window consisting of a treeview control and a tabcontrol.
When a leave in the treeview is clicked then the code should check if the
specific tabpage already exists in the tabcontrol and give it focus if it
exists. Or else if it doesn't exists then add the tagpage to the tabcontrol.
Below is the code which checks if a tabpage already exists and if it does
then give it focus... If you have a suggestion on improving the code below
or other suggestions (maybe .NET has some built in features which can handle
this??) then please share them with me
private bool GetTab(string tab)
{
bool value = false;
int index = 0;
foreach (TabPage c in tabMain.Controls )
{
if (c.Text == tab)
{
value = true;
tabMain.SelectedIndex = index;
}
index++;
}
return value;
}
any suggetions?