Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2007

Tip: Looking for answers? Try searching our database.

RichTextBox text on MDI Parent form Undo Redo etc

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jenbo - 30 Jan 2007 15:50 GMT
I have a richtextbox sitting on a tab control on a child form under
the MDI parent. I have undo, redo, cut etc controls on a toolbar on
the same tab control, I can code these no problem as the richtextbox
text property is not blanking so the canundo method is fine to use. I
have these methods also on the MDI parent as well so that the user
should be able to undo, redo, edit the action, text from the main
menu, but when I do the following

MPCE.Child_Forms.Policy policyWin = new MPCE.Child_Forms.Policy();
TabControl tabControlPolicy =
(TabControl)policyWin.Controls["tabControlPolicy"];
TabPage policyPage = (TabPage)tabControlPolicy.Controls["policyPage"];
RichTextBox rtbMain =
(RichTextBox)policyPage.Controls["richTextBoxMain"];

rtbMain.Undo();

the richtextbox text property is being blanked out. I have noticed in
some of the forum's that there was/is a bug in the richtextbox control
that is fixed as of XP SP2 which is what I am running, it had to do
with the text property blanking and methods not being correct because
of this, is this what is happening here, or is it something to do with
the way I am referencing the richtextbox itself, is that not done
correctly?

Any help welcome.

EJ
Ciaran O''Donnell - 31 Jan 2007 13:16 GMT
I dont know about the richtextbox issue you describe but the way you are
accessing the richtextbox is bad design. You should at least expose real
properties to enable you to get at it properly. One better is to put an undo
method on the child form so you can just call it. then that does the same as
the child forms button. or have a set of static events for undo etc which the
child form can subscribe to.

Signature

Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com

> I have a richtextbox sitting on a tab control on a child form under
> the MDI parent. I have undo, redo, cut etc controls on a toolbar on
[quoted text clipped - 24 lines]
>
> EJ
Jenbo - 31 Jan 2007 13:54 GMT
So what's good design, this is the way the designer has put the
controls on the form, the child form contains the tab control and this
contains the richtextbox, should I go and modify the designer file to
have the richtextbox added to the upper level form instead of the tab
control? But it is part of the tab control so is that the right way it
should sit?

What do you mean by real properties, and how would that help, do you
mean that is should be a user control or something like that? But
again the designer will add it to the tab control by default?

Static events for undo - this is like application undo event?

Thanks

EJ

On Jan 31, 1:16 pm, Ciaran O''Donnell
<CiaranODonn...@discussions.microsoft.com> wrote:
> I dont know about the richtextbox issue you describe but the way you are
> accessing the richtextbox is bad design. You should at least expose real
[quoted text clipped - 36 lines]
>
> - Show quoted text -
Jenbo - 31 Jan 2007 17:12 GMT
Disregard that message, wasn't thinking, got the modifiers right for
the richtextbox, will try the undo method from the child form.

> So what's good design, this is the way the designer has put the
> controls on the form, the child form contains the tab control and this
[quoted text clipped - 58 lines]
>
> - Show quoted text -

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.