alleho Posted March 1, 2004 Posted March 1, 2004 I have a combobox(Itemtype) that lets the user select 1 of 3 values. Depending on what they select I need to change the datasource and valuemenu of another combobox. simple I thought. when I run the code it works OK if you select(1,2, or3 ) it fills the other combo box with the correct data. However if I then change the value in Itemtype I get an error message: Unhandled Exception: System.ArgumentException: Could not bind to the new value member. Parameter name: value Any ideas???? Private Sub cboItemType_SelectionChangeCommitted(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboItemType.SelectionChangeCommitted If cboItemType.SelectedValue = 1 Then 'comp cboItemId.Visible = True cboItemId.DataSource = DsOrdertwo1 cboItemId.ValueMember = "viewstock.ecas" ElseIf cboItemType.SelectedValue = 2 Then 'kit cboItemId.Visible = True cboItemId.DataSource = DsOrdertwo1 cboItemId.ValueMember = "viewkits.kitid" Else cboItemId.Visible = True cboItemId.DataSource = DsOrdertwo1 cboItemId.ValueMember = "viewmodules.modid" End If Thanks In advance Quote
mocella Posted March 1, 2004 Posted March 1, 2004 Add this before your if statement starts - see if that fixes it: cboItemId.DataBindings.Clear() Quote
alleho Posted March 1, 2004 Author Posted March 1, 2004 Didn't work. Got the same err message. Seems to be the valuemember bit it does not like. Also tried puting that line of code IN the if statement. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.