Hi,
I am new here. I am wondering how I can set forcus to a tab page in main form from a subform?
Tab Focus help...
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Kirtan PatelRank #292 · 8.6K reputationPosted Jun 1, 2009, 8:19 PM EDT
So
Add
public partial class Form2 : Form { public Form1 f1=null; //Overloaded Constructor public Form2(Form1 f) { f1 = f; InitializeComponent(); } public Form2() { InitializeComponent(); } //Change the Active tab private void button1_Click(object sender, EventArgs e) { f1.tabControl1.SelectedIndex = 2; }to Open SubForm From MainForm Use this
private void btnOpenForm2_Click(object sender, EventArgs e) { Form2 f2 = new Form2(this); f2.Show(); }