Question Saved selection in DataGridView

Joe1

Active member
Joined
Dec 4, 2012
Messages
37
Programming Experience
Beginner
Hi,

I am two data grid view in to WinForms from a database (access). 1 which receives selected rows from the other. and when the user wants to change the selected rows, can return via a button.

However once this button is clicked, the first WinForm reappears with the entire form/selection reset.
My question is, is there a way of saving the selection so the user wouldn't have to reselect the same options again, and can just alter the previous selection?
 
Last edited:
Hi,

It sounds like you are closing your first form when you show your second form. On this basis the form and controls will be disposed in time and then reset when you re-load the first form to make changes to the DataGridView.

The way to get round this is to NOT close the form but change it's visibility property to False. This will simulate closure of the form but you then just set the visibility property bask to True when you need to make changes to the DataGridView on the first form.

Hope that helps.

Cheers,

Ian
 
Oddly enough this works in my test project.. but when I use it in my actual current project I get an error "Reference to a non shared member requires an object reference"
Both have the same variables/class names and are identical in this respect.

Any ideas?
 
Hi,

Sorry, not a clue without further information. Please post the offending code that you have and pinpoint where in the code, as well as, where in the logic process this occurs and we will see if we can help you further.

Cheers,

Ian
 
With in the first form that opens, called "Parameter Selection" the code is:
Dim frm As New ParameterView
frm.Show()
Me.Visible = False
Me.Enabled = True

this opens a new "ParameterView" window

And the code to return to the "ParameterSelection" window (this is when im trying to save the selection for ealier)

ParameterSelection.Visible = True ---- This is the line returning the error described above
Me.Hide()

Thanks for your help


 
Okay thanks for your help anyway. Thats the problem im having. In my test program this code works perfectly. However in my actual plugin that will run in the software. i get an error...
 
Back
Top