Program with Database - Design Question

daviddoria

Member
Joined
Jan 11, 2007
Messages
13
Programming Experience
Beginner
I have a program with about 20 forms, almost all of which use the data from a tables in a dataset (from a datasource I added to the project). So I have made a global variable in a module:

VB.NET:
Public TTData As New TTDataSet

And a DataAdapter for each table (also global):
VB.NET:
Public daEvent As New TTDataSet.EventTableAdapter

And then I just use it from the forms when it is needed, ie

VB.NET:
Dim OldRow As TTDataSet.EventTableRow = TTData.EventTable.Rows(0)

This works fine (although is there a better way, ie without globals?)

On one of these forms I want to display some data in a DataGridView. If I just drag the datatable from the project datasources onto the form, it creates a DataSet, DataAdapter, and BindingSource on the form. This is now a SECOND copy of the data, because I already have it in a global variable. I'd have to either reload all of the globals after editing anything in the local copy in the datagridview, or do this a different way.

Did I make the problem clear? Does anyone have any suggestions?

Thanks,

Dave
 
Are you asking how to connect your global dataset table to a datagridview to show all info in the table or asking how to filter the data first to show only some of the records within the table?

'To show all data within the table
DataGridVeiw1.DataSource = YourGlobalDataset.TableName
 
Back
Top