Results 1 to 1 of 1

Thread: Editable combo in propertygrid

Threaded View

  1. #1

    Thread Starter
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    Thumbs up Editable combo in propertygrid

    Hi..
    am trying to add items in the combobox during runtime..
    The Combobox is placed inside the propertygrid..

    The below code is how i made the combobox..
    Code:
    Public Class Employee
    Private m_name As String
      <TypeConverter(GetType(Properties)), CategoryAttribute("Gender"), DefaultValueAttribute("Male")> _
        Public Property Gender() As String
            Get
                Return m_name
            End Get
            Set(ByVal Value As String)
                m_name = Value
            End Set
     End Property
    
    'Here the properties class
    Imports System.ComponentModel
    
    Public Class Properties : Inherits System.ComponentModel.StringConverter
           Dim Names() As String = New String() {"Welder", "HorsePower"}
        Public Overloads Overrides Function GetStandardValues(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.ComponentModel.TypeConverter.StandardValuesCollection
            Return New StandardValuesCollection(Names)
        End Function
        Public Overloads Overrides Function GetStandardValuesSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
            Return True
        End Function
        '''
        Public Overloads Overrides Function GetStandardValuesExclusive(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
            Return True
        End Function
    End Class
    
    ' in the form load..
    PropertyGrid1.SelectedObject = New Employee
    now i want to add/edit the combobox items..
    is it possible..
    Last edited by vijy; Oct 5th, 2007 at 06:15 AM.
    Visual Studio.net 2010
    If this post is useful, rate it


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