Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. private void button1_Click(object sender, EventArgs e)
  2.         {
  3.             String string1;
  4.             String string2;
  5.             string1 = textBox1.Text;
  6.             string2 = textBox2.Text;
  7.            
  8.             int position = 0;
  9.             while (position != -1)
  10.             {
  11.                 position = string1.IndexOf(string2, position);
  12.             }
  13.             if (position != -1)
  14.             {
  15.                 position = position + 1;
  16.                 label1.Text = ("Antalet bokstäver=" + position);
  17.             }
  18.          
  19.            
  20.             if (string1.IndexOf(string2) == -1)
  21.  
  22.             { label1.Text = "Not Found";
  23.             }
  24.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement