Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to insert user entered values from textbox and combobox to Datagrid
when we click a button?
Is there any example online?
Posted
Updated 14-Feb-11 19:30pm
v2

Typically, you bind the TextBox to a string variable and the ComboBox selected item to a varable of the type of item displayed in the ComboBox. The datagrid/listview/whatever control is bound to an ObservableCollection<SomeItemType>.

When the user hits an Add button, a new SomeItemType instance is created using the data from the textbox/combobox, and is added to the ObservableCollection<>. This will automatically update the view (whatever it is that you use there).
 
Share this answer
 
v2
Comments
Espen Harlinn 16-Feb-11 15:19pm    
Good answer, my 5
amitkarnik2211 23-Feb-11 0:54am    
Thanks Nishant That Worked
hope u know the DataSets?

if(ans==Yes)
{

then its not a big deal, just insert the text of textbox or combobox in some cell of DataSet

Assign the DataSet Table to DataGrid.DataSource

}
else

Just Drop a Message, i wil get back to You with Exapmle of DataSet
 
Share this answer
 
Comments
amitkarnik2211 16-Feb-11 2:17am    
Can you Send me Some Example (Sample) Pls Thanks

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