Advertisement

02.16.2008 at 04:47PM PST, ID: 23169034
[x]
Attachment Details

Retrieving Values from ListBox in VB.Net

Asked by tlchavet in Visual Studio .NET 2005, Miscellaneous Programming, VB Controls

Tags: Visual Studio 2005

I have been searching for a replacement for ItemData in ListBoxes.  I have read all of the posts on the subject and have gotten this far:

Public Class ListBoxItem

    Private m_strName As String
    Private m_intID As Integer

    Public Property Name() As String
        Get
            Return m_strName
        End Get

        Set(ByVal Value As String)
            m_strName = Value
        End Set
    End Property

    Public Property ID() As Integer
        Get
            Return m_intID
        End Get

        Set(ByVal Value As Integer)
            m_intID = Value
        End Set
    End Property

    Public Overrides Function ToString() As Integer
        Return m_strName
    End Function

End Class

To load the listbox, I have done this:

        lstEntry.Name = rsIQ.GetString("FEG_SYSTEM")
        lstEntry.ID = rsIQ.GetInt16("MID")

        lstSystems.Items.Add(lstEntry)

My question is how do I retrieve the value in ID from the entry in the listbox selected by the user?  Would it be different if the listbox were a checkbox style?  

Thanks!Start Free Trial
 
Loading Advertisement...
 
[+][-]02.16.2008 at 05:01PM PST, ID: 20912075

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.16.2008 at 08:28PM PST, ID: 20912868

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Studio .NET 2005, Miscellaneous Programming, VB Controls
Tags: Visual Studio 2005
Sign Up Now!
Solution Provided By: tlchavet
Participating Experts: 0
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628