Datagrid help, please

  • Thread starter The Cleaning Wonder Boy
  • Start date
T

The Cleaning Wonder Boy

I am working to converta Delphi application to a C# Winform application.

Coming from the Delphi world of
1. Drop a Dataset on the form
2. Drop a Datasource on the form
3. Drop a DBGrid on the form
4. Set DBGrid's Datasource property
5. Set Datasource's Dataset property
6. Set Dataset's properties
7. Set Dataset to Active
and you're done...

What steps are required to do accompish the same in a C# Winform App???

I am finding information like this very difficult to find.
 
W

William Ryan eMVP

1) Drop a DataAdapter on the Form and configure it, it'll create a
connection for you if you don't have one
2) Create a DataSet and drop it on the form
3) Drop a grid on the form and specify it's datasource
4) on Form_Load, call dataAdapter.Fill(dataset)

There are many other ways, but assuming you only want to use the visual
tools, that should do it for you.

You'll need to call fill though when the form loads. You'll also need to
specify an event (or create a button for instance) to call
dataadapter.Update so you can send the data back. If you don't know the
connection string in advance (ie you deploy this app) you can set it in the
Dynamic settings and edit it in your config file.

There's a lot of nuance here, and unless this is just a test run, I'd take a
step back and famialiarize myself with ADO.NET and DataBinding before I did
much with it.

HTH,

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top