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. VB.NET Multiline Textbox

VB.NET Multiline Textbox

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasequestion
3 Posts 2 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.
  • A Offline
    A Offline
    ashamsa
    wrote on last edited by
    #1

    I have a multiline text box on a form in a windows application.If some portion of teh text appears inside a tag like this ,#some text#.Then I want to make that portion of the text non editable.Can i implement this.How do i go about this.Later I want to replace the text between the pound symbol with data from a database while printing a report.So I don't want the user to edit the text inside the tag.These tags will be inserted from a list of values.The user should be able to edit the remaining part of the text box.These tags can come anywhere inside the text box and more than once.

    B 1 Reply Last reply
    0
    • A ashamsa

      I have a multiline text box on a form in a windows application.If some portion of teh text appears inside a tag like this ,#some text#.Then I want to make that portion of the text non editable.Can i implement this.How do i go about this.Later I want to replace the text between the pound symbol with data from a database while printing a report.So I don't want the user to edit the text inside the tag.These tags will be inserted from a list of values.The user should be able to edit the remaining part of the text box.These tags can come anywhere inside the text box and more than once.

      B Offline
      B Offline
      Brett Peirce
      wrote on last edited by
      #2

      Though it is probably not the best way to do it, this is probably what I would do: I would set the form's KeyPreview Property to true, making the form's KeyUp, KeyPress, and KeyDown Events (and whatever sub(s) you may have to handle them) get a crack at what the user pressed before the textbox would. If you did this, then you would then write some algorithm to determine whether the character that the user pressed (if it was entered at the cursor or in place of any selected text) would cause one of your tags to change. If it would, then you absorb the keystroke by setting the KeyPressEvents.Handled Property of "e" and then do nothing else. If I'm right, and of course if you can figure out that algorithm, then the effect should be an un-alterable "tag" in the middle (or any other part) of the text box control I do wonder: What if someone accidentally inserts an incorrect tag (like #dog# where it should be #one if by land, two if by sea#)"? Do you have an erase function? If you do have that algorithm working, maybe you could use part of it to select tags when you double click (or even single click) on the text box; then have a button to delete the tag. As for a mostly different approach, you could have buttons (or whatever) to insert the tags, and let the users edit them to their heart's content. However, when the user submits the text for processing, have an algorithm go through and correct simple mistakes in the tags and/or point out invalid tags, giving the user a chance to cancel their submission, or change the tags at that time ("Spell-Check" Style - but with tags) Oh Yeah - Good Luck P.S.: Feel free to mention me in the about box if you feel my contribution was valuable - and, uh... any checks in the mail would be welcome too :laugh:


      sincerely, Brett Peirce - PolerBear To err is human; To forgive: divine.

      A 1 Reply Last reply
      0
      • B Brett Peirce

        Though it is probably not the best way to do it, this is probably what I would do: I would set the form's KeyPreview Property to true, making the form's KeyUp, KeyPress, and KeyDown Events (and whatever sub(s) you may have to handle them) get a crack at what the user pressed before the textbox would. If you did this, then you would then write some algorithm to determine whether the character that the user pressed (if it was entered at the cursor or in place of any selected text) would cause one of your tags to change. If it would, then you absorb the keystroke by setting the KeyPressEvents.Handled Property of "e" and then do nothing else. If I'm right, and of course if you can figure out that algorithm, then the effect should be an un-alterable "tag" in the middle (or any other part) of the text box control I do wonder: What if someone accidentally inserts an incorrect tag (like #dog# where it should be #one if by land, two if by sea#)"? Do you have an erase function? If you do have that algorithm working, maybe you could use part of it to select tags when you double click (or even single click) on the text box; then have a button to delete the tag. As for a mostly different approach, you could have buttons (or whatever) to insert the tags, and let the users edit them to their heart's content. However, when the user submits the text for processing, have an algorithm go through and correct simple mistakes in the tags and/or point out invalid tags, giving the user a chance to cancel their submission, or change the tags at that time ("Spell-Check" Style - but with tags) Oh Yeah - Good Luck P.S.: Feel free to mention me in the about box if you feel my contribution was valuable - and, uh... any checks in the mail would be welcome too :laugh:


        sincerely, Brett Peirce - PolerBear To err is human; To forgive: divine.

        A Offline
        A Offline
        ashamsa
        wrote on last edited by
        #3

        Thanx for your womderful help.I think I should go by the second approach.Gonna start working on that.Thanx once again for the wonderful idea.:):rose:

        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