Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Properties of RichTextBox at Runtime

Properties of RichTextBox at Runtime

Scheduled Pinned Locked Moved Visual Basic
questionhelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pdnet
    wrote on last edited by
    #1

    Hi, I am using a Richtextbox at runtime. and the Control added at runtime But I face a Problem, The RichTextBox Data is Edited or Selected. I am Using ReadOnly=true so that the Edit Mode is Off but Text is still Selecting. If I am take Enabled=false then The Backcolor will be changed. So, How can I a Lock this Control at run Time ? dim rtf01 as new Richtextbox rtf01.Visible = False Me.Controls.Remove(rtf01) Me.Controls.Add(rtf01) rtf01.BringToFront() rtf01.BackColor = Color.FromArgb(175, 175, 175) rtf01.BorderStyle = BorderStyle.None rtf01.Cursor = Cursors.Arrow rtf01.ReadOnly = True rtf01.ScrollBars = RichTextBoxScrollBars.None rtf01.Left = fgButton.Cols(1).Left + 10 rtf01.Top = fgButton.Top + 6 rtf01.Visible = true

    Arindam Banerjee Sr. Software Developer Rance Computer Pvt Ltd. Kolkata (India)

    P L 2 Replies Last reply
    0
    • P pdnet

      Hi, I am using a Richtextbox at runtime. and the Control added at runtime But I face a Problem, The RichTextBox Data is Edited or Selected. I am Using ReadOnly=true so that the Edit Mode is Off but Text is still Selecting. If I am take Enabled=false then The Backcolor will be changed. So, How can I a Lock this Control at run Time ? dim rtf01 as new Richtextbox rtf01.Visible = False Me.Controls.Remove(rtf01) Me.Controls.Add(rtf01) rtf01.BringToFront() rtf01.BackColor = Color.FromArgb(175, 175, 175) rtf01.BorderStyle = BorderStyle.None rtf01.Cursor = Cursors.Arrow rtf01.ReadOnly = True rtf01.ScrollBars = RichTextBoxScrollBars.None rtf01.Left = fgButton.Cols(1).Left + 10 rtf01.Top = fgButton.Top + 6 rtf01.Visible = true

      Arindam Banerjee Sr. Software Developer Rance Computer Pvt Ltd. Kolkata (India)

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #2

      Why not just have it be readonly? Any reason you do not want to allow user to select text?

      "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

      P 1 Reply Last reply
      0
      • P Paul Conrad

        Why not just have it be readonly? Any reason you do not want to allow user to select text?

        "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

        P Offline
        P Offline
        pdnet
        wrote on last edited by
        #3

        Yes I want that the User only click on the Richtextbox, and I'm doing somthing of its click. But When it click the Richtextbox edited.

        Arindam Banerjee Sr. Software Developer Rance Computer Pvt Ltd. Kolkata (India)

        P 1 Reply Last reply
        0
        • P pdnet

          Hi, I am using a Richtextbox at runtime. and the Control added at runtime But I face a Problem, The RichTextBox Data is Edited or Selected. I am Using ReadOnly=true so that the Edit Mode is Off but Text is still Selecting. If I am take Enabled=false then The Backcolor will be changed. So, How can I a Lock this Control at run Time ? dim rtf01 as new Richtextbox rtf01.Visible = False Me.Controls.Remove(rtf01) Me.Controls.Add(rtf01) rtf01.BringToFront() rtf01.BackColor = Color.FromArgb(175, 175, 175) rtf01.BorderStyle = BorderStyle.None rtf01.Cursor = Cursors.Arrow rtf01.ReadOnly = True rtf01.ScrollBars = RichTextBoxScrollBars.None rtf01.Left = fgButton.Cols(1).Left + 10 rtf01.Top = fgButton.Top + 6 rtf01.Visible = true

          Arindam Banerjee Sr. Software Developer Rance Computer Pvt Ltd. Kolkata (India)

          L Offline
          L Offline
          LeandroABorges
          wrote on last edited by
          #4

          In the end of your code:

          AddHandler rtf01.SelectionChanged, AddressOf RichTextBox_SelectionChanged

          And then create this method:

          Private Sub RichTextBox_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
          sender.DeselectAll()
          End Sub

          That´s it??

          ----- LeandroAB

          1 Reply Last reply
          0
          • P pdnet

            Yes I want that the User only click on the Richtextbox, and I'm doing somthing of its click. But When it click the Richtextbox edited.

            Arindam Banerjee Sr. Software Developer Rance Computer Pvt Ltd. Kolkata (India)

            P Offline
            P Offline
            Paul Conrad
            wrote on last edited by
            #5

            You could always try using the KeyPress event handler, and in the event handler have something like e.Handled=true. That will force it to ignore all key presses.

            "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups