Bullets from one richtextbox to another

How do I add the contents of one rtb to another and keep formatting?

Page 1 of 1

4 Replies - 2482 Views - Last Post: 11 October 2009 - 05:28 AM Rate Topic: -----

#1 Bez84   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 33
  • Joined: 10-October 09

Bullets from one richtextbox to another

Posted 10 October 2009 - 01:09 PM

Hi guys,

This is my first post so I should say I'm a total C# newbie.

Been trying to develop an app for work which is essentially just a form we fill out while on phone to our customers.

In my app I have a richtextbox called rtbActions and another on another tab called rtbPreview

I've added controls above each box so user can format with bullet points the steps they take (using selectedbullet = true;) but I want to show the contents, with this formatting in rtbPreview.

If I just do something like

rtxPreview.Text = rtxActions.Text // this is just shows the plain text with no bullet points in each line.


Is there any way to bring them through with proper formatting?

This has had me stuck for days now, would be so chuffed if someone could help!

Thanks :)

Is This A Good Question/Topic? 0
  • +

Replies To: Bullets from one richtextbox to another

#2 s3thst4   User is offline

  • a * a = (b * b) + (c * c) - 2(b)(c)cos(A)
  • member icon

Reputation: 10
  • View blog
  • Posts: 587
  • Joined: 20-November 08

Re: Bullets from one richtextbox to another

Posted 10 October 2009 - 01:42 PM

Uh, I don't have my IDE with me (this computer is shit), but try something like

rtxPreview.rtf = rtxActions.rtf;


Was This Post Helpful? 1
  • +
  • -

#3 Bez84   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 33
  • Joined: 10-October 09

Re: Bullets from one richtextbox to another

Posted 10 October 2009 - 03:32 PM

Thank you that is excellent! I'd not come across that property. :^:

If I may just ask a short follow-up question, I need to append the rtxPreview with rtf, but it must be added to the end of the text already in there. This seems to replace whole text... could you suggest how I might work round this or point me to some references?

Thanks so much for your help so far. :)
Was This Post Helpful? 0
  • +
  • -

#4 s3thst4   User is offline

  • a * a = (b * b) + (c * c) - 2(b)(c)cos(A)
  • member icon

Reputation: 10
  • View blog
  • Posts: 587
  • Joined: 20-November 08

Re: Bullets from one richtextbox to another

Posted 10 October 2009 - 05:57 PM

If you're asking to just add to the rtf in the rtxPreview, try

rtxPreview.rtf += rtxActions.rtf;


Was This Post Helpful? 0
  • +
  • -

#5 Bez84   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 33
  • Joined: 10-October 09

Re: Bullets from one richtextbox to another

Posted 11 October 2009 - 05:28 AM

Thanks mate, yeah I had tried that but it wasn't working.
			if (rtxActions.Text.Length > 0)
			{
					rtxPreviewText.Text += "Actions: \r\n ";
			 	rtxPreviewText.Rtf += rtxActions.Rtf; 
			}



This is totally driving me insane. If I do the above it will execute the first statement fine but does nothing with the second. With some experimentation I did get it to show with bullets once but only the first time the method was called, subsequent times did nothing again. I've tried placing it in it's own method called form a temp button and get the same result.

for example if I take the first line out and change the second so it's
			if (rtxActions.Text.Length > 0)
			{
					//rtxPreviewText.Text += "Actions: \r\n ";
				rtxPreviewText.Rtf = rtxPreviewText.Text + rtxActions.Rtf; 
			}



It'll work as I want but as soon as I uncomment the code in the first line and try I get "Invalid Argument exception error invalid format." If I had any hair I'd be tearing it out by now. lol

This post has been edited by Bez84: 11 October 2009 - 06:11 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1