You can do it as follows:
// No clique de um botão, ou num outro evento que queira
private void button1_Click(object sender, System.EventArgs e)
{
// Remove as passwords que existirem na ListBox (caso as deseja manter remova a linha seguinte.
listBox1.Items.Clear();
// Loop ate ao numero seleccionado no numericupdown
for (int i = 0; i < numericUpDown1.Value; ++i)
{
// A cada iteraccao gere uma password nova
var password = //seu código de gerar passwords;
// Por fim adicione a nova password a ListBox.
listBox1.Items.Add(password);
}
}
The final result will be (using GUIDs
as passwords):
Edit:
Taking into account your specific case:
if(...)
{
}
else
{
CopyButton.Enabled = true;
SaveButton.Enabled = true;
// Modifique aqui para o seguinte codigo
listBox1.Items.Clear();
// Loop ate ao numero seleccionado no numericupdown
for (int i = 0; i < numericUpDown1.Value; ++i)
{
// A cada iteraccao gere uma password nova
var password = Generator.GetRandomPassword(Convert.ToInt32(PasswordLengthList.Value), GetStringTemplate());
// Por fim adicione a nova password a ListBox.
listBox1.Items.Add(password);
}
}
The way you currently have it printing the generated password for a textbox
. You have to add a listbox
and use the code above.
and what’s the problem?
– Marciano.Andrade
@Andrade the problem is that I don’t know the code to do this. I’ve looked, and I can’t find.
– Don Vito
use a combobox(dropdownlist I don’t know how you know it) with the number quantity, then you just check which quantity you choose and run the function n times.
– Marciano.Andrade
Amigo @Marciano.Andrade I know the Dropdownlist, but I don’t know what code I have to use. Can you help me?
– Don Vito
Okay, I can, I already have an answer.
– Marciano.Andrade
Thanks friend @Marciano.Andrade , I will be waiting.
– Don Vito