• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 316
  • Last Modified:

Modifying contents of a textbox

Hello, I've been searching a while for an answer to this question.  I have a textbox that is databound to data in a table.  When the user queries and returns data, the only way they can modify the contents of the textbox is to highlight the text within the textbox.  For example, I do a query and return "Data is valid".  I want to change the text to say "Data is not valid".  If i position my cursor after the is and start to type, nothing happens.  The only way for me to get the text inserted is to highlight from is on and then type the new text.  Is this normal?  The data isn't being inserted into the database yet so i'm not sure why this is doing this.  It happens if it's a richtextbox also.  Some of our data fields contain a lot of characters and my users are complaining about having to retype the entire contents of the textbox to just add a few characters.  I've checke the textbox length property and there is more than enough space to accomodate new text.

Thank you,

Adam
0
schealth
Asked:
schealth
1 Solution
 
SanclerCommented:
No, it's not normal - at least in the sense of not occurring with default settings in a test I've just done in a VB.NET 2003 app.  I don't think VB.NET 2005 is any different, but I haven't checked that.

Have you got any code in the text box's TextChanged event sub (for instance) which might be causing it?

Or the other thing I can think of is that the string in the textbox is longer than it looks because it is already right padded with spaces to the maximum length that the text box will allow.  When you "checked the textbox length property and there is more than enough space to accomodate new text" did you check the length of the string that was currently in TextBox.Text?  Or just the length of the string that you could actually see: that is, up to the end of the last non-space character?

Roger
0
 
schealthAuthor Commented:
Thank you!  I'm banging my head against the wall because I never thought to check to see if it was padding spaces after the text (which is was).

Thanks for the quick response

Adam
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now