0

I want to send the entire value of a row (if selected) to another form in C#. The datatable that I am getting is dynamic in nature and is not stored in my local application or computer, these values I am getting is directly from the server.

I have a situation where my table may have a primary key or it may also not have a primary key (because the fields are passed according to users choice). How can I send a selected row to another form?

My code:

    public StudentIdSelect(DataTable dataTable)
    {
        InitializeComponent();

        dataGridView1.DataSource = dataTable;
    } 
Erik Philips
  • 53,428
  • 11
  • 128
  • 150
Animesh
  • 19
  • 5
  • Possible duplicate of [Get selected row item in DataGrid WPF](https://stackoverflow.com/questions/3913580/get-selected-row-item-in-datagrid-wpf) – Tobias Theel Dec 29 '17 at 10:25
  • The linked Question has the answer for you. You should have a look at [DataBinding](https://www.wpftutorial.net/DataBindingOverview.html) and [MVVM](https://www.codeproject.com/Articles/819294/WPF-MVVM-step-by-step-Basics-to-Advance-Level). Once you understand how Databindings work and how to setup a MVVM Structure it will be easy for you to fulfill most tasks in wpf. :) – Tobias Theel Dec 29 '17 at 10:28

0 Answers0