I bind the two comboboxes with table.
one combo contains product and another contains subproduct.
when i clicked first combobox then subproduct of that is filtered in another combo.
when i clicked next,previous ,it is working properly.
but when i go to last record second combo is refreshed means it is not showing proper subproduct.
I know the problem.i given the code on 1st combo_selectedIndexChanged.when i go to last record the SelectedIndexChanged event occur.thats why it is not show me last record proper.which event should i use for this???Someone plz help me!!! i m sending u code.....

Private Sub frmType_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cmd = New SqlCommand("select makeName from Make where status='Add' or status='Edit'")
        dt1 = New DataTable
        dt1 = ob.getDataTable(cmd)
        cmbMakeName.DataSource = dt1
        cmbMakeName.DisplayMember = "makeName"

        cmd = Nothing
        cmd = New SqlCommand("select brandName from Brand where status='Add' or status='Edit'")
        dt2 = New DataTable
        dt2 = ob.getDataTable(cmd)
        cmbBrandName.DataSource = dt2
        cmbBrandName.DisplayMember = "brandName"
end sub


   Private Sub cmbMakeName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbMakeName.SelectedIndexChanged
        Dim s As String
        s = cmbMakeName.Text
        dt3 = New DataTable
        dt3 = ob.getSearch("brandName", "Brand", "makeName", s)
        cmbBrandName.DataSource = dt3
        cmbBrandName.DisplayMember = "brandName"
    End Sub

'Biniding of comboboxes
  cmbBrandName.DataBindings.Add("Text", dt, "brandName")
        cmbMakeName.DataBindings.Add("Text", dt, "makeName")
        cm = CType(Me.BindingContext(dt), CurrencyManager)

Recommended Answers

All 6 Replies

I bind two comboboxes.
When i go to last record through currency manager,i want to stop SelectedIndexChanged event of 1st combo.bcoz when i go to last record, it will refresh 2nd combo,so records are filtered by 1st combo. but not proper displayed .It will display 1st item.can we stop the event at runtime????plz anyone help me!!!!!!

What?

Can you show some code? or is currency manager another software?

Not clear please elaborate.

Welcome to the forums,

I Think I understood what you want.

Basically you want the user to select something from the first combobox, depending on the response you want to fill the second one, and depending on the second you want to fill the third one.

Right?

If so your code looks good, some syntax errors, but logic seems fine could you please elaborate a little bit. Your code is a little hard to read without code tagging, I have flagged your post so a mod will do that any time now.

Threads merged

What?

Can you show some code? or is currency manager another software?

Not clear please elaborate.

Currency Manager is work like ADODC control in vb 6.0.
Can u plz tell me ,can we stop the combobox's event at current time.

Amother question is,
I want to work with Datagridcombobox.
My datagrid contains 3 comboboxes.
When i clicked on 1st ,2nd combo should be filled.
Same like 2nd third.
How can we handle the event of DatagridCombobox??
Can u plz help me.

Thanks for understood my problem.
Can we stop the SelectedIndexChanged Event of combobox at runtime?
bcoz when i go to last record my sencond combo is refreshed & It will show 1st Item.
but i want to see related item with 1st combo.In the database records are stored with related item.but on frontend.......This is my problem .Can u plz tell me the solution??

Amother question is,
I want to work with Datagridcombobox.
My datagrid contains 3 comboboxes.
When i clicked on 1st ,2nd combo should be filled.
Same like 2nd third.
How can we handle the event of DatagridCombobox??
Can u plz help me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.