I'm a Pascal newbie and I already read some stuff about it, but it is still pretty hard for me. I want to create a simple password generator, and adjust the number of characters.
I found a function that actually generates the random password for me, which is this:
function RandomPassword(PLen: Integer): string;
//string with all possible chars
str := 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
Result := '';
Result := Result + str[Random(Length(str)) + 1];
until (Length(Result) = PLen)
procedure TForm1.Button2Click(Sender: TObject);
Memo1.Caption := RandomPassword(10);
You can select the combobox value like this:
ComboBox.ItemIndex returns the index of select combobox item
ComboBox.Items is used to select a item in the combobox.
StrToInt() is used cause the combobox value is a string and you have to change it to integer