Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I use a RichTextBox

Posted on 2011-09-10
7
Medium Priority
?
437 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 36516383
Add it to a container.  =)

The Form:

    Me.Controls.Add(x)

A Panel:

    Panel1.Controls.Add(x)

Etc....
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 36516384
*Set a Location if desired:

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

Author Comment

by:DrDamnit
ID: 36516418
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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 36516434
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
ID: 36516455
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 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 36516469
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
ID: 36516511
Stupid spell check.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

721 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