Click here to Skip to main content
15,894,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey!

I'm a fairly new coder so excuse me if this is a really dumb question.

I have a comboBox and have populated it with a table from my database. Now I want to have the script grab the PKey column from that table and save it as an object (or something) so I can reuse it for another table. What would be the way to do it?

What I have tried:

I've tried a few of the things I found online, though none seemed to help me with my problem :x
Posted
Updated 18-Apr-18 2:14am
Comments
Richard MacCutchan 17-Apr-18 10:35am    
The SelectedItem of the combobox should tell you which data row the user is referring to. So given that information you can extract the relevant column value(s).

1 solution

 ComboControl.DataTextField = "TextField";
ComboControl.DataValueField = "ValueField";

you can use PKey inplce of
ValueField
for
DataValueField 

and use
ComboControl.SelectedItem.Value
to save at other place
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900