How Do I combine FirstName and LastName for LogonName in powershell Pro Tools?

I am using visual code with PowerShell pro tools, and I am trying to code a Windows Form using powershell and I am having trouble combing the FirstName and Lastname for the Log on name, I am fairly new to powershell pro. Below is what I have coded.

function New-ADUser {
param ([String]$FirstName, [String]$Lastname, [String]$logonname = "$FirstName.$LastName")

And this is what turns out when I generate WinForm in Powershell Pro

 Add-Type -AssemblyName System.Windows.Forms
$btn_Click = {
	New-ADUser -FirstName $txtFirstName.Text -Lastname $txtLastname.Text -logonname $txtlogonname.Text 
. 'c:\scripts\ADUSERWinform.form.designer.ps1'

Is there a way or a command that stops the user from inputting information into LogonName box, and When user enter there firstname and Lastname the Logonname box will be (Firstname .Lastname)

Hi @DBrown2020 and welcome to the Ironman forums!

You should be able to add a “onchange” event to either of the text-fields, in order to populate the logonname field.

You should also be able to disable the logonname field for editing.

Which editor are you using?