C# Tutorials : Create Simple Random Password Generator

C# tutorials for beginner : How to create simple application Random String Password Generator from a string using C sharp programming language.

C# for Beginner : How to create simple application Password Generator with Random string in C# programming language. This application can make an strong password for user create with random strings. We will create a Function to make random string, and this function will called from a button and a password will be show on the textBox.

Please Read :
  1. How to create String Random A-Z 0-9 with C#
  2. How to CRUD Operations Insert,Update,Delete with MySQL Database

Create New Project (Password Generator)

Just open your visual studio and create new project "Password Generator" and at the Form1.Cs just add two label, TrackBar, Button and TextBox, then design it look like this picture :


After your Form1.cs have done, we will create some line code.

Source code Random Password Generator.


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 PasswordRandomGenerator {
    public partial class Form1 : Form {
        int PassLength = 0;
        public Form1() {
            InitializeComponent();
        }
        //Create Functions to returns a string parameter with all the characters' position changed.
        static string Random(string Input) {
            var q = from c in Input.ToCharArray()
                    orderby Guid.NewGuid()
                    select c;
            string s = string.Empty;
            foreach (var r in q)
                s += r;
            return s;
        }
        private void button1_Click(object sender, EventArgs e) {
            textBox1.Text = "";
            string txt = "aAbBcCdDeEfFgGhHiIjJhHkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ01234567890123456789,;:!*$@-_=,;:!*$@-_=";
            // call the random function
            txt = Random(txt);
            //cut the string size according to the chosen trackbar value.
            txt = txt.Remove(PassLength);
            textBox1.Text = txt;
        }
        private void trackBar1_ValueChanged(object sender, EventArgs e) {
            //trackbar value starts from 0, so I add +1 to make it understandable;
            PassLength = trackBar1.Value + 1;
            label2.Text = PassLength.ToString();
        }
    }
}

Video Tutorial How to create Simple Random Password Generator




Download Full Source Code Simple Random Password Generator

COMMENTS

Next Recomended


Feel free to code it up and send us a pull request.

Hi everyone, let's me know how much this lesson can help your work. Please Subscribe and Follow Our Social Media 'kodeajaib[dot]com' to get Latest tutorials and will be send to your email everyday for free!, Just hit a comment if you have confused. Nice to meet you and Happy coding :) all ^^



Follow by E-Mail


Name

ADO.NET,3,Ajax,6,Android,9,AngularJS,4,ASP.NET,4,Blogger Tutorials,7,Bootstrap,7,C++,1,Codeigniter,2,Cplusplus,6,Crystal Report,6,CSharp,25,Ebook Java,2,FlyExam,1,FSharp,3,Game Development,2,Java,35,JDBC,2,Laravel,84,Lumen,2,MariaDB,2,Ms Access,3,MySQL,31,ODBC,6,OleDB,1,PHP,14,PHP Framework,5,PHP MYSQLI,9,PHP OOP,5,Python,8,Python 3,4,SQL Server,4,SQLite,4,Uncategorized,5,Vb 6,2,Vb.Net,89,Video,48,Vue Js,4,WPF,2,Yii,3,
ltr
item
KODE AJAIB: C# Tutorials : Create Simple Random Password Generator
C# Tutorials : Create Simple Random Password Generator
C# tutorials for beginner : How to create simple application Random String Password Generator from a string using C sharp programming language.
https://1.bp.blogspot.com/-M3Yyc8PFytY/V6OJ4fbUcHI/AAAAAAAACM4/Ed0stKj6pH8pSl1D3yAratVOD2bBt4WUACLcB/s320/C%2523-Password-Generator-1.png
https://1.bp.blogspot.com/-M3Yyc8PFytY/V6OJ4fbUcHI/AAAAAAAACM4/Ed0stKj6pH8pSl1D3yAratVOD2bBt4WUACLcB/s72-c/C%2523-Password-Generator-1.png
KODE AJAIB
https://www.kodeajaib.com/2016/08/c-tutorials-create-random-password-generator.html
https://www.kodeajaib.com/
https://www.kodeajaib.com/
https://www.kodeajaib.com/2016/08/c-tutorials-create-random-password-generator.html
true
3214704946184383982
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy