Add element to DataGrid one by one RRS feed

  • Question

  • I have a datagridview, a combobox and a button. The datagridview has two columns.

    I want to select an item fom the combobox(drop down list) and press the button which will in turn add another row in the datagridview and put the value of the combobox in the first column. User will manually input the second value. And if required, select another value from the drop down list and press the button again.

    Can anyone hwlp me with this? After designing the form, retrieving the value of combobox is no problem. But after that how can I put this in datagrid at the button1_click() function? 

    The examples I find are all working with the datagrid at once. If it is not possible to add data into datagrid one bt one is there another way to store the values in an a two dimensional array? And updating the datagrid at each button press.   
    Thursday, January 8, 2009 9:00 AM