vb Code:
'Add a Toolstrip in the form 'Add one Listbox Class MyItem Inherits ListBox Public MyShowText As String Public MyIntg As Integer Public MyStrng As String Sub New(ByVal ShowText As String, ByVal Intg As Integer, ByVal Strng As String) MyBase.New() 'transfer all incoming parameters to your local storage MyShowText = ShowText MyIntg = Intg MyStrng = Strng 'and finally, pass back the Text property Me.Text = MyShowText End Sub End Class Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ListBox1.DisplayMember = "Text" ListBox1.Items.Add(New MyItem("ONE", 1, "o_n_e")) ListBox1.Items.Add(New MyItem("Two", 2, "Two")) ListBox1.Items.Add(New MyItem("Three", 3, "Three")) End Sub Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged Dim myitem1 As MyItem myitem1 = CType(ListBox1.SelectedItem, MyItem) ToolTip1.SetToolTip(ListBox1, myitem1.MyStrng) End Sub




Reply With Quote