Hi all
I have a database table with payment methods (Cash, Credit Card etc.). These payment methods are visible on at least 2 forms (Winforms) in combo boxes.
At the moment, I have a DataTable that I populate a dictionary from with the id and name of each 'PaymentMethod' item (cash, debit card etc.). This only happens if the dictionary is null, so it knows to grab the information on application startup to detect any changes (no matter how rare). This is then bound to the combo boxes by using BindingSource - this all works fine and my combo boxes display what they should.
My question is: what is the best practice for using this offline dictionary to populate these different combo boxes whilst the user is using the application, and moving between forms? I don't want database connections every time the user moves between forms, but if I can help it, I'd also rather avoid global variables or static classes and properties, though I feel like my requirements demand such use?
Guidance appreciated!
Thanks
I have a database table with payment methods (Cash, Credit Card etc.). These payment methods are visible on at least 2 forms (Winforms) in combo boxes.
At the moment, I have a DataTable that I populate a dictionary from with the id and name of each 'PaymentMethod' item (cash, debit card etc.). This only happens if the dictionary is null, so it knows to grab the information on application startup to detect any changes (no matter how rare). This is then bound to the combo boxes by using BindingSource - this all works fine and my combo boxes display what they should.
My question is: what is the best practice for using this offline dictionary to populate these different combo boxes whilst the user is using the application, and moving between forms? I don't want database connections every time the user moves between forms, but if I can help it, I'd also rather avoid global variables or static classes and properties, though I feel like my requirements demand such use?
Guidance appreciated!
Thanks