Question about a TextBox with the MultiLine property set to True
-
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
-
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
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.
-
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
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 -
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.
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.
-
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, 2007trust 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.
-
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, 2007Dave 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
-
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.
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 -
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.
You could put a message box with the message "Your supervisor has been warned of your overuse of spaces" :)
-
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
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...
-
You could put a message box with the message "Your supervisor has been warned of your overuse of spaces" :)
-
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.
-
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, 2007hehehe 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
-
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...
-
blakey404 wrote:
And also why i hate contractors
Way to alienate people trying to help you.