I am learning C# and im trying to create a random string(password) generator.. I feel like its fun because its not the simple Hello World application
I am doing this in a windows form application
I am trying to mix all the
public const string
and print it out to the TextBox2 in my project.. But the thing is I have no idea on how to actually mix them I was thinking about a for loop and check for every character.. Not really sure how I would do it..
Does anyone have any examples I could look over and try to understand how they are made? I saw one made with Linq here on SO but I couldnt really understand it because I am trying to involve check boxes
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace RandomCHaracterGenerator
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
class RandomPWDGenerator
{
public const string CapitilizedLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
public const string NonCapitilizedLetters = "abcdefghijklmnopqrstuvwxyz";
public const string Numbers = "0123456789z";
public const string SpecialCharacters = "!@#$%^*()_+";
private static Random rnd = new Random();
}
static void Main()
{
StringBuilder password = new StringBuilder();
for (int i = 1; i <= 2; i++)
{
}
}
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;
[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr hWnd,
int Msg, int wParam, int lParam);
[DllImportAttribute("user32.dll")]
public static extern bool ReleaseCapture();
private void label1_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void topPanel_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
}
}
private void generateLbl_MouseEnter(object sender, EventArgs e)
{
generatePanel.BackColor = System.Drawing.ColorTranslator.FromHtml("#4d4d4d");
}
private void generateLbl_MouseLeave(object sender, EventArgs e)
{
generatePanel.BackColor = Color.Transparent;
}
private void generateLbl_Click(object sender, EventArgs e)
{
}
}
}
Aucun commentaire:
Enregistrer un commentaire