I need some help with BindingSources (in C#).

This is what I'm working on:

From the C# tutorial at Programmer's Heaven (http://www.programmersheaven.com/2/Les_CSharp_13_p9):

private void btnLoadData_Click(object sender, System.EventArgs e)
{
string connectionString = "server=P-III; database=programmersheaven; uid=sa; pwd=;";
SqlConnection conn = new SqlConnection (connectionString);
string cmdString = "SELECT * FROM article";
SqlDataAdapter dataAdapter = new SqlDataAdapter (cmdString, conn);
DataSet ds = new DataSet ();
dataAdapter.Fill (ds, "article");
dgDetails.SetDataBinding (ds, "article");
}

When I try to compile this, I get the following error: "The name 'dgDetails' does not exist in the current context".

I have just been told that dgDetails is a BindingSource. I'm a newbie, so I'm not familiar with BindingSources.

Could you tell me what I need to include in my code to get the compiler to recognize the dgDetails BindingSource and compile my app?

Is this a duplicate ? I think you posted this earlier, and I sent you some code to use the DataGridView instead of the DataGrid component.

// Jerry

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.