473,396 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Changing font in Text Rich Box

I am a novice at programming. I am trying to change the font in a rich text box. My code is as follows:

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnSTART_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSTART.Click
  2.     rtbExperiment.SelectionFont = New Font("Tahoma", 20, FontStyle.Italic)
  3.     rtbExperiment.Text = "Does it work?"
  4. End Sub
The SelectionFont statement has no effect on the display in the rich text box.

What am I not doing?

Thanks,

Dale
Nov 6 '07 #1
2 1372
I finally figured it out by trial and error.

I should use rtbExperiment.Font rather than rtbExperiment.SelectionFont.

Dale
Nov 7 '07 #2
Killer42
8,435 Expert 8TB
Glad to see you got it sorted. :)

And thanks for posting what you found out. This will be helpful for anyone else who comes looking for the same answer.

Quick question, though - do you understand why SelectionFont (which is a property, not a statement) didn't achieve what you wanted? Understanding the effects of the different properties and methods is the key to working effectively with the various controls.
Nov 7 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Mr.Baha | last post by:
Hello, I have a situation where I am appending text to a multi-line (rich)textbox in a C# form. Now depending on which event does the appendtext, i want to distinguish the lines in the textbox by...
7
by: Sakharam Phapale | last post by:
Hi All, How to preserve the old font properties while changing new one? I posted same question 2 months back, but I had very small time then. eg. "Shopping for" is a text in RichTextBox and...
4
by: Adam Honek | last post by:
Hello, I have a rich textbox on my form and I want the user to be able to select the font properties via the font dialog box. 1) How do I bring up the font dialog box in the code? 2) How do I...
4
by: JoelW | last post by:
Let's say you're programming in VB.NET, and you have: Dim str1 As String Dim str2 As String Dim str3 As String str1 = "I am red" str2 = "I am yellow" str3 = "I am dark green"
0
by: nitehawk416 | last post by:
I want to change the font of my rich text box to a font I downloaded. In the properties the font isn't there, so I tried changing it through the code with this variable declaration Font MUDFONT =...
3
by: scott | last post by:
Is it possible to place multiple fonts into one field of an access report? What I need to do is place some text which is in a specific font (used by nurseries to show of a unique species of plant)...
1
by: Randy Shore | last post by:
I have run into a problem with the new rich text control in Access 2007. It seems that you can only choose from 6 preset font sizes when entering or editing text. The sizes are...
3
by: Prodian | last post by:
I using the following code to start a process and redirect the output to a rich textbox. This is working fine but now I want to change the font color for certain text lines for example: ...
0
by: babai28 | last post by:
Hi there! I have a rich text box and in the formatting toolbar (that sticks to its upper border) I have a ComboBox that displays the standard Font sizes. Just like it is in MS Word or Excel. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.