By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,686 Members | 2,392 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,686 IT Pros & Developers. It's quick & easy.

How can i get values from datagrid

P: n/a


How can i get values from datagrid to combobox and should select the same
name as in datagrid row on the combobox control
In my windows application ,i have combobox which is populated by
sqlserver database table.When i select value from combobox ,value saved in to
other table of my database
and i use to datagrid to show this table.

Myproblem is ,
i want to get text value from datagrid and my combobox should select this
value (Which i selected before) when i want to update values in datagrid
Tom <- i select tom and saved to my datagrid table.

Table of DataGrid
Name Age Country
Tom 29 USA

i want to update Tom and i m selecting this row

Tom <-----should selected automatically
i want to do something like that but i couldn't:
(cytpe(combobox1.selectedItem,DataRowView).item(1) )=DataGrid1.item(datagrid1.currentRowIndex,1)))
by the way there is no combobox on datagrid but i use independent combobox
on my form which is populated by another table on my database .

i select name field from combobox
enter age and country from textboxes and then i save these values to other
table on my database.

and i used this code for combobox to save value to the related part of

ctype(comboboxName.selecteditem,datarowview).item( 1).tostring
and there is no problem with this...

The problem is getting values from datagrid and select this value in

Thanks again...


Jul 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.