Sign in to follow this  

Did anyone make dynamic tabs in C#?

This topic is 3860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, I have this question and some others that I have have been having touble with C#. So on topic. I did create a tabs system, but the problem was when I did create one. For some reason the syle changed on me and it hidden the richText box. Is their a way so it won't change style and hide the textbox or make a new one? For some reson this dialog I made in VC# 2005 won't let me change the cursur to "Defualt" when the user hase his mouse over the window. Is their a way to fix this? How do I have it so lets say the user wants to create a new script the welcome window would shut down, but then the Create script program pop ups and then it would do the same exept start up the main program with the info the user entered in the Create dialog in a text field and etc?

Share this post


Link to post
Share on other sites
Did you check your code for typos? That's what I'd do.

Q1: I can't understand what you're trying to do or what's happening from your description. It sounds like maybe the RichTextBox is a child of the TabControl but not on a TabPage, so it's not being drawn when you create a new TabPage. This has nothing to do with styles though so I have no idea what you mean by 'style'.

Q2: All Controls have a "Cursor" property that you can set to Cursors.Arrow (or Cursors.Default if you want to use the I-bar cursor for the RichTextBox).

Q3: I can't understand what you're trying to say.

Share this post


Link to post
Share on other sites
Could create a dynamic tab in my program. Screwed up on it then style changes on me when I do create a tab. The Richtext box goes away forever. How do I fix this so the style won't change and the richtextbox won't hide. Then maybe how do I kill a tab with the text box in it?

I know that, Its just that when I do try to change the cursor from "wait" to defualt it changes back in Visual Studio C#.

Start program. Window pops up with a nice Welcome Message and some options. When user clicks on a option like Create Script. Window will close and open a new window for the options on what you want to name your script and so forth. Then when user clicks ok. Close that window and open up the Scripter itself and create a tab with the settings for that script and whats in it. How do I do that?

Share this post


Link to post
Share on other sites
Q1: Can you post any code? I am interested to see where the RichTextBox is in your control hierarchy. If it's a child of the TabControl, then when you add a new TabPage dynamically, the TabPage panel counts as a child control of the TabControl, and since it was added last, it will draw over the top of the RichEditBox. Try this somewhere in your code:


TabPage tp1 = new TabPage();
tp1.Text = "Dynamic Page";

// move the RTB into the new tab page.
richTextBox1.Parent = tp1;

tabControl1.TabPages.Add(tp1);



To remove a tab page, you can use the TabControl.TabPages.Remove or RemoteAt functions, but don't forget to Dispose the tab page and its contents afterwards to free window handles.


Q2: I'm not sure what is causing the cursor to change to the Wait cursor. Usually it only does that if you tell it to use the Wait cursor or if the program stops responding.

Q3: Make new "Form" files, edit them just like "Form1", and then in the Form1 "OnLoad" function you could use "MyForm form = new MyForm();" and then "form.ShowDialog();" or "form.Show();" to pop entirely new windows like this. You could optionally hide your main form while this happens.

Share this post


Link to post
Share on other sites
Sign in to follow this