Solved

How do I use a RichTextBox

Posted on 2011-09-10
7
378 Views
Last Modified: 2013-11-08
The easy one to use is the one that works right out of the box: System.Windows.Forms.RichTextBox. The one I need to use is System.Windows.Controls.RichTextBox.

I have a System.Windows.Forms.RichTextBox in my program, but need to convert it to a System.Windows.Controls.RichTextBox because it has the ability to do spell check (http://rdsrc.us/pWeOTh).

I have all the references, and I can create the RichTextBox, but I cannot figure out how to actually get it on the form.

 
Dim x As New RichTextBox
        x.SpellCheck.IsEnabled = True
        x.Width = 200
        x.Height = 200
        x.Visibility = Visibility.Visible

Open in new window


How do I get this new RTB on the form so I can use it?
0
Comment
Question by:DrDamnit
  • 4
  • 3
7 Comments
 
LVL 85

Expert Comment

by:Mike Tomlinson
Comment Utility
Add it to a container.  =)

The Form:

    Me.Controls.Add(x)

A Panel:

    Panel1.Controls.Add(x)

Etc....
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
Comment Utility
*Set a Location if desired:

    x.Location = New Point(25, 50)
0
 
LVL 32

Author Comment

by:DrDamnit
Comment Utility
Idle_Mind:

Tried me.controls.add(), it is the wrong type:
Error      1      Value of type 'System.Windows.Controls.RichTextBox' cannot be converted to 'System.Windows.Forms.Control'.      C:\Users\michael\Documents\Visual Studio 2010\Projects\ComposerPad\ComposerPad\Form1.vb      112      25      ComposerPad

lcoation doesn't work either:
Error      1      'location' is not a member of 'System.Windows.Controls.RichTextBox'.      C:\Users\michael\Documents\Visual Studio 2010\Projects\ComposerPad\ComposerPad\Form1.vb      112      9      ComposerPad
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 85

Expert Comment

by:Mike Tomlinson
Comment Utility
Ah!...sorry.  I wasn't paying attention very closely.

The System.Windows.Controls.RichTextBox is a WPF control.  It can't be used in a WinForms app.  If you really need that control then build a WPF application.

*WinForms and WPF applications are completely different beasts!  =\
0
 
LVL 32

Author Comment

by:DrDamnit
Comment Utility
Oh crap.

Does that mean I have to RE-BUILD the ENTIRE application as a WPF application?

Can I copy / paste the controls from one to the other?

Is this a major undertaking?
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
Comment Utility
Major would be an understatement...

WPF applications use a completely different architecture and paradigm than a WinForms application!

I don't know if this is worth the effort:
http://msdn.microsoft.com/en-us/library/ms742215.aspx




0
 
LVL 32

Author Comment

by:DrDamnit
Comment Utility
Stupid spell check.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now