CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2012
    Posts
    46

    Combobox Event Handlers

    I have a combobox and a txtbox. Both are databound. Choosing a value in the combobox initiates the txtbox fill. Right now my event handle for this event is "onclick" but I would like to change the event to something that would initiate the txtbox fill "onmouseover". I tried "mouseHover" but that does not work. Any ideas?

    Code:
    Region "Fill Description Box"
        Private Sub cboPartNumber_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboPartNumber.MouseHover
            Dim UdtConn As New SqlConnection(sBoMConnectionString)
    
            'Selects a part numbers corresponding description'
            Using UdtConn
                UdtConn.Open()
                Dim udtSqlCmd As New SqlCommand("SELECT Part_Desc FROM dbo.Part WHERE Part_Nbr = @Part_Number", UdtConn)
                udtSqlCmd.Parameters.AddWithValue("@Part_Number", cboPartNumber.Text)
                Dim myReader As SqlDataReader = udtSqlCmd.ExecuteReader
    
                If myReader.HasRows Then
                    Do While myReader.Read
                        txtPartPickDescription.Text = myReader.GetValue(0)
                    Loop
                End If
                UdtConn.Close()
            End Using
        End Sub
    #End Region
    Thank you for any help you may offer.

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Combobox Event Handlers

    Perhaps this article may be of help :

    Extending the ComboBox with C#
    http://www.codeguru.com/csharp/cshar...cle.php/c15261

    It is in C# though, but it covers more advanced topics about the ComboBox.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured