Roshan Roshan - 3 months ago 18
C# Question

c# get datasource of a datagridview from another source

I have 2 form in my application Form1 and summary. I have a button in form1 onclick I will choose a mdb file then it gets connected to mdb. I have a datagridview in summary.

What I need is once I connect the mdb file I need to update the data (in other words set

datagrid.DataSource = ds
from Form1) so that the data from mdb shows on datagridview of summary Form

Before selecting my question as duplicate or -1 plzz make clear that database will be connected in form1 which needs to be show in summary form. I had tried all the ways shown in google but no result.
Your help will be appreciated.

Answer

got it make another constructor in summary form that have paramater like that

 public summary(dataset ds){
      initializecomponent();// there
  // here bind the DataSet with grid of summary
    }

call from form1

   summary obj = new summary (ds);
         obj.show();
Comments