-
July 12th, 2012, 08:20 AM
#16
Re: Combobox Filter With Databinding (VB.NET)
This is my version of what you gave to me (I had already made the changed to calling the SQL DB):
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
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?
Thanks again
Last edited by S_John; July 12th, 2012 at 08:48 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|