Pavle_nis

Random Generator form1

Oct 19th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 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.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApplication5
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. private void button1_Click(object sender, EventArgs e)
  21. {
  22. /* int[] numbers = new int[10] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
  23. char[] letters = new char[26] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
  24. for(int i = 0; i < 24; i++)
  25. {
  26.  
  27. }*/
  28. char[] letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_-".ToCharArray();
  29. Random r = new Random();
  30. string randomString = "";
  31. var random = new Random();
  32.  
  33. // for (int i = 0; i < letters.Length; i++)
  34. for (int i = 0; i < 24; i++)
  35. {
  36. randomString += letters[r.Next(0,74)].ToString();
  37. }
  38. textBox1.Text = randomString;
  39. }
  40.  
  41. private void Form1_Load(object sender, EventArgs e)
  42. {
  43.  
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment