Hi there!
How can i bind between two forms ,the base form has a data set &
I want to bind this data to second form in a list box??
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Andrzej WegierskiRank #1,729 · 877 reputationPosted Sep 6, 2005, 2:34 AM EDT
Joue12 reputationPosted Sep 7, 2005, 8:58 PM EDT
I created a DataSet property ,as you said,in second form after i have
define dataset as public in first & I worte this statement in Load event
of second form:MyComboBox.DataSource=myDataSet1.Joue;
when debuging ,I found nothing in MyComboBox!!
Thanks again.
Joue12 reputationPosted Sep 7, 2005, 9:34 PM EDT
I tried another way but need help: I defined ComboBox as public in its form (second)
& in the first form I created an object(J) from second form & wrote this in suitable place:
J.MyComboBox.DataSource=myDataSet1.Joue;
J.ShowDialog();
After debuging I found this in comboBox:System.Data.DataRowView
So,what do you think?
Thanks
Andrzej WegierskiRank #1,729 · 877 reputationPosted Sep 7, 2005, 10:40 PM EDT
Joue12 reputationPosted Sep 8, 2005, 2:19 AM EDT
write it's values to array list or array an use array as source. ??
Forgive me ,I'm a beginner
Thanks
Andrzej WegierskiRank #1,729 · 877 reputationPosted Sep 9, 2005, 1:59 AM EDT
ArrayList myArray=new ArrayList(1);
foreach(DataRow dr in myTable.Rows)
{
myArray.Add(dr["myColumn"]);
}
myCombo.DataSource=myArray;
Not tested.
Joue12 reputationPosted Sep 10, 2005, 3:02 AM EDT
Thanks