Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Simple Random Password Generator

.: Random Password Generator :.

[Image: mDSTE02.png]


Scan VirusTotal

Download


Source Code :
Code
Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
      ComboBox1.SelectedItem = "1"
      ComboBox2.SelectedItem = "99"
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
      Dim Characters As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"
      Dim Result As String
      Dim Casual As New Random
      For i = 0 To Casual.Next(ComboBox1.SelectedItem, ComboBox2.SelectedItem)
      Result += Characters(Casual.Next(0, Characters.Length - 1))
      Next
      TextBox1.Text = Result

    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
      My.Computer.Clipboard.SetText(TextBox1.Text)
    End Sub
End Class
i post linq examples https://hackforums.net/showthread.php?ti...id44524804
I'm unsure as to what you're looking for from the community. This release isn't really worth releasing as an application in my opinion. However, I'm not going to hate on your project like everyone else probably will. Instead, I wanted to give you a few coding tips to make your application more efficient.

To start things off, I'd like to talk about your use of numbers in a ComboBox. From the looks of things, you manually typed each number from 1 to 99 into the Items property of both ComboBoxes. Instead of using ComboBoxes here, look into the NumericUpDown control. You won't need to type in all of your possible outcomes. You'll just need to set the minimum and maximum properties to whatever you'd like.

Keep in mind that every line of code takes time to complete. Therefore, it would be more efficient to declare your variables within your class scope. This way, you're not taking the time to redeclare a variable each time your buttons are clicked. Consider the same thing when initializing your variables (assigning them a value). For example, instead of assigning a value to Characters each time the button is clicked, just assign it a value on the Form_Load event. This way you only set the value once.

Your For loop is fine, but try using a StringBuilder instead of repeatedly adding characters to your string.

Hopefully this will help you to optimize your application as well as help you in future projects.

- Hawk
🤝
(Feb 8, 2015 06:40 PM)Hawk HF Wrote:  I'm unsure as to what you're looking for from the community. This release isn't really worth releasing as an application in my opinion. However, I'm not going to hate on your project like everyone else probably will. Instead, I wanted to give you a few coding tips to make your application more efficient.

To start things off, I'd like to talk about your use of numbers in a ComboBox. From the looks of things, you manually typed each number from 1 to 99 into the Items property of both ComboBoxes. Instead of using ComboBoxes here, look into the NumericUpDown control. You won't need to type in all of your possible outcomes. You'll just need to set the minimum and maximum properties to whatever you'd like.

Keep in mind that every line of code takes time to complete. Therefore, it would be more efficient to declare your variables within your class scope. This way, you're not taking the time to redeclare a variable each time your buttons are clicked. Consider the same thing when initializing your variables (assigning them a value). For example, instead of assigning a value to Characters each time the button is clicked, just assign it a value on the Form_Load event. This way you only set the value once.

Your For loop is fine, but try using a StringBuilder instead of repeatedly adding characters to your string.

Hopefully this will help you to optimize your application as well as help you in future projects.

- Hawk
🤝

Thank you very much for your constructive feedback.
(Feb 8, 2015 06:40 PM)Hawk HF Wrote:  I'm unsure as to what you're looking for from the community. This release isn't really worth releasing as an application in my opinion. However, I'm not going to hate on your project like everyone else probably will. Instead, I wanted to give you a few coding tips to make your application more efficient.

To start things off, I'd like to talk about your use of numbers in a ComboBox. From the looks of things, you manually typed each number from 1 to 99 into the Items property of both ComboBoxes. Instead of using ComboBoxes here, look into the NumericUpDown control. You won't need to type in all of your possible outcomes. You'll just need to set the minimum and maximum properties to whatever you'd like.

Keep in mind that every line of code takes time to complete. Therefore, it would be more efficient to declare your variables within your class scope. This way, you're not taking the time to redeclare a variable each time your buttons are clicked. Consider the same thing when initializing your variables (assigning them a value). For example, instead of assigning a value to Characters each time the button is clicked, just assign it a value on the Form_Load event. This way you only set the value once.

Your For loop is fine, but try using a StringBuilder instead of repeatedly adding characters to your string.

Hopefully this will help you to optimize your application as well as help you in future projects.

- Hawk
🤝

Wouldn't it be better to make Characters a constant?


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by GREGORYNov 26, 2019 07:02 AM 2 241 Nov 26, 2019 07:02 AM
Last Post: Kallu609
[.NET] by VENIAug 5, 2018 03:02 AM 7 297 Aug 5, 2018 03:02 AM
Last Post: Earn
[Java] by WubixApr 3, 2018 07:20 AM 3 248 Apr 3, 2018 07:20 AM
Last Post: matt