Ejemplo n.º 1
0
 private void btnFixLength_Click(object sender, EventArgs e)      //Generate a random string with given length
 {
     if (textBoxLength.Text.Trim() != "")
     {
         try
         {
             int length = Convert.ToInt32(textBoxLength.Text);
             if (length > 0)
             {
                 RandomStringRef.ServiceClient randomStr = new RandomStringRef.ServiceClient();
                 textBoxRandom.Text = randomStr.GetRandomString(textBoxLength.Text);
                 randomStr.Close();
             }
             else
             {
                 MessageBox.Show("Please enter a positive integer!");
             }
         }
         catch
         {
             MessageBox.Show("Please enter a positive integer!");
         }
     }
     else
     {
         MessageBox.Show("Please enter a positive integer!");
     }
 }
Ejemplo n.º 2
0
 private void btn4to20Char_Click(object sender, EventArgs e)     //Generate a random string with length 4 - 20
 {
     RandomStringRef.ServiceClient randomStr = new RandomStringRef.ServiceClient();
     random1Label.Text = randomStr.GetRandomString0();
     randomStr.Close();
 }