473,803 Members | 3,766 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2454

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.EventArg s) Handles mnuGroter.Click
Const iBasisGrootte As Single = 12

Static FontsizeVergrot ing As Single = 3

Dim fontsize As Single

Static sGeselecteerd As String

If sGeselecteerd <> rtb.SelectedTex t Then 'other text

FontsizeVergrot ing = 3

End If

If rtb.SelectionLe ngth > 0 Then

Dim selStart As Integer = rtb.SelectionSt art

Dim selLength As Integer = rtb.SelectionLe ngth

Dim currFont As System.Drawing. Font

fontsize = iBasisGrootte + FontsizeVergrot ing

Dim i As Integer

For i = 0 To selLength - 1

rtb.Select(selS tart + i, 1)

currFont = rtb.SelectionFo nt

rtb.SelectionFo nt = New Font(currFont.F ontFamily, fontsize, _

currFont.Style)

Next

rtb.Select(selS tart, selLength)

FontsizeVergrot ing = FontsizeVergrot ing + 2

sGeselecteerd = rtb.SelectedTex t

End If

End Sub

andreas" <an*****@pandor a.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
17290
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 RichTextBox, I created. Just want to paste or write this string to the RichTextBox; what command should I use? I used the following command and it did not help ... richTextBox.SelectionFont = <some font selected>
2
658
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 it possible using this control? Thanks, Juan.
2
1755
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 the word bold? my code so far is if (Button1.Enabled = false) {
1
3069
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 able to click or right click on text within the form such as Priority: ]. If the user clicked on Low the brackets and bars would go away and leave Priority: Low. And the same for Medium and High Is there any way to do that
2
6074
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). How is this done? Also, how do I delete the current selection? Thanks.
5
11052
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 action. When I insert the text, the formatting for the other content of the control is lost. In summary, I want to add the current date and time to a RTF control while maintaining the existing appearance.
0
1026
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 any response
0
1922
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 keep the rtf formatting, SelectionColor, SelectionBackColor, SelectionFont and so on. e.g. string str = richtextBox1.SelectedText;
0
1656
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 convenience, I include my reply here. ==================================================== As Anders has suggested, you can use the SelectedText or SelectedRtf
0
9703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9566
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10555
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10069
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5503
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2974
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.