Results 1 to 13 of 13

Thread: Here's a fun one...ToolTips, ListBoxes, DataSets..Oh MY! [RESOLVED,THIS BOARD ROCKS!]

Threaded View

  1. #1

    Thread Starter
    Lively Member milkmood's Avatar
    Join Date
    Mar 2005
    Location
    Forests of Delta Halo
    Posts
    109

    Resolved Here's a fun one...ToolTips, ListBoxes, DataSets..Oh MY! [RESOLVED,THIS BOARD ROCKS!]

    One ListBox (customer) contains data from a database, another ListBox (part number) gets filled when an item in the customer ListBox is clicked (SelectedIndexChanged).

    What I want to do, is display a ToolTip containing the Part Description (another field in the partdefinition table, which is already in the dataset) when hovering over the partnumber in the second ListBox.

    Here's the event that puts the part numbers in the second ListBox based on the selected customer from the first:
    VB Code:
    1. Private Sub lbxRecCust_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lbxRecCust.SelectedIndexChanged
    2.  
    3.         'Dim srch As String
    4.         Dim sqlsrch As String
    5.         Dim dssrch As New DataSet
    6.         Dim dasrch As New Odbc.OdbcDataAdapter
    7.  
    8.         Try
    9.             sqlsrch = "SELECT * FROM partdefinition WHERE LOWER(customername) LIKE '%" & CType(lbxRecCust.SelectedItem, DataRowView).Item("customername").ToString.ToLower & "%' ORDER BY partnumber ASC;"
    10.             dasrch = New Odbc.OdbcDataAdapter(sqlsrch, con)
    11.             dasrch.Fill(dssrch, "partdefinition")
    12.         Catch ox As Odbc.OdbcException
    13.             MsgBox(ox.Message)
    14.             Exit Sub
    15.         End Try
    16.  
    17.         With lbxRecPart
    18.             .DataSource = dssrch.Tables("partdefinition")
    19.             .DisplayMember = "partnumber"
    20.         End With
    21.  
    22.         'MessageBox.Show("There are no parts associated with this customer", "No Parts", MessageBoxButtons.OK)
    23.  
    24.     End Sub
    Last edited by milkmood; Jun 16th, 2005 at 11:12 AM.
    When I say 'jump', don't waste time asking 'how high?'.

    Just a poor, dumb wanna-be programmer.

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