I had face dificult problem. So I'm hoping your help. First I would like to discribe my form. Then You can understand my problem. This form had Comboboxes and textboxes and datetime pickers. We need to focus only few ones. So I'll type my form items below accendently.
- ComboBox - cmbloanid
- ComboBox - cmbcustomername
TextBox - txtcustomerid
cmbloanid combobox load itself loan id's when form load. Like that cmbcustomername combobox also load their values.
And When I click on cmbloanid's one of item. at once all other details load to other controls (textboxes, datetimepickers). From This point I had error.
Like that when I click on cmbcusomer name it load his customer id to below textbox (txtcustomerid).
The error is this.
When I select customer name from cmbcusomer combobox it loads his customer id. That's fine. To do that I coded.
When I select loan id from cmbloanid combobox it say that "Connection is already open". I know why this happen. Let me explain.
ComboBox select index change event I coded special thing.
If select index = 0 then
new_customer.show() '(that form is adding new customer)
customer_id_Load() 'this is private sub
I coded cmbloanid combobox like when index change call private sub. this private sub read data belong to loan table and load it to controls.
I'll add more codes below :
cmbloanid combobox index change code :
Try load_loan_details() Catch ex As Exception XtraMessageBox.Show(ex.Message) End Try
cmbcustomername combobox index change code :
Try If ComboBox1.SelectedIndex = 0 Then Dim new_c_add_e = New Add_New_Customer_For_Edit_Loan(Me) new_c_add_e.Show() new_c_add_e.MdiParent = frmmlsadmin Else customer_id_load() End If Catch ex As Exception XtraMessageBox.Show(ex.Message) End Try
Firstly we faced cmbloanid and because of that firstly call first sub. Before it finish when customer name load according to loan id automatically call 2nd sub. I think that's why this " Connection already Open" error shows and interupt procedure.
I'm waiting for your help.