Stuck With Binding Source

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 1 year and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
Woody_033
Posts: 111
Last visit: Mon Apr 15, 2024 3:21 am
Been upvoted: 1 time

Stuck With Binding Source

Post by Woody_033 »

In global, I have defined my DataTable

Code: Select all

$MyDataTable = New-Object System.Data.DataTable
$MyDataTable.Columns.Add('ArtistName',[string])
$MyDataTable.Columns.Add('ArtistID',[string])
Under my API request I add the data

Code: Select all

$NR = $MyDataTable.NewRow()
$NR['ArtistName'] = $R.Name
$NR['ArtistID'] = $R.id
$MyDataTable.Rows.Add($NR)
In My Form Load I added my DataTable to my BindingSource

Code: Select all

$SearchandDiscovery_Load={
	UpdateNavButtons
	$MyBindingSource.DataSource = $MyDataTable
	
}
I can look up the information and transfer it to my $MyBindingSource

Code: Select all

$buttonLookup_Click={
	Request-ArtistInfo -Artist $ListOfArtists.SelectedItem.ToString()
	$MyBindingSource.DataSource = $MyDataTable
}
But I cannot figure out how to add my DataSource...
Empty DataSource
Empty DataSource
Untitled.png (3.31 KiB) Viewed 655 times
The Combo box shows my MyBindingSource... but that is it
It's there but its not...
Combo Box
Combo Box
Untitled.png (18.95 KiB) Viewed 655 times
If I try to look at the items Collection, I get this error, but as fare as I know, I have done this.. but maybe not in the right spot?
Advance Properties
Advance Properties
Untitled.jpg (111.64 KiB) Viewed 655 times
Any help would be guidance would be greatly appreciated
Wøødy
Face piles of trials with smiles and coffee :D
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Stuck With Binding Source

Post by jvierra »

You can't. Sapien has never added support for that capability.

This is how to add a DataTable to a ComboBox

$
  1. MyDataTable = New-Object System.Data.DataTable
  2. $MyDataTable.Columns.Add('ArtistName', [string])
  3. $MyDataTable.Columns.Add('ArtistID', [string])
  4. $combobox1.DataSource = $MyDataTable
  5. $combobox1.DataMember = 'ArtistName'
This topic is 1 year and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked