473,322 Members | 1,493 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,322 software developers and data experts.

Font to bold, italic, underline only

Okay,

Assinging the font and its style (bold, italic etc.) using the font dialog
is easy such as:
FontDialog1.ShowDialog()

txtEmailBody.SelectionFont = FontDialog1.Font

But how does one change the selected text to bold, italic or underlined
without using the font dialog?

I've looked under .selectionfont and.selectedtext and can't see any way to
change it to bold, italic etc. All I see is a read-only property that tells
me if its bold, italic etc.

There's go to be a way. All these apps have these small B, I, U buttons.

Initialize a font, tweak it and assign it? Is that really the only way?

Thanks,

Adam


May 7 '06 #1
2 2847
"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> schrieb:
Assinging the font and its style (bold, italic etc.) using the font dialog
is easy such as:
FontDialog1.ShowDialog()

txtEmailBody.SelectionFont = FontDialog1.Font

But how does one change the selected text to bold, italic or underlined
without using the font dialog?

I've looked under .selectionfont and.selectedtext and can't see any way to
change it to bold, italic etc. All I see is a read-only property that
tells me if its bold, italic etc.


Removing a certain font style:

\\\
EmailBody.SelectionFont = _
New Font( _
EmailBody.SelectionFont, _
EmailBody.SelectionFont.Style And Not FontStyle.Bold _
)
///

Adding a font style: '... = New Font(..., EmailBody.SelectionFont Or
FontStyle.Bold)'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

May 7 '06 #2
Thanks, it worked and could equally do underline, italic the same way.
Thanks.

Adam

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:O0**************@TK2MSFTNGP03.phx.gbl...
"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> schrieb:
Assinging the font and its style (bold, italic etc.) using the font
dialog is easy such as:
FontDialog1.ShowDialog()

txtEmailBody.SelectionFont = FontDialog1.Font

But how does one change the selected text to bold, italic or underlined
without using the font dialog?

I've looked under .selectionfont and.selectedtext and can't see any way
to change it to bold, italic etc. All I see is a read-only property that
tells me if its bold, italic etc.


Removing a certain font style:

\\\
EmailBody.SelectionFont = _
New Font( _
EmailBody.SelectionFont, _
EmailBody.SelectionFont.Style And Not FontStyle.Bold _
)
///

Adding a font style: '... = New Font(..., EmailBody.SelectionFont Or
FontStyle.Bold)'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

May 7 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Viken Karaguesian | last post by:
Hello all, It stinks being a newbie! One thing that I'm not sure about with CSS is: where is the "proper" place to put font attibutes? This has me a little confused. Take the below style sheet...
7
by: Derrick | last post by:
Can anyone tell me how to persist and retrieve the font characteristics that a user chooses to have displayed in a personalized label field on the front of their application? I wanted to be able...
0
by: silverprox | last post by:
Hi, I'm developing a simple composite control with 2 child controls, a Label and a TextBox. I expose easily many properties of the inner controls, in the form i.e.: BoxToolTip & LabelToolTip,...
1
by: shachar | last post by:
hi all. i have a grid ocx i'm using, and i have to set it's font to an integer value returning from a font object. when i wrote : Dim f As System.Drawing.Font al it's propertys are readonly. how...
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...
1
by: Gidi | last post by:
Hi, Is it possible to draw string with few font styls, like in WORD (i.e. Bold and Underline) at the same line, on the same text ? and is it possible that part of the line will be bold and the...
0
by: the.tinapatel | last post by:
Guys, I want the user to be able to select font (such as Bold, Italic, underline) and stuff like that from a dropdown list) and then I wanna apply these properties to all my page (all text). Now...
1
by: FLEMEF | last post by:
Hello All, I'm not very good at Java... With this piece of Java code, how could I modify the StyleOptions.java program to allow the user to specify the size of the font, while using the text...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.