It did thanks. I'm now trying to show the directory path of where the file is located on a separate textbox. For instance if the text file called test.txt for example was located on the C drive, the textbox would show "C:\test.txt" or something like that.
This is what I've got so far but text box (called $ScanDirBox) remains blank.
$Scanstate_Browse_Button.Add_Click({
$ScanFileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{ InitialDirectory = [Environment]::GetFolderPath('Desktop')
Filter = 'Text Document (*.txt)|*.txt'}
$null = $ScanFileBrowser.ShowDialog()
$ScanFileBrowser = Get-Content $ScanFileBrowser.FileName
$ScanFileBrowser | Set-Content -Path C:\USMTScript\scanstatemachines.txt
$Scanstate_Textbox.Text = Get-Content -Path "C:\USMTScript\scanstatemachines.txt"
$Scan_Path = get-content $ScanFileBrowser
$ScanDirBox.Text = "$Scan_Path"
$file_selection_window.controls.update()
})