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. C#
  4. Question about a TextBox with the MultiLine property set to True

Question about a TextBox with the MultiLine property set to True

Scheduled Pinned Locked Moved C#
questionhelptutorial
14 Posts 6 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.
  • B Offline
    B Offline
    blakey404
    wrote on last edited by
    #1

    I have a problem where i am using a TextBox with the MultiLine property set to true. This is for operators to enter an address, which is saved, and printed to a label. However... We've a problem were operators, who have the ability to always do the unexpected, are holding the space bar until the cursor gets to the next line in the textbox instead of using enter/return, which means the labels which are then printed are screwed (attempting to put the entire address on one line) Has anyone any ideas how to tackle this so the user can't use space bar to pad to the next row and have to use return? Thanks

    J D M 3 Replies Last reply
    0
    • B blakey404

      I have a problem where i am using a TextBox with the MultiLine property set to true. This is for operators to enter an address, which is saved, and printed to a label. However... We've a problem were operators, who have the ability to always do the unexpected, are holding the space bar until the cursor gets to the next line in the textbox instead of using enter/return, which means the labels which are then printed are screwed (attempting to put the entire address on one line) Has anyone any ideas how to tackle this so the user can't use space bar to pad to the next row and have to use return? Thanks

      J Offline
      J Offline
      J4amieC
      wrote on last edited by
      #2

      This sounds like a training issue rather than a technical one, however you could intercept each keypress and if it is a space character with a preceeding space character then you could remove 1 char from the end of the textbox - thus stopping the user from being able to enter multiple space chars.

      B 1 Reply Last reply
      0
      • B blakey404

        I have a problem where i am using a TextBox with the MultiLine property set to true. This is for operators to enter an address, which is saved, and printed to a label. However... We've a problem were operators, who have the ability to always do the unexpected, are holding the space bar until the cursor gets to the next line in the textbox instead of using enter/return, which means the labels which are then printed are screwed (attempting to put the entire address on one line) Has anyone any ideas how to tackle this so the user can't use space bar to pad to the next row and have to use return? Thanks

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        I agree with Jamie that it's primarily a training issue, but it's also one of validation. Before accepting the data as entered you should be scrubbing the text entered and looking for multiple spaces next to each other and various other irregulaties that would break your output. You should always be treating user input as if they're a bunch of demonic 2 years olds mashing the keyboard. Would you trust anything they enter?? Your code shouldn't trust it either...

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        B P 2 Replies Last reply
        0
        • J J4amieC

          This sounds like a training issue rather than a technical one, however you could intercept each keypress and if it is a space character with a preceeding space character then you could remove 1 char from the end of the textbox - thus stopping the user from being able to enter multiple space chars.

          B Offline
          B Offline
          blakey404
          wrote on last edited by
          #4

          Thanks for the response :) i would love it to be a training issue but they guys working on the packing benches in our warehouse arent exaclty IT literate. The idea is to just stop them doing anything other than what they should be doing! I've considered the keypress but thought there may be a better solution. I suppose i should know by now to always expect the unexpected.

          L 1 Reply Last reply
          0
          • D Dave Kreskowiak

            I agree with Jamie that it's primarily a training issue, but it's also one of validation. Before accepting the data as entered you should be scrubbing the text entered and looking for multiple spaces next to each other and various other irregulaties that would break your output. You should always be treating user input as if they're a bunch of demonic 2 years olds mashing the keyboard. Would you trust anything they enter?? Your code shouldn't trust it either...

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007

            B Offline
            B Offline
            blakey404
            wrote on last edited by
            #5

            trust me there are more checks on that address than there are at US customs on a flight from Colubia, but i'm not dealing entirely with my own system. i hate to interact with others. Its complicated. And also why i hate contractors. Overpaid and leaving me to clean up the mess.

            D J 2 Replies Last reply
            0
            • D Dave Kreskowiak

              I agree with Jamie that it's primarily a training issue, but it's also one of validation. Before accepting the data as entered you should be scrubbing the text entered and looking for multiple spaces next to each other and various other irregulaties that would break your output. You should always be treating user input as if they're a bunch of demonic 2 years olds mashing the keyboard. Would you trust anything they enter?? Your code shouldn't trust it either...

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007

              P Offline
              P Offline
              phannon86
              wrote on last edited by
              #6

              Dave Kreskowiak wrote:

              You should always be treating user input as if they're a bunch of demonic 2 years olds mashing the keyboard. Would you trust anything they enter?? Your code shouldn't trust it either...

              :laugh: Thats brilliant, and very true.

              He who makes a beast out of himself gets rid of the pain of being a man

              1 Reply Last reply
              0
              • B blakey404

                trust me there are more checks on that address than there are at US customs on a flight from Colubia, but i'm not dealing entirely with my own system. i hate to interact with others. Its complicated. And also why i hate contractors. Overpaid and leaving me to clean up the mess.

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                blakey404 wrote:

                there are more checks on that address than there are at US customs on a flight from Colubia

                Wanna bet?? Guess who I work for, as a contractor, who's grossly underpaid...

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007

                B 1 Reply Last reply
                0
                • B blakey404

                  Thanks for the response :) i would love it to be a training issue but they guys working on the packing benches in our warehouse arent exaclty IT literate. The idea is to just stop them doing anything other than what they should be doing! I've considered the keypress but thought there may be a better solution. I suppose i should know by now to always expect the unexpected.

                  L Offline
                  L Offline
                  Le centriste
                  wrote on last edited by
                  #8

                  You could put a message box with the message "Your supervisor has been warned of your overuse of spaces" :)

                  B 1 Reply Last reply
                  0
                  • B blakey404

                    I have a problem where i am using a TextBox with the MultiLine property set to true. This is for operators to enter an address, which is saved, and printed to a label. However... We've a problem were operators, who have the ability to always do the unexpected, are holding the space bar until the cursor gets to the next line in the textbox instead of using enter/return, which means the labels which are then printed are screwed (attempting to put the entire address on one line) Has anyone any ideas how to tackle this so the user can't use space bar to pad to the next row and have to use return? Thanks

                    M Offline
                    M Offline
                    mav northwind
                    wrote on last edited by
                    #9

                    Hi! I guess the easiest solution will be to turn off word wrapping. That way they can enter as many spaces as they like, they only get the TextBox to scroll horizontally once the right margin is reached and then (hopefully) they see the error in their ways. :)

                    Regards, mav -- Black holes are the places where God divided by 0...

                    B 1 Reply Last reply
                    0
                    • L Le centriste

                      You could put a message box with the message "Your supervisor has been warned of your overuse of spaces" :)

                      B Offline
                      B Offline
                      blakey404
                      wrote on last edited by
                      #10

                      :laugh: i like it or "GET OFF THAT SPACE BAR: REFER TO MANUAL" ;)

                      1 Reply Last reply
                      0
                      • B blakey404

                        trust me there are more checks on that address than there are at US customs on a flight from Colubia, but i'm not dealing entirely with my own system. i hate to interact with others. Its complicated. And also why i hate contractors. Overpaid and leaving me to clean up the mess.

                        J Offline
                        J Offline
                        J4amieC
                        wrote on last edited by
                        #11

                        blakey404 wrote:

                        And also why i hate contractors

                        Way to alienate people trying to help you.

                        B 1 Reply Last reply
                        0
                        • D Dave Kreskowiak

                          blakey404 wrote:

                          there are more checks on that address than there are at US customs on a flight from Colubia

                          Wanna bet?? Guess who I work for, as a contractor, who's grossly underpaid...

                          A guide to posting questions on CodeProject[^]
                          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                               2006, 2007

                          B Offline
                          B Offline
                          blakey404
                          wrote on last edited by
                          #12

                          hehehe to be honest it is a particular contractor i mean to aim my anger at, not all of you :-D and yes i do wanna bet, the whole despatch system is based on postcodes (UK) for validation to lots and lots of checks are done. its a simple fact that this is the manual override option which is required because the UK post office cannot release their updates (to address based on postcode) quick enough for us to rely on it completely. So there does need to be a manual override, it just needs to allow as much but also as little functionality as possible, if that makes sense. Cheers ;) Anthony

                          1 Reply Last reply
                          0
                          • M mav northwind

                            Hi! I guess the easiest solution will be to turn off word wrapping. That way they can enter as many spaces as they like, they only get the TextBox to scroll horizontally once the right margin is reached and then (hopefully) they see the error in their ways. :)

                            Regards, mav -- Black holes are the places where God divided by 0...

                            B Offline
                            B Offline
                            blakey404
                            wrote on last edited by
                            #13

                            i considered that to be honest and its currently looking like my favourite solution as they cannot get to the next line that way without using return :wtf:

                            1 Reply Last reply
                            0
                            • J J4amieC

                              blakey404 wrote:

                              And also why i hate contractors

                              Way to alienate people trying to help you.

                              B Offline
                              B Offline
                              blakey404
                              wrote on last edited by
                              #14

                              :laugh: grumpy contractor :laugh:

                              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