I have a simple WinForm, a CR report and a class that allow the user to pass parameters to the Crystal Report.
The user is presented with 2 options to control what is shown in the report.
WinForm:
Customer ID: [dropdownlist1] to [dropdownlist2]
Customer Name: [dropdownlist3] to [dropdownlist4]
[OK][Cancel]
Basically, the above WinForm allows the user to select a range of customer id and/or name from A to Z.
I connect to the database and using List.Add(new Customer(id, name)) to get all the fixated 200 records (the Customer DB table is fixed and will not grow according to our user) returned from the Customer DB table.
In my code,
var customer1 = new Customer();
//Do DB connection and loop through the record and add to List<T>
//List<Customer>.Add(new Customer(reader.GetInt16(0), reader.GetString(1)));
dropdownlist1.ValueMember = "customerID";
dropdownlist1.DisplayMember = "customerID";
dropdownlist1.DataSource = customer1.GetCustomerList(); //Return List<Customer>()
dropdownlist2.ValueMember = "customerID";
dropdownlist2.DisplayMember = "customerID";
dropdownlist2.DataSource = customer1.GetCustomerList(); //Return List<Customer>()
dropdownlist3.ValueMember = "customerName";
dropdownlist3.DisplayMember = "customerName";
dropdownlist3.DataSource = customer1.GetCustomerList(); //Return List<Customer>()
dropdownlist4.ValueMember = "customerName";
dropdownlist4.DisplayMember = "customerName";
dropdownlist4.DataSource = customer1.GetCustomerList(); //Return List<Customer>()
The problem I faced is, after the WinForm is loaded, and whenever I were to make a selection change in dropdownlist1, all the remaining 3 dropdownlists will change to the one I have selected in dropdownlist1. This is the same situation for other list selection I made.
What happened? How can I make individual list behave on its own unless I made the change in each of the dropdown list?