I have a simple database application in a C# Windows Forms application using a MS Access data base named AcQtracICG_DB.mdb with 4 tables named as follows:
Patients
PatientSessions
Results
Parameters
The database is accessed via a dataset called acQtracICG_DBDataSet and the tables are bound by the following components:
patientsBindingSource patientsTableAdapter
patientSessionsBindingSourcepatientSessionsTableAdapter
resultsBindingSource resultsTableAdapter
parametersBindingSource parametersTableAdapter
I have 4 DataGridView grids on the form with data sources named as follows:
patientsGridView patientsBindingSource
sessionsGridView patientSessionsBindingSource
resultsGridView resultsBindingSource
parametersGridView parametersBindingSource
The application builds fine and the data is displayed in the grids as expected. I can filter the data displayed in the grids by setting the BindingSource Filter property with an explicit string value (ie: "PatientID = '12345678'") and that works fine as well.
However, what I would like to do is be able to read the data from the "PatientID" column of the active row in the patientsGridView in an event handler so that I can filter the data using that value instead of an explicitly assigned value.
I have been unable to find a way to do this very simple operation and I am getting a little frustrated. I found an example using the DataGrid object instead of the DataGridView opject, but the example code will not work. It compiles, but I keep getting runtime errors about not being able to cast certain variables and I have been unble to find any help relating to the DataGridView.
Can someone please help me with this seemingly trivial operation?
jzirbes