This is my version of what you gave to me (I had already made the changed to calling the SQL DB):
While this code runs without error it still posts all values for the second combobox. Am I calling the procedure FilterMe() in the wrong place within the cbo change?Code:Private Sub FilterMe() Using conn As New SqlConnection(sBoMConnectionString) udtSQLCmd = "SELECT * FROM Motors WHERE Voltage LIKE '%" & cboMotorVoltage.SelectedIndex.ToString() & "%'" Dim oSelCmd As SqlCommand = New SqlCommand oSelCmd.CommandType = CommandType.Text oSelCmd.Connection = conn oSelCmd.CommandText = udtSQLCmd conn.Open() Dim oDr As SqlDataReader = oSelCmd.ExecuteReader(CommandBehavior.Default) End Using End Sub '***************CBO SELECTED CHANGED*********** Private Sub cboMotorVoltage_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboMotorVoltage.SelectedIndexChanged 'Disables controls in Motor Type unless Motor Voltage is selected If cboMotorVoltage.Text <> String.Empty Then cboMotorHP.Enabled = True FilterMe() Else cboMotorHP.Enabled = False spnMotorQTY.Enabled = False End If End Sub
Thanks again![]()


Reply With Quote

Bookmarks