Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- namespace loginform
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void label2_Click(object sender, EventArgs e)
- {
- }
- private void button1_Click(object sender, EventArgs e)
- {
- string a;
- char lett;
- bool maiusc=false;
- bool num = false;
- bool minusc=false;
- a = pasw.Text;
- if(a.Length<8)
- MessageBox.Show("troppo corto");
- for (int i = 0; i < a.Length; i++)
- {
- //lett = Convert.ToChar(a.Substring(i, 1));
- lett= a.ElementAt(i);
- if (lett >= 'A' && lett <= 'Z')
- maiusc = true;
- if (lett > 'a' && lett <= 'z')
- minusc = true;
- if (lett >= '0' && lett <= '9')
- num = true;
- }
- if (maiusc == true && minusc == true && num == true)
- MessageBox.Show("valida");
- if (maiusc == false && minusc == true && num == true)
- {
- lblcontrol.Visible = true;
- lblcontrol.ForeColor = Color.Red;
- lblcontrol.Text = "manca la maiuscola";
- }
- if (maiusc == true && minusc == false && num == true)
- {
- lblcontrol.Visible = true;
- lblcontrol.ForeColor = Color.Red;
- lblcontrol.Text = "manca la minuscola";
- }
- if (maiusc == true && minusc == true && num == false)
- {
- lblcontrol.Visible = true;
- lblcontrol.ForeColor = Color.Red;
- lblcontrol.Text = "manca il numero";
- }
- if (maiusc == false && minusc == false && num == true)
- {
- lblcontrol.Visible = true;
- lblcontrol.ForeColor = Color.Red;
- lblcontrol.Text = "manca la maiuscola e la minuscola";
- }
- if (maiusc == false && minusc == true && num == false)
- {
- lblcontrol.Visible = true;
- lblcontrol.ForeColor = Color.Red;
- lblcontrol.Text = "manca la maiuscola e il numero";
- }
- if (maiusc == true && minusc == false && num == false)
- {
- lblcontrol.Visible = true;
- lblcontrol.ForeColor = Color.Red;
- lblcontrol.Text = "manca la minuscola e il numero";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement