How to make a Password Generator

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
9 posts Page 1 of 1
Contributors
User avatar
splitedchill
VIP - Donator
VIP - Donator
Posts: 8
Joined: Thu Apr 15, 2010 4:09 pm

Hello and Welcome to my first Tutorial

First I'm apologize for my bad English an now we beginning with my first tutorial:


We make in my first tutorial a Password Generator with 2 functions the first Function is a password generation with no special character the 2'nd with special character.


First we make a new Project i named it Password Generator

Now we make a Form with this Tools

1 Textbox
1 Button
1 Checkbox

Now we coming to the code. To make the Password we make two Functions the first Functions is the code without special character the 2'nd with special character.

First Functions
Code: Select all
Public Function GenerateCode() As Object
        Dim intRnd As Object
        Dim intStep As Object
        Dim strName As Object
        Dim intNameLength As Object
        Dim intLenght As Object
        Dim strInputString As Object

        strInputString = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

        intLenght = Len(strInputString)

        intNameLength = 10

        Randomize()

        strName = ""

        For intStep = 1 To intNameLength
            intRnd = Int((intLenght * Rnd()) + 1)

            strName = strName & Mid(strInputString, intRnd, 1)
        Next
        GenerateCode = strName
    End Function
Now come the Functions with special characters but you can copy the first code but you write some more characters here
Code: Select all
 strInputString = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
This is the code without special characters here are the code with:
Code: Select all
 strInputString = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"§$%&/()=?`-_.,;<>|°^"
You can make very more....

Here the special characters code in one:
Code: Select all
Public Function GenerateCodeSonder() As Object

        Dim intRnd As Object
        Dim intStep As Object
        Dim strName As Object
        Dim intNameLength As Object
        Dim intLenght As Object
        Dim strInputString As Object

        strInputString = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ§$%&/()=?"

        intLenght = Len(strInputString)

        intNameLength = 10

        Randomize()

        strName = ""

        For intStep = 1 To intNameLength
            intRnd = Int((intLenght * Rnd()) + 1)

            strName = strName & Mid(strInputString, intRnd, 1)
        Next
        GenerateCodeSonder = strName
    End Function
Now we have to Functions and now we can make a If query
Code: Select all
If Checkbox1.Checked Then
    Textbox1.Text = GenerateCodeSonder()
Else
    Textbox1.Text = GenerateCode()
End if

Now this was my first Tutorial here i hope you like this Tutorial please give me Feedback!
Last edited by splitedchill on Mon Sep 05, 2011 9:29 pm, edited 1 time in total.
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

You cant put an object as a string propertys index value. You should use = to set the value.
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: How to make a Password Generator
mandai
This code is valid and it will work as it is.
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

mandai wrote:
This code is valid and it will work as it is.
I cant remember when it became possible to use Textbox1.Text(Something) to set a.textboxs text
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: How to make a Password Generator
mandai
Right, that would be an incorrect usage example.
This would work:
Code: Select all
If Checkbox1.Checked Then
    Textbox1.Text = GenerateCodeSonder()
Else
    Textbox1.Text = GenerateCode()
End if
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

This is very useful, congrats on your first tut :D
User avatar
splitedchill
VIP - Donator
VIP - Donator
Posts: 8
Joined: Thu Apr 15, 2010 4:09 pm

mandai wrote:
Right, that would be an incorrect usage example.
This would work:
Code: Select all
If Checkbox1.Checked Then
    Textbox1.Text = GenerateCodeSonder()
Else
    Textbox1.Text = GenerateCode()
End if

Thanks for your correction!

I have change it!
User avatar
RonaldHarvey
Top Poster
Top Poster
Posts: 113
Joined: Tue Apr 05, 2011 2:32 pm

Good job my friend, I put it in my apps it works. cooll;
User avatar
gummybears
Just Registered
Just Registered
Posts: 1
Joined: Mon Sep 12, 2011 10:05 pm

Cool, you stole source code from Collin
9 posts Page 1 of 1
Return to “Tutorials”