3 Replies - 397 Views - Last Post: 28 June 2013 - 08:17 AM Rate Topic: -----

#1 UbadahJafry  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 28-June 13

Notepad

Posted 28 June 2013 - 03:50 AM

I am making a notepad in vb 10 . In which i have putted an font dialog but it changes the The whole Text in textbox .Code is
Font.showdialog ()
richtextbox1.color=font.color 
richtextbox1.font=font.font


I wanted to change the font and color of selected text
Is This A Good Question/Topic? 0
  • +

Replies To: Notepad

#2 DarenR  Icon User is online

  • D.I.C Lover

Reputation: 469
  • View blog
  • Posts: 3,197
  • Joined: 12-January 10

Re: Notepad

Posted 28 June 2013 - 04:58 AM

a)you need to show more of your code
b)be more specific
c)show your error
Was This Post Helpful? 0
  • +
  • -

#3 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: Notepad

Posted 28 June 2013 - 06:39 AM

View PostUbadahJafry, on 28 June 2013 - 04:50 AM, said:

I am making a notepad in vb 10 . In which i have putted an font dialog but it changes the The whole Text in textbox .Code is
Font.showdialog ()
richtextbox1.color=font.color 
richtextbox1.font=font.font


I wanted to change the font and color of selected text

Have a look at this DIC Tutorial for some ideas.

This post has been edited by lar3ry: 28 June 2013 - 06:42 AM

Was This Post Helpful? 0
  • +
  • -

#4 Luc001  Icon User is offline

  • D.I.C Addict

Reputation: 84
  • View blog
  • Posts: 617
  • Joined: 04-May 09

Re: Notepad

Posted 28 June 2013 - 08:17 AM

Hi,

Here's a small example with a Richtextbox caled rtxtEditor a Button and FontDialog1:

 Dim bUpdating As Boolean = False

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        'Try to preserve existing font settings if possible, if not then use default
        If Not rtxtEditor.SelectionFont Is Nothing Then
            FontDialog1.Font = New Font( _
                rtxtEditor.SelectionFont.Name, _
                rtxtEditor.SelectionFont.Size, _
                rtxtEditor.SelectionFont.Style _
                )
        Else
            'Reset defaults in case they've been modified earlier
            FontDialog1.Font = New Font( _
                "Arial", _
                10, _
                FontStyle.Regular _
                )
        End If

        If FontDialog1.ShowDialog = DialogResult.OK Then
            rtxtEditor.SelectionFont = FontDialog1.Font
            rtxtEditor_Selectionchanged(Me, e)
        End If
    End Sub

    Private Sub rtxtEditor_Selectionchanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rtxtEditor.Selectionchanged

        bUpdating = True
    End Sub


I hope it gives you an idee.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1