I have a form that has a table adapter for a table called costing. Im not using any of the items in this table in any textboxes etc.. on the form but I would like to use them in calculations that will give results to put in text boxes on these forms. I'm confused in how to call up the items in the costing table. If i use the name assigned to them in the table even thought the table is attached it does not seem to work.

I tried this:

totaldsgn = drawdsgnhrs (where drawdsgnhrs is the variable in the costing table)

The table adapter fills a dataset or a datatable, you should have the DataSet on the designer of your form and possibly a binding source.

Locate the tableAdapter.Fill, more than likely in your Form's load event. It will look like


Now to access the data, you will make a call that looks like:


The [0] is the row index, so choose which row you need. "NewBalance" is a table variable in my application, change it to the name of the variable in your application.

Watch out for DBNull's, if you attempt to access a variable that is a null value the application will throw an exception. You need to test with:

This question has already been answered. Start a new discussion instead.