Results 1 to 23 of 23

Thread: How to SET the value of a Listview / Combobox item?

Threaded View

  1. #13
    Frenzied Member bmahler's Avatar
    Join Date
    Oct 2005
    Location
    Somewhere just west of the Atlantic
    Posts
    1,568

    Re: [RESOLVED] How to SET the value of a Listview / Combobox item?

    use
    Code:
    Me.ListBox1.SelectedItem.ToString()
    but you will need to override the ToString method of your class like so
    Code:
        Private Class Person
    
            Private _Name As String
            Private _PhoneNumber As String
    
            Public Sub New(ByVal Name As String, ByVal PhoneNumber As String)
                _Name = Name
                _PhoneNumber = PhoneNumber
            End Sub
    
            Public Sub New()
    
            End Sub
    
            Public Property Name() As String
                Get
                    Return _Name
                End Get
                Set(ByVal value As String)
                    _Name = value
                End Set
            End Property
    
            Public Property PhoneNumber() As String
                Get
                    Return _PhoneNumber
                End Get
                Set(ByVal value As String)
                    _PhoneNumber = value
                End Set
            End Property
    
            Public Overrides Function ToString() As String
                Return _Name
            End Function
    
        End Class
    Last edited by bmahler; Aug 29th, 2007 at 12:47 PM.
    Boooya
    • Visual Studio 2008 Professional
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • Don't forget to rate helpful posts!
    • If you're question was answered please mark your thread [Resolved]


    Code Contributions:
    PHP
    PHP Image Gallery v1.0PHP Image Gallery v2.0
    VB 2005
    Find Computers on a networkSimple License EncryptionSQL Server Database Access dllUse Reflection to Return Crystal ReportDocumentSilently Print PDFGeneric Xml Serailizer


    Useful Links: (more to come)
    MSDN (The first and foremost)MSDN Design Guidelines API Reference • Inno Setup CompilerInno Setup PreprocessorISTool - Fairly easy to use GUI for creating inno setup projects • Connection StringsNAnt -Automated BuildsCruise Control .NET - Frontend for automated builds

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