Guest User

Untitled

a guest
Jun 16th, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace Generator
  11. {
  12. public partial class Generator : Form
  13. {
  14. public Generator()
  15. {
  16. InitializeComponent();
  17. }
  18.  
  19. private void button1_Click(object sender, EventArgs e)
  20. {
  21. timer1.Start();
  22. if ((progressBar1.Value == 100))
  23. {
  24. timer1.Stop();
  25. progressBar1.Value = 0;
  26. textBox1.Text = "";
  27. timer1.Start();
  28. }
  29.  
  30. }
  31.  
  32. private void timer1_Tick(object sender, EventArgs e)
  33. {
  34. progressBar1.Increment(1);
  35. if ((progressBar1.Value == 100))
  36. {
  37. timer1.Stop();
  38. Random random = new Random();
  39. textBox1.Text = "" + (char)random.Next(65, 90) + (char)random.Next(65, 90) + (char)random.Next(65, 90) + random.Next(0, 9) + "-" + random.Next(0, 9) + (char)random.Next(65, 90) + (char)random.Next(65, 90) + random.Next(0, 9) + "-" + (char)random.Next(65, 90) + random.Next(0, 9) + (char)random.Next(65, 90) + random.Next(0, 9) + "-" + (char)random.Next(65, 90) + random.Next(0, 9) + (char)random.Next(65, 90) + random.Next(0, 9) + "-" + (char)random.Next(65, 90) + random.Next(0, 9) + (char)random.Next(65, 90) + random.Next(0, 9);
  40. }
  41. }
  42.  
  43.  
  44. private void textBox1_TextChanged(object sender, EventArgs e)
  45. {
  46. textBox1.TextAlign = HorizontalAlignment.Center;
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment