Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What is the typical way?
Message
De
10/02/2003 13:16:22
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00751194
Message ID:
00751524
Vues:
13
Ahmad,

Try binding to 'SelectedValue" rather than 'SelectedIndex'.

~~Bonnie


>Oh, yah, I got your point, but my problem I can't use the .SelectedIndex more that one in the form using databin, it gives me an error. see this what I did:
>
>' ComboBox Datasource
>Me.cbNationality.DataSource = myDS.Tables("Nat")
>Me.cbNationality.DisplayMember = "Nationality_e"
>
>' Then Binding CB to the other table "Members"
>Me.cbNationality.DataBindings.Add("SelectedIndex", myDS.Tables("Member"), "Nationality")
>
>Error:
>Additional information: Specified argument was out of the range of valid values.
>
>
>
>
>>Ahmad,
>>
>>>>So, how databinding will know that value "3" in "Nationality" filed in "Members" table belongs to value "3" in "Code" PK field & "Nat_Name" field in "Nationality" table ?
>>
>>Why? Because, that's how ComboBoxes work!! You're binding to the column in the "Members" table that has the code in it, and the DataSource for your ComboBox is the "Nationality" table. Am I missing something or are you?
>>
>>~~Bonnie
>>
>>
>>>How are u Bonnie...
>>>
>>>Neither !!!
>>>So, how databinding will know that value "3" in "Nationality" filed in "Members" table belongs to value "3" in "Code" PK field & "Nat_Name" field in "Nationality" table ?
>>>
>>>What forces the "Nationality" DataSet to skip to that row ?!!
>>>
>>>Thanks again....
>>>
>>>
>>>>Ahmad,
>>>>
>>>>>>Should I make a DataRelation between 2 tables, OR
>>>>>>Use .Find method every time the user clickes “Next” or “Back” button to display member information?
>>>>
>>>>Neither ... all you have to do is data bind your ComboBox to the "code" column in the "members" table.
>>>>
>>>>~~Bonnie
>>>>
>>>>
>>>>
>>>>>Dear All,
>>>>>
>>>>>I have window form displays all members basic information, & members data saved to members table, One of these information is for member nationality (as a ComboBox in the form).
>>>>>
>>>>>Nationality list are in a separate table with only “nationality” and “Code” fields & “Code” as PK.
>>>>>
>>>>>In members table only nationality “Code” is stored.
>>>>>
>>>>>Now, when I display the members data, nationality combobox should point to the correct code in the nationality table.
>>>>>
>>>>>Should I make a DataRelation between 2 tables, OR
>>>>>Use .Find method every time the user clickes “Next” or “Back” button to display member information?
>>>>>
>>>>>Note:
>>>>>I have 5 combobox’s in the member form uses the above method of displaying the data based on master tables.
>>>>>
>>>>>Thanks for the advice.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform