Hello everyone,
im trying to to import a csv file. inside a form Gui combobox. the problem im encountering is dat i want for the combobox only show the first colomn (column A) . in the future i want another combobox and have only column b imported from the same file.
with the code i have it imports all filled rows and shows everthing. i tried different possibilities like get-content and played with -header -property and -expandproperty. but none of the methods works. off course i can make for every combobox a separate csv file, but that is not something i want.
this is a part of what i see inside the combobox to select:
@{abbreviation=; firstname=; secondname=; lastname =}
$cBox2 = New-Object "System.Windows.Forms.combobox";
$cbox2.Location = New-Object System.Drawing.Point(10,120)
$cbox2.Size = New-Object System.Drawing.Size(260,20)
$form.Controls.Add($cbox2)
import-csv -Path $file -Delimiter ";" -Header "firstname" | ForEach-Object {
$cBox2.Items.Add($_)
}
even tried with -select and -select-object, and tried different CSV files (with and without separated) but i cant figure it out. any help is appreciated
----EDIT----
did something good i get the column i want inside the box but now i says @{firstname=NAME}
if anyone know the answer before i figure out how to edit that to just the ‘NAME’ it is appreciated offcourse.