user1867155
user1867155

Reputation: 3

C# Regex in textbox just show "..."?

        string input = "href http://www.url.com/news/world/391370/abc/abc/abc.htm"; // input
        Match match = Regex.Match(input, @"/([a-z0-9\-].+)", RegexOptions.IgnoreCase); // pattern
        if (match.Success)
        {
            string key = match.Groups[1].Value;
            Console.WriteLine(key);
        }

output

" http://www.url.com/news/world/391370/abc/abc/abc.htm " it is work.!!

But in winForm textbox

       private void button1_Click(object sender, EventArgs e)
      {
        string tb1 = Convert.ToString(textBox1);       // input
        string tb2 = Convert.ToString(textBox2);  // output
        Match match = Regex.Match(tb1, @"/([a-z0-9].+)", RegexOptions.IgnoreCase);
        if (match.Success)
        {
            string key = match.Groups[1].Value;
           textBox2.Text = key.ToString();
        }

Output

"www.url.com/news/world/391370/abc..." <--- textbox cant show full result just display "..." instead , why ? Please help.

Upvotes: 0

Views: 1496

Answers (1)

Nevyn
Nevyn

Reputation: 2683

Your textbox is physically not long enough to display all the data, the entire string. you need to go to the form and make the textbox larger. There are other properties of the textbox that you can use as well, which will prevent the ... from appearing, including an "auto-size" property.

Upvotes: 1

Related Questions