none
DatagridView selected row RRS feed

  • Question

  • Hello All!

    I'm trying to fill a dataset with the fields of a selected row of a datagridview, column name and value.

    how can i do that?

    Thanks in advance!

    • Moved by Kristin Xie Wednesday, May 13, 2015 9:41 AM move to the right forum
    Tuesday, May 12, 2015 9:35 PM

Answers

  • Use a DataTable, create a new DataTable then use DataTable.Clone to get the fields from the current DataTable then use DataTable.ImportRow to get data from the current DataTable. If the current data source is a DataSet then reference the table via DataSet.Tables[x] where x is the ordinal position in the dataset or the table name.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my webpage under my profile but do not reply to forum questions.

    Tuesday, May 12, 2015 9:40 PM
  • Yea some people try to fuel the gasoline of their car using the exhaust pipe.

    Better try like it is meant to do, bind the datatable of the dataset to the datasource of the datagridview for instance using a bindingsource and than do after an endedit of the bindingsource an update after having done this of the datatable.

    There is a special forum for your question.

    https://social.msdn.microsoft.com/Forums/en-US/home?forum=adodotnetdataset

     

    Success
    Cor


    Wednesday, May 13, 2015 8:41 AM

All replies

  • Use a DataTable, create a new DataTable then use DataTable.Clone to get the fields from the current DataTable then use DataTable.ImportRow to get data from the current DataTable. If the current data source is a DataSet then reference the table via DataSet.Tables[x] where x is the ordinal position in the dataset or the table name.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my webpage under my profile but do not reply to forum questions.

    Tuesday, May 12, 2015 9:40 PM
  • Yea some people try to fuel the gasoline of their car using the exhaust pipe.

    Better try like it is meant to do, bind the datatable of the dataset to the datasource of the datagridview for instance using a bindingsource and than do after an endedit of the bindingsource an update after having done this of the datatable.

    There is a special forum for your question.

    https://social.msdn.microsoft.com/Forums/en-US/home?forum=adodotnetdataset

     

    Success
    Cor


    Wednesday, May 13, 2015 8:41 AM