RichTextBox Formatting - Selection Font Gets Set To Nothing

Dec 15, 2010

I have a RichTextBox. I process all the formatting and everything works fine. There is an exception. When I have selected text that have two states of formatting in it, the SelectionFont member is set to Nothing. I notice that WordPad recognizes this condition
and kindof greys out the affected format.

Let's take this example:
This text is in Bold.
The rest of the comments here and not in bold.

When I select these two lines, the SelectionFont gets set to Nothing. WordPad sets the Bold button grey, but still clickable. If I click the Bold button in this state, the entire selection is set to bold. How do I achieve this same functionality?

View 3 Replies


ADVERTISEMENT

VS 2008 RichTextBox Clears Formatting When Changing Font?

Nov 25, 2009

I have a richtextbox with multiple colored text in it. When I change the font, the color table is removed and everything changes to the default fore color. Anyone know of a why to preserve the color table and formatting when changing the font? I know I could build the RTF manually, but I really want to avoid that if possible.

View 2 Replies

RichTextBox Selection Font (Applying 2 Styles)

Jan 18, 2009

How do I apply 2 font styles to the text selected in a richtextbox? Used this method to change fontstyle:
RichTextBox1.SelectionFont = New Font(RichTextBox1.SelectionFont, FontStyle.Bold)

But with this method I can only apply 1 font-style (for example bold OR italic OR underlined, etc.) right? But I want to apply for example 2 front-styles, or just add the font style ( so I can add several front-styles to the selected text, for example the text is bold, and then ALSO make it underlined (with this method I can only change the font-style, only one font-style)), how do I do this?

Just do so:
RichTextBox1.SelectionFont = New Font(RichTextBox1.SelectionFont, FontStyle.Bold + FontStyle.Italic)

View 2 Replies

Display A Font/font Colour Selection Box?

Apr 11, 2009

I'm creating a basic text editor and I wish to include the option to change the font, font colour and background colour of the text box. Is there a way I can ask VB to display a font/font colour selection box or do I have to populate a combo box and code it all myself?

View 2 Replies

Rich Text Formatting - Setting Font Size

Jul 1, 2010

I have created an instance of a Rich Text Box:

Dim RichText As New RichTextBox()
I was able to write to it using:

RichText.AppendText("Text")
I was able to save the document to a file:

RichText.SaveFile("C:TempRTDoc1.rtf")

What I cannot find is how to set the font, and font size. IntelliSense doesn't help. Everything is "read only", meaning retrieve a current value.

View 17 Replies

Creating A Second Constructor For Font Selection?

Apr 3, 2010

How can I create a contructor for this.I have a constructor already in my class as follows :

Public Sub New()
Text = "Hello World"
TextFont = New Font(System.Drawing.FontFamily.GenericSansSerif, 10, FontStyle.Italic)

[code].....

View 5 Replies

VS 2010 Change Font From Selection Box?

Apr 14, 2010

I'm trying to make a wee word pad application in an attempt to learn visual basic.

I've got a combo box which has a list of fonts on the system:

Imports System.Drawing.Text Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim fonts As New InstalledFontCollection
For Each X As FontFamily In fonts.Families
cmbFontName.Items.Add(X.Name)

[Code]...

View 6 Replies

C# - Formatting Richtextbox In WPF?

Jan 22, 2010

I have a Dynamic Fields comming from database. These fields populated on RichTextBox after changing the color.Means Different Fields in Different Color.

View 1 Replies

RichTextBox Formatting?

May 5, 2010

At the moment i am doing my IT PROJECt for college and i need my project not only to work but look good.

