473,405 Members | 2,421 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,405 software developers and data experts.

richtextbox selectedtext bold upper .... how to find out

When I select a text in a richtextbox to set de selected text in bold,
regular, italic .. or non I want to do that with one click
Thus I must find out if the selected text is already in bold, regular,
italic......
Is there any code for this
Thanks for any response
Jun 10 '06 #1
2 2416

andreas wrote:
When I select a text in a richtextbox to set de selected text in bold,
regular, italic .. or non I want to do that with one click
Thus I must find out if the selected text is already in bold, regular,
italic......
Is there any code for this
Thanks for any response


if me.RichTextBox1.SelectionFont.Bold then

'do somthing

end if

Jun 11 '06 #2
Thanks Ahmed, it works fine but i have still two questions
1)
if I don't want bold, italic ... I set the font to regular but I lose both
when they are there
how set I the text to not bold only or to not italic only
2)
I have taken a code from internet for making the text greater by clicking
and after a little changing it works fine but the original text become Bold
after wich I don't understand for what reason

Here follows the code

Private Sub mnuGroter_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles mnuGroter.Click
Const iBasisGrootte As Single = 12

Static FontsizeVergroting As Single = 3

Dim fontsize As Single

Static sGeselecteerd As String

If sGeselecteerd <> rtb.SelectedText Then 'other text

FontsizeVergroting = 3

End If

If rtb.SelectionLength > 0 Then

Dim selStart As Integer = rtb.SelectionStart

Dim selLength As Integer = rtb.SelectionLength

Dim currFont As System.Drawing.Font

fontsize = iBasisGrootte + FontsizeVergroting

Dim i As Integer

For i = 0 To selLength - 1

rtb.Select(selStart + i, 1)

currFont = rtb.SelectionFont

rtb.SelectionFont = New Font(currFont.FontFamily, fontsize, _

currFont.Style)

Next

rtb.Select(selStart, selLength)

FontsizeVergroting = FontsizeVergroting + 2

sGeselecteerd = rtb.SelectedText

End If

End Sub

andreas" <an*****@pandora.be> wrote in message
news:df***********************@phobos.telenet-ops.be...
When I select a text in a richtextbox to set de selected text in bold,
regular, italic .. or non I want to do that with one click
Thus I must find out if the selected text is already in bold, regular,
italic......
Is there any code for this
Thanks for any response

Jun 11 '06 #3

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

Similar topics

2
by: Hariharan S | last post by:
Hi Guys, I have a string, say "Hello World" and would like to format the way I want to (say, wanna have the Hello to be bold italic and the World to be of font size 14 or so) and put it in the...
2
by: Juan | last post by:
I`m inserting strings in a rich text control using the AppendText method, I would like to change certain parts of the string so, for example, a certain word appears bold and red when inserted. Is...
2
by: Alvo von Cossel I | last post by:
hi, i have a richtextbox in my app. when a button is disabled, the richtextbox control should say "The button is now disabled". only the word disabled should be emboldened. how do i make only...
1
by: HJ Majoue | last post by:
I am having a problem with RichTextBox Control and hope you can help I am working on a VB.Net project that has a RTB control, the user opens a form template. What I want to do is for a user to be...
2
by: Clark Stevens | last post by:
Hi. This should be so easy, but I don't get it. Let say I have RichTextbox1 and I want to insert some text at the current insertion point, or at the beginning of selected text (if there is any). ...
5
by: genojoe | last post by:
I have a RTF control on a form and want to insert text programmatically. I thought it would be easy but it does not turn out that way. Can someone refer me to an Internet article that covers this...
0
by: andreas | last post by:
When a text is selected in a richtextbox how can I find out in code wether the selected text is in bold or in regular format for I want to make the other style with a sub_click event. Thanks for...
0
by: TAB | last post by:
"none" <none@none.comskrev i meddelandet news:eaJIxCA7IHA.2260@TK2MSFTNGP03.phx.gbl... Use richtextbox selection properties. Like richTextBox.SelectedText or SelectedRtf if you would like to...
0
by: Linda Liu[MSFT] | last post by:
Hi CES, Thank you for posting here! I notice that you post a same issue in the microsoft.public.dotnet.framework.windowsforms.controls newsgroup and I have replied to that thread. For your...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.