Results 1 to 7 of 7

Thread: [Resolved]what if the textBox is empty? - Truncating white spaces...

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2004
    Location
    Sydney
    Posts
    51

    [Resolved]what if the textBox is empty? - Truncating white spaces...

    Not anymore.
    Iam trying to truncate the leading and trailing white spaces in a text box.How do I do it.
    I am trying this piece of code,

    string myStr = textBox1.Text;
    for (int i=0; i<myStr.Length; i++)
    {
    if (myStr[i]='(')
    {
    myStr[0]=myStr[i];
    }
    }
    textBox1.Text=myStr;

    In this piece of code,
    My text starts with ( and ends with ), so Iam checking if the first character is a ( and trying to reset the index of the array to the current position.
    But I get the following errors saying
    ->Cannot implicitly convert type 'char' to 'bool'
    ->Property or indexer 'string.this[int]' cannot be assigned to -- it is read only
    please help
    Last edited by cybertechno; May 10th, 2005 at 01:20 AM. Reason: Resolved

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