Click here to Skip to main content
15,561,125 members
Home / Discussions / C#
   

C#

 
GeneralRe: Open Form Incide another Form Pin
Henry Minute1-Mar-09 8:30
Henry Minute1-Mar-09 8:30 
AnswerRe: Open Form Incide another Form Pin
Peter_Weber1-Mar-09 3:37
Peter_Weber1-Mar-09 3:37 
GeneralRe: Open Form Incide another Form Pin
CristianConrads1-Mar-09 4:00
CristianConrads1-Mar-09 4:00 
GeneralRe: Open Form Incide another Form Pin
Peter_Weber1-Mar-09 4:15
Peter_Weber1-Mar-09 4:15 
AnswerRe: Open Form Incide another Form Pin
Eddy Vluggen1-Mar-09 7:39
professionalEddy Vluggen1-Mar-09 7:39 
AnswerRe: Open Form Incide another Form [modified] Pin
0x3c01-Mar-09 8:06
0x3c01-Mar-09 8:06 
AnswerRe: Open Form Incide another Form Pin
Luis Alonso Ramos1-Mar-09 13:59
Luis Alonso Ramos1-Mar-09 13:59 
AnswerSolution [modified] Pin
CristianConrads2-Mar-09 13:59
CristianConrads2-Mar-09 13:59 
Hi evirione
For any one interest in this
Here I publish my solution
Object in Form1
splitContainer1
tabControl1 (in the right panel of the splitContainer1)
The tabControl does not have any page on design.
The left panel I intent to put a treeView, but for this code, there is a button
button1 (in the left panel of the splitContainer1)

this is the code for the button click event
private void button1_Click(object sender, EventArgs e)
{
   TabPage newTabPage = new TabPage("Form " + tabControl1.TabPages.Count);
   newTabPage.Size = new Size(tabControl1.Width, tabControl1.Height);
   Form2 newForm = new Form2();
   newForm.TopLevel = false;
   newForm.Parent = this;
   newForm.Visible = true;
   newForm.Location = newTabPage.Location;
   newForm.Location = new Point(3, 3);
   newForm.Size = new Size(newTabPage.Width - 3, newTabPage.Height - 3);
   newForm.FormBorderStyle = FormBorderStyle.None;
   newTabPage.Controls.Add(newForm);
   tabControl1.TabPages.Add(newTabPage);
}

Becaus Microsoft does not provide the Tab control we all use in the IDE, that allow to close a tabpage with an X in the upper right corner, I have no alternative and just use a normal tabControl
Now, in order to destroy the tabpage when closing the form created on each page.
In Form2 I add a button, and the followin code.( this close the form and destroy the tab page.
private void button1_Click(object sender, EventArgs e)
{
   TabPage tab = this.Parent as TabPage;
   TabControl tabControl = tab.Parent as TabControl;
   tabControl.TabPages.Remove(tab);
   this.Dispose();
}


Hope this help
Cristian Conrads

modified on Monday, March 2, 2009 7:05 PM

QuestionDesktop Calender Repost Pin
WinSolution1-Mar-09 0:22
WinSolution1-Mar-09 0:22 
AnswerRe: Desktop Calender Repost Pin
0x3c01-Mar-09 0:30
0x3c01-Mar-09 0:30 
GeneralRe: Desktop Calender Repost Pin
WinSolution1-Mar-09 1:04
WinSolution1-Mar-09 1:04 
GeneralRe: Desktop Calender Repost Pin
0x3c01-Mar-09 1:22
0x3c01-Mar-09 1:22 
GeneralRe: Desktop Calender Repost Pin
WinSolution1-Mar-09 3:32
WinSolution1-Mar-09 3:32 
GeneralRe: Desktop Calender Repost Pin
0x3c01-Mar-09 7:27
0x3c01-Mar-09 7:27 
AnswerRe: Desktop Calender Repost Pin
AKNR Chandra Sekhar19-Mar-09 9:47
AKNR Chandra Sekhar19-Mar-09 9:47 
QuestionSaving User and Application Settings in WinForms Pin
Sokka9328-Feb-09 22:29
Sokka9328-Feb-09 22:29 
AnswerRe: Saving User and Application Settings in WinForms Pin
ABitSmart1-Mar-09 1:30
ABitSmart1-Mar-09 1:30 
GeneralRe: Saving User and Application Settings in WinForms Pin
Sokka931-Mar-09 1:54
Sokka931-Mar-09 1:54 
AnswerRe: Saving User and Application Settings in WinForms Pin
Henry Minute1-Mar-09 2:23
Henry Minute1-Mar-09 2:23 
QuestionFile Not Found Exception Handling Pin
Lim Yuxuan28-Feb-09 22:29
Lim Yuxuan28-Feb-09 22:29 
AnswerRe: File Not Found Exception Handling Pin
0x3c01-Mar-09 0:16
0x3c01-Mar-09 0:16 
GeneralRe: File Not Found Exception Handling Pin
Lim Yuxuan1-Mar-09 2:27
Lim Yuxuan1-Mar-09 2:27 
Questionbuilding network in form of a graph Pin
sunnyk8628-Feb-09 21:52
sunnyk8628-Feb-09 21:52 
AnswerRe: building network in form of a graph Pin
Yusuf28-Feb-09 22:16
Yusuf28-Feb-09 22:16 
AnswerRe: building network in form of a graph Pin
Eytukan1-Mar-09 3:41
Eytukan1-Mar-09 3:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.