53 lines
1.5 KiB
PowerShell
53 lines
1.5 KiB
PowerShell
Add-Type -AssemblyName System.Windows.Forms
|
|
[System.Windows.Forms.Application]::EnableVisualStyles()
|
|
|
|
$Form = New-Object system.Windows.Forms.Form
|
|
$Form.ClientSize = '686,420'
|
|
$Form.text = "Form"
|
|
$Form.TopMost = $false
|
|
|
|
$DataGridView1 = New-Object system.Windows.Forms.DataGridView
|
|
$DataGridView1.width = 454
|
|
$DataGridView1.height = 377
|
|
$DataGridView1.location = New-Object System.Drawing.Point(208,18)
|
|
|
|
$Button1 = New-Object system.Windows.Forms.Button
|
|
$Button1.text = "Datei einlesen"
|
|
$Button1.width = 176
|
|
$Button1.height = 376
|
|
$Button1.location = New-Object System.Drawing.Point(22,18)
|
|
$Button1.Font = 'Microsoft Sans Serif,10'
|
|
|
|
$Form.controls.AddRange(@($DataGridView1,$Button1))
|
|
|
|
$Column1 = New-Object System.Windows.Forms.DataGridViewTextboxColumn
|
|
$Column2 = New-Object System.Windows.Forms.DataGridViewTextboxColumn
|
|
$Column3 = New-Object System.Windows.Forms.DataGridViewTextboxColumn
|
|
$Column1.Width = 128
|
|
$Column2.Width = 128
|
|
$Column3.Width = 128
|
|
|
|
$Column1.Name = 'Kundennummer'
|
|
$Column2.Name = 'Vorname'
|
|
$Column3.Name = 'Nachname'
|
|
$DataGridView1.Columns.Add($Column1)
|
|
$DataGridView1.Columns.Add($Column2)
|
|
$DataGridView1.Columns.Add($Column3)
|
|
|
|
$Form.Controls.AddRange(($DataGridView1))
|
|
|
|
$Button1.add_click(
|
|
{
|
|
$DataGridView1.Rows.Clear()
|
|
$file = Get-Content -Path "kunden.txt"
|
|
foreach ($line in $file)
|
|
{
|
|
$num = $line.split(";")[0]
|
|
$vname = $line.split(";")[1]
|
|
$nname = $line.split(";")[2]
|
|
$DataGridView1.Rows.Add($num,$vname,$nname)
|
|
}
|
|
})
|
|
|
|
Clear-Host
|
|
$Form.ShowDialog() |