次の方法で共有


TextBox's in .Net

I'm trying to figure something out about this, and having a little trouble, so I figured  I'm make an entry about it.  Hopefully, I'll get lucky and someone who knows the answer will grace my blog with their presence.  ;)

So I have a form with a TextBox that I'm setting the Text property equal to the string return value of a method that builds a large string for me.  The text does get set perfectly and I have no problems with what the value is.  My problem is that it's always selected...the whole TextBox's string value is highlighted.  I would like for it not to be...

I've been trying to do TextBox.SelectedText = string.Empty;   and that didn't work.  I tried setting focus to the form and that didn't work...

I'll keep messing around, but if anyone can give me a pointer on this I'd be ever so grateful.  :)

Comments

  • Anonymous
    April 05, 2005
    As it turns out, I figured it out on my own. I had tried TextBox.Select(); which didn't work so I figured it couldn't hurt to try actually giving it a starting point and length, and that did the trick.

    TextBox.Select(0, 0);
  • Anonymous
    April 05, 2005
    Just a thought, but wouldn't it be better to put the cursor at the end of the text, like:

    textBox1.SelectionStart = textBox1.Text.Length;
  • Anonymous
    April 05, 2005
    I had thought about that, but since the TextBox in question is being used to display a list of addresses, I wanted it at the top. :)
  • Anonymous
    April 06, 2005
    Hey, I have a question for ya. Refering back to a post you made wat back here
    http://blogs.msdn.com/toffer/archive/2005/02/16/374642.aspx

    How you coming on your assembly. Hows the Book? can you give us a book review and any other sources. No one really talks assembly much anymore so I am curious how your doing, what you have found to be helpfull and so on.
  • Anonymous
    April 06, 2005
    Heya Jeff.

    The book wasn't too bad, although I must admit, I didn't make it all the way through it before the library asked for it back...

    It seemed to be setup more like a classroom textbook than anything else, I kept expecting for a professor to assign me homework, hehehe.

    I did get a better understanding of assembly but I'm still by no means an expert...and sadly assembly language seems to be one of those things that you loose if you don't use, if you catch my meaning.
  • Anonymous
    April 07, 2005
    Yep I know what you mean. I am still hoping to find a really good book on Assembly to keep around for reference but that just doesn't seem to be something out there.
  • Anonymous
    December 12, 2005
    Toffer? This wouldn't happen to be the Toffer that knows Craig McLaughlin? Anyways, if it is, your blog came up when I was searching for help on c++ textbox-> related issues.

    Cheers!

    Michael