You are viewing our Forum Archives. To view or take place in current topics click here.
Simple random 3 letter name generator
Posted:

Simple random 3 letter name generatorPosted:

I_Am_Superman
  • TTG Senior
Status: Offline
Joined: Dec 15, 201013Year Member
Posts: 1,472
Reputation Power: 82
Status: Offline
Joined: Dec 15, 201013Year Member
Posts: 1,472
Reputation Power: 82
I decided to make a simple project of making a TTG 3 letter username finder, unfortunately as I am not advanced enough I could not make it so that it checks the accounts to see if they already exist so I will post the source code and the visual basic 11 folder with all of the project for you all to look at.

Pictures

[ Register or Signin to view external links. ]
[ Register or Signin to view external links. ]
Saves them as a .txt file in the C:\ drive
[ Register or Signin to view external links. ]


Source code
Imports System.Net
Imports System.Text
Imports System.IO

Public Class Form1
    Dim W As IO.StreamWriter

    Public Function makepw() As Object
        Dim e, f, g, h, j As Object
        e = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789_-"
        f = Len(e)
        g = 3
        Randomize()
        h = ""
        For intstep = 1 To g
            j = Int((f * Rnd()) + 1)
            h = h & Mid(e, j, 1)
        Next
        makepw = h
    End Function

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim a As String
        While ListBox1.Items.Count < 100
            a = makepw()
            ListBox1.Items.Add(a)
        End While



    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim i As Integer
        W = New IO.StreamWriter("C:\" & sName.Text & ".txt")
        For i = 0 To ListBox1.Items.Count - 1
            W.WriteLine(ListBox1.Items.Item(i))
        Next
        If sName.Text = "" Then
            MessageBox.Show("Please enter a name")
        Else
            MessageBox.Show("You will be saving your list as " + (sName.Text))
            MessageBox.Show("please check your c:\ drive for the .txt file")
        End If
        W.Close()
    End Sub

    Private Sub SaveFileDialog1_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs)

        Dim FileToSaveAs As String = SaveFileDialog1.FileName

        Dim objwriter As New System.IO.StreamWriter(FileToSaveAs)
        objwriter.Write(ListBox1.Text)
        objwriter.Close()
    End Sub

End Class


Download the project.

[ Register or Signin to view external links. ]


Don't forget this was just a SMALL project so it's nothing amazing, I thought I would just share it with you guys considering it has no real aim.


Inb4 SPEED criticism... :trollin:
#2. Posted:
Bighair
  • Powerhouse
Status: Offline
Joined: Sep 26, 201013Year Member
Posts: 401
Reputation Power: 17
Status: Offline
Joined: Sep 26, 201013Year Member
Posts: 401
Reputation Power: 17
What does the randomize do in it?:|
#3. Posted:
I_Am_Superman
  • TTG Senior
Status: Offline
Joined: Dec 15, 201013Year Member
Posts: 1,472
Reputation Power: 82
Status: Offline
Joined: Dec 15, 201013Year Member
Posts: 1,472
Reputation Power: 82
Bighair wrote What does the randomize do in it?:|


Basically jumbles the 3 letter names up so they do nor come out like:
abc
def
ghi
jkl
mno
pqr
stu
vwx
yz1
yeah you get the picture
#4. Posted:
RDCA
  • TTG Contender
Status: Offline
Joined: Jul 12, 201013Year Member
Posts: 3,612
Reputation Power: 173
Status: Offline
Joined: Jul 12, 201013Year Member
Posts: 3,612
Reputation Power: 173
If you don't make a function then you shouldn't take credit for it, especially when it is the only one in your program......
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.