Multiple textbox; how to select the right textbox?

by Apr 24, 2020

Hello,
I'm looking for help with my textboxes.

I manage to create them a certain number according to a variable, but I cannot select or retrieve the value of this or that texbox.

ex:

once my textboxes are created, they are in deactivated mode; I want the first to be active in order to write in it and the next to activate in turn as soon as in the previous textbox I have at least 5 characters present.

Thank you in advance for your assistance.

LL

#region createtextbox
$u = 1
$u1 = 30
$nbuser = 10
#######
for ($u = 0; $u -lt $nbuser; $u++)
{
	$textboxuser = New-Object System.Windows.Forms.TextBox
	$textboxuser.Location = New-Object System.Drawing.Size(16, $u1);
	$textboxuser.Name = '$textboxuser' + $u;
	$textboxuser.Text = $textboxuser.name;
	$textboxuser.Size = New-Object System.Drawing.Size (200, 20);
	$textboxuser.Enabled = $false;
	$u1 = $u1 + 30
	$gbUSER.Controls.Add($textboxuser);
}



#FirstTEXTBOX..
##??????????????????????
$u = 1
#I want the fisrt textbox...
$textboxuser.Enabled= $true

#endregion SuivantversONGLET



#region ONGLET
$u = 1
$textboxuser_TextChanged = {
	$u++
	$textboxuser = '$textboxuser'+$u
	$textboxuser.Enabled = $true
}



#endregion createtextbox


#region WRITETEXTBOX


#endregion WRITETEXTBOX