CVBox.AppendText(TextBox1.Text & vbNewLine & data & vbNewLine & ComboBox1.Text & vbNewLine &
nationality & vbNewLine & vbNewLine & TextBox5.Text & vbNewLine & "Tel. " &

[code].....

View 1 Replies

VS 2010 Word-like Font And Size Selection?

Jan 24, 2011

I'm working on a word processor (yes, the thread with the quit forms and the count times open is the same word processor)

It's called iRobosoft Word. The 3rd version is at sourceforge and the 4th is in RC stage.

The 4th version is quite a major upgrade, but back to the topic.For font I used:

Private Sub Rich_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Rich.TextChanged
Font1.Text = Rich.SelectionFont.ToString
End Sub

[code]...

View 8 Replies

VS 2010 RichTextBox Formatting?

Apr 9, 2011

I've developed a MySQL chat app that I have in my program. It works perfectly, however all of the text is the same color. I use a silver-on-black scheme. I'd like to do 1 of 2 things, whichever one is.. er.. "more possible". The first option would be simple - alternate each row's back color. So that one row would be silver-on-black, the next row would be black-on-silver, and so on alternating. Each row is separated by a "vbCrLf". The second option would be to merely bold or turn to white the info text. Here's the format of the chat messages: [{time} - {user}] {message}. I would want [{time} - {user}] to be bold and white. Are either of those 2 options possible? Well, I know they're possible

View 1 Replies

Changing The Font Color By Using The Selection In A Radio Box At Runtime

Jul 31, 2009

I am trying to convert a value from a radio list box that is populated by an access database. The database loads fine, I have no trouble with that. My issue is that I am trying to take the value of the radio button chosen and turn it into a font color. Therein lies my problem. I see that it cannot be a string, but when I turn it into an object, I get an error. I will note that I am using VS 2008 (Windows Vista x64), and the database is compatible with a 2002 - 2003 Access database. I am using ASP.NET for my programming, however, I am trying to program it in VB. This is my code:

[Code]...

View 4 Replies

Copying Text Along With Its Formatting From A RichTextBox

Feb 5, 2011

How to copy the text in a RichTextBox along with its formatting to a wordpad or webbrowser?

View 1 Replies

Forms :: RichTextBox Markup Formatting?

Jul 29, 2009

I am trying to bind a RichTextBox to data from an XML file where text within a paragraph may be tagged with formatting tags. As an example the text may look like this:"The size of the area is 5000 m<superscript>2</superscript>".Text may also contain other formatting tags such as <bold> or <italic>:"The quick brown fox <bold>jumps</bold> over the <italic>lazy</italic> dog".

View 5 Replies

VS 2008 : RichTextBox Formatting In A Loop?

Jun 23, 2011

i am trying to display a line of smiley faces ☻ and change the colour of each face, i cant use a find method as there are 10 of these smilies so i thought about using a loop and selecting only the last one entered and changing its colour. here is a simplified version of my

VB.Net
For a = 0 to 9
RichTextBox1.Text += "☻" ' add the smiley

[code]....

This when i ran it changes the first nine to the first colour in the array and correctly does the colour of the last smiley? could i for instance format the character first then add it formatted?

View 2 Replies

VS 2010 Formatting Parts Of A Richtextbox?

Jun 7, 2011

I have some text displayed in a richtextbox from an xml. This is how is shows upHaste <i>(As soon as it comes under your control.)</i>At the beginning of the end step<i>The storms of the wastelands form quickly and hit hard. Few have anything to do with rain.</i>

View 1 Replies

End Selection In RichTextbox?

Nov 27, 2009

I want to end the selection in a rich text box.Example:

Sentence - "I was walking in the park and found a coin."
I want to select from "walking" to "found"
RichTextbox1.SelectionStart = RichTextbox1.Find("walking")

[code].....

View 3 Replies

RichTextBox - Send Email But With HTML Formatting

Jun 24, 2010

I have an Emailer in my Application and it has a richtextbox which the user can add fancy colours, font, pics etc... but when I send the email it doesn't send it as HTML. Is there a property in the richtextbox that lets me access the HTML code so that the email is sent as HTML and not just plain text. I need to be sending the emails as it appears in the richtextbox.

I am using the following code
Dim moApp As Outlook.Application
Dim oEmail As Outlook.MailItem
moApp = CreateObject("Outlook.Application")
oEmail = moApp.CreateItem(Outlook.OlItemType.olMailItem)
[Code] .....

And I get the following email Without HTML. Please look at the Emailer to see that it is formatted. So I need to send the content of the Emailer as HTML via outlook.

View 6 Replies

RichTextBox Hide Selection?

May 23, 2011

I'm using a richtextbox and I format the text (color) during keypress.. (like visual basic language: text in black, "dim" in blue, "comments" in green...) I use selection properies to do this, ok, work fine, but I see the selection and unselection.. Ok, is very fast, but it's annoying.. there is a way to format the text and hide the selection?

View 2 Replies

VS 2010 RichTextBox Selection?

Apr 29, 2011

When setting the selection of a RichTextBox, the selected text is highlighted even though I set the HideSelection property to True. Once the RTB loses focus then the selected text is no longer highlighted. Programatically setting the focus to another control doesn't hide the selection, only physically clicking another control will hide it. So is there a way I can make the RTB not show the selection right from the start?

View 2 Replies

Changing Font In RichTextBox?

Jul 10, 2009

I'm trying to change the font in a RichTextBox, but it's not working:

RichTextBox.Font.Name = "Times New Roman"
this apparently read only
With RichTextBox
.SlectionFont = "Times New Roman"
End With

here I need a System.Drawing.Font class and not a string

View 8 Replies

Make A Richtextbox Only Have One Font

Dec 29, 2009

I need to use a richtextbox, not a normal textbox because of the way it keeps the caret position, from line to line. But I need to keep the text at the same font all the time even if it is pasted. At the moment I have it selecting the entire text and changing the font to the original (Lucida Console) but it look horrible when you paste into it as it flashes blue.

View 2 Replies

Apply Colour Formatting To A Richtextbox *as User Types*?

Oct 18, 2010

I have a RichTextBox with an OnChanged event. The OnChanged event should look at each line in the RichTextBox and if the line is of prime length colour it red, otherwise colour it black. How do I do this? I think it is possible to select from index a to index b and set selection colour, but I think this will lose my cursor position.

View 2 Replies

RichTextBox - Formatting Data From Access Database Field

Oct 29, 2010

Using VB 2008, I have a form which includes a richtextbox which is bound to a database field. When i bind the datafield to the richtextbox, I get an unformatted display unlike the control in VB6. How can I bind the data from the database to the richtextbox so that it displays formatted?

View 1 Replies

Saving Richtextbox Data Inside A Database Along With The Formatting?

Jun 21, 2010

I have a rich text box in one of my applications (WPF). Now I want to store the data of the rich text box along with its formatting (e.g. bold, colored etc.) into a database (SQL Server). Currently I am storing the whole XAML of the text box in a database field. however, I am not sure whether this is the right approach.

View 2 Replies

VS 2005 Merge / Append Two RichTextBox's And Preserve Formatting

Jul 22, 2009

I have two RichTextBoxes, each of which can have any sort of formatting. I need to be able to take the rich text from box 2, complete with formatting, and add it to the end of box 1, preserving the formatting of both box 1 and the appended rich text.

I've not managed to find anything usefull on this anywhere apart from hints pointing to manually re-building the RTF codes for the result (but no actual VB / C# / C code to perform this or similar).

View 5 Replies

Code Selection Of Text Within A RichTextBox?

Mar 26, 2009

How do you code selection of text within a RichTextBox. I tried the following code and nothing happens.I would think this should select all text within the RichTextBox.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.RichTextBox1.SelectAll()
End Sub

I would think this would select text from a start point to an end point.

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ss = Convert.ToInt16(TextBox1.Text)
se = Convert.ToInt16(TextBox1.Text)
Me.RichTextBox1.Select(ss, se)
End Sub

View 1 Replies

.net - RichTextBox Append With Font Color?

Jun 19, 2012

I need to set the color of the font every time I add text to the RichTextBox

I'm using. RtbResults.AppendText(DisplayPacket)

To add a new line of text, but each line needs to be a set color.I found this on the net but it doesn't seem to work in my VS11b RtbResults.AppendText(DisplayPacket,forecolor,backcolor,font)

Are these the correct overloads? can I do this another way if this doesn't work?I don't want to have to insert the text then go back and select and change its color.

View 1 Replies

Adjusting Font Style For A RichTextBox?

Dec 23, 2011

I'm having trouble adjusting the font style in a RichTextBox and I've seen a few different approaches that talk about single attributes (like toggling bold on and off)... but I'm trying to make it so that my font class can adjust any attribute (bold, italic, underline).

I realize that Font.Style is a set of Boolean flags (a bitfield?)... but I'm not sure how to handle the attributes all at once.

Here is the troublesome code:

Public Sub ModifyFontStyle(Optional ByVal Plain As Object = Nothing, Optional ByVal Bold As Object = Nothing, _
Optional ByVal Italics As Object = Nothing, Optional ByVal Underlined As Object = Nothing)

[Code]....

What is happening to the font? The text should be underlined and in italics not strikethrough...

Is this a logic error or a simple misunderstanding on my part?

View 2 Replies

Change Font Color In RichTextBox?

Mar 30, 2012

how change font color for some word in Richtextbox example : when write "The lost" in Rich font color change to blue ...and other word don't change ...other example : same "DIM","AS" and "integer" in VB.NET ,,how i can do it?how to save the word from richtextbox to text file ?

Note : I'm using VB.NET 2008

View 11 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved