CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 43

Threaded View

  1. #16
    Join Date
    Feb 2007
    Location
    Craiova, Romania
    Posts
    326

    Re: Best way to check if a string is empty

    Quote Originally Posted by dee-u View Post
    Sorry for hijacking this thread but I just need a little more clarification.

    For instance I have a Textbox that is used to input a Last Name that goes to a specific field in a table. A user pressed the Space key in the keyboard for that Textbox. If I need to store in a string the value of that textbox then how should I proceed?
    In this case it is ok to do:
    string s = textBox.Text.Trim();
    Code:
    if(String.IsNullOrEmpty(s)
    {
     //use the value
    }
    since the text box cannot have a null text.
    Last edited by marceln; December 29th, 2008 at 06:35 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured