|
So I assume you have a tabControl somewhere and a button to add new tab page?
the tabControl has a collection of tabpages that you can add/remove tabs, so in your button click event do something like...
TabPage newPage = new TabPage();
TabControlMain.TabPages.Add(newPage);
RichTextBox rtb = new RichTextBox();
rtb.Location = new Point(0, 0);
rtb.Size = newPage.Size;
newPage.Controls.Add(rtb);
It may need some slight changes to the code to get it to work as I have not tested it, but hopefully you will get the idea
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Ok i have now one Big problem...when i click on this new button..it makes new tab without name...and with richtextbox in it. Original tabpage is working fine with copy and paste etc.
Now i would like to do few things:
1. Name the new tab
2. Docking of new one same as original--Fill
3. Copy & paste & and changing font for all the tabs not only original one
When i click new button i put name of RichTextBox to richTextBox1 like original one..after making new tab without name and docking..copy , paste, font style works only in original tab with original richtextbox which i added with designer...
Please help me with that
|
|
|
|
|
Aljaz111 wrote: Please help me with that
Sure, where did you get stuck? What line gives you an error?
|
|
|
|
|
How to apply dock style of new tabpage? I can't find on the internet...and second thing is how to make that copy and such functions would work on all new tabpages not only original?!
|
|
|
|
|
In the Tabpage class there is a list of properties[^], one of which is the dock[^] property which accepts a dockstyle[^] value which can be None, top, bottom, left, right and fill .
Hope this get's you started.
|
|
|
|
|
Aljaz111 wrote: 1. Name the new tab
new tab name can be change with the .Text property
Aljaz111 wrote: 2. Docking of new one same as original--Fill
the docking of the tab page with depend on the tabcontrol so assume you mean the RichTextBox, whcih has a property called .Dock in which you can apply a DockStyle each time you create a new instance of the RichTextBox
Aljaz111 wrote: 3. Copy & paste & and changing font for all the tabs not only original one
when you do the copy/paste/font function then you need to loop all available tab pages in the tab control and then set then do whatever in the loop, not just with each one.
when you set the name of the RTB try setting it to use a numeric value based on the number of tab pages display...
rtb.Name = "RichTextBox" + tabControl.TabPages.Count;
when you want to access all RTB's then try something like...
int count = 0;
foreach(TabPage page in TabControl1.TabPages)
{
count++;
RichTextBox rtb = (RichTextBox)page.Controls["RichTextBox" + count];
}
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
It works just fine..thank you man!! One thing more.. when i try to save all modified tabs.. how to?? This code doesn't work correctly..it shows just one save dialog..else just question if i would like to save changess..here is code..
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
{
int count = 0;
foreach (TabPage page in tabControl1.TabPages)
{
count++;
RichTextBox richTextBox1 = (RichTextBox)page.Controls["RichTextBox" + count];
temp = richTextBox1;
if (temp.Modified)
{
DialogResult result = MessageBox.Show("Do you wish to Save changes?", "Save Changes", MessageBoxButtons.YesNoCancel);
if (result == DialogResult.Yes)
evtSave_Click(sender, e);
else
if (result == DialogResult.Cancel)
e.Cancel = true;
}
}
modified on Wednesday, May 27, 2009 2:23 PM
|
|
|
|
|
well the code you have there for setting the font is in a loop so it will do it for every run of that loop i.e. for every tab page.
if you want to do things for just the selected tab page then instead of looping all the tab pages in the tab control. you can simple use the tab controls 'SelectedTabPage' property...
RichTextBox richTextBox1 = (RichTextBox)TabControl1.SelectedTabPage.Controls["RichTextBox" + count];
FontDialog f = new FontDialog();
if (f.ShowDialog() == DialogResult.OK)
richTextBox1.Font = f.Font;
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
What about the count?? Where should i get it? I tryed with paste function like this..but it doesn't work...
private void evtEditPaste_Click(object sender, EventArgs e)
{
int count = tabControl1.SelectedIndex;
RichTextBox richTextBox1 = (RichTextBox)tabControl1.SelectedTab.Controls["RichTextBox" + count];
richTextBox1.Paste();
}
That doesn't work!!
modified on Wednesday, May 27, 2009 2:51 PM
|
|
|
|
|
Hi friends,
I want to edit the registry key: HKEY_CURRENT_USER\Control Panel\Desktop\MenuShowDelay" which has the default value data as '400'. All I want is to change it to '200', such that the menu shown while clicking the Start button, speeds up. I searched google and I found numerous results, but was not sure if to go with them becasue Registry is very critical and editing a wrong key could mess up my system.
Please help,
Cheers,
Rajdeep.NET
PS: Please provide me a sample code to do this. Would be very helpful.
|
|
|
|
|
|
Why on earth are you doing this?
|
|
|
|
|
YOUR ORIGINAL POST IS STILL ON THE FIRST SCREEN STOP SPAMMING!!!!
|
|
|
|
|
Kindly click on "Vote to Remove Message" instead of low-voting it. ATM, I see 10x1 votes and the message is not tossed off the board yet.
Added: Ah, the power of democracy! Looks much better now.
It is a crappy thing, but it's life -^ Carlo Pallini
modified on Wednesday, May 27, 2009 9:44 AM
|
|
|
|
|
Rajesh R Subramanian wrote: Kindly click on "REPORT MESSAGE" instead of low-voting it
I see no such facility.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
On the bottom right of the message, below the voting numbers is the [Vote to remove message] link! Something like 3 to 7 clicks (depending on the weightage of the member voting on it) on that will automatically remove the message permanently.
[Edited my previous post too to make it clear]
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Abbe saale Tamil Nadu ki punch.... Saale Prabhakaran ki aulad, jab inn logo ko tere kaale rang ke baare mein pata chalega, tab kya hoga kabhi socha hai? Bara aaya .net sikhaane!
|
|
|
|
|
SOAD
My failometer has shot off the end of the scale!
I seem to have misplaced my ban button.. no wait... found it!
|
|
|
|
|
Have you never heard of google? Or if your not sure of your code write some and post it here and ask about the code not how to do it!!!! you need to find a new career.
|
|
|
|
|
Google is inaccessible, maybe someone hacked it. Did you?
|
|
|
|
|
|
My guess is Google is blocking Rajdeep. They probably got tired of his/her stupid searches.
|
|
|
|
|
I take it you didn't like the previous relpies?
GROW UP.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
|
Drawing pictures now, nice career change. Good luck with that.
My failometer has shot off the end of the scale!
I seem to have misplaced my ban button.. no wait... found it!
|
|
|
|