[RESOLVED] Combobox Filter With Databinding (VB.NET)
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 25

Thread: [RESOLVED] Combobox Filter With Databinding (VB.NET)

Threaded View

  1. #16
    Join Date
    Jul 2012
    Posts
    46

    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 09: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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center