Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Showing a property as a combobox in propertygrid

Showing a property as a combobox in propertygrid

Scheduled Pinned Locked Moved Visual Basic
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VB 8 0
    wrote on last edited by
    #1

    Hi , i want this 'Datatype' property as combobox in propertygrid . -- Datatype -- Date (Sub Property) -- Text (sub Property) -- Number (sub Property) --Format - On selecting type of sub-property in combobox the things should be appear in next property ' Format ' if Date is selected ,' dd-mm-yyyy ' should appear . If Text is selected , nothing should appear. if NUmber is selected,' 12345 ' should appear in Format property . Vb8.0

    F S 2 Replies Last reply
    0
    • V VB 8 0

      Hi , i want this 'Datatype' property as combobox in propertygrid . -- Datatype -- Date (Sub Property) -- Text (sub Property) -- Number (sub Property) --Format - On selecting type of sub-property in combobox the things should be appear in next property ' Format ' if Date is selected ,' dd-mm-yyyy ' should appear . If Text is selected , nothing should appear. if NUmber is selected,' 12345 ' should appear in Format property . Vb8.0

      F Offline
      F Offline
      Francis K Antony
      wrote on last edited by
      #2

      Try this format dd-MMM-yyyy

      Franics K Antony

      1 Reply Last reply
      0
      • V VB 8 0

        Hi , i want this 'Datatype' property as combobox in propertygrid . -- Datatype -- Date (Sub Property) -- Text (sub Property) -- Number (sub Property) --Format - On selecting type of sub-property in combobox the things should be appear in next property ' Format ' if Date is selected ,' dd-mm-yyyy ' should appear . If Text is selected , nothing should appear. if NUmber is selected,' 12345 ' should appear in Format property . Vb8.0

        S Offline
        S Offline
        Steven J Jowett
        wrote on last edited by
        #3

        Try setting your Property DataType as an Enum. For example :- Enum DataTypes Date=1 Text=2 Number=3 End Enum Property DataType As DataTypes Get 'Your code here End Get Set(ByVal Value As DataTypes) 'Your code here End Set

        Steve Jowett ------------------------- Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'

        V 1 Reply Last reply
        0
        • S Steven J Jowett

          Try setting your Property DataType as an Enum. For example :- Enum DataTypes Date=1 Text=2 Number=3 End Enum Property DataType As DataTypes Get 'Your code here End Get Set(ByVal Value As DataTypes) 'Your code here End Set

          Steve Jowett ------------------------- Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'

          V Offline
          V Offline
          VB 8 0
          wrote on last edited by
          #4

          Thanks Here it's not taking Date as a type of enum . Rising error 'at the place of Date " Statement cannot appear within a enum body " .

          S 1 Reply Last reply
          0
          • V VB 8 0

            Thanks Here it's not taking Date as a type of enum . Rising error 'at the place of Date " Statement cannot appear within a enum body " .

            S Offline
            S Offline
            Steven J Jowett
            wrote on last edited by
            #5

            Sorry, the example should have read :- Enum DataTypes [Date]=1 '<--- Note the square brackets Text=2 Number=3 End Enum Property DataType As DataTypes Get 'Your code here End Get Set(ByVal Value As DataTypes) 'Your code here End Set

            Steve Jowett ------------------------- Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'

            V 1 Reply Last reply
            0
            • S Steven J Jowett

              Sorry, the example should have read :- Enum DataTypes [Date]=1 '<--- Note the square brackets Text=2 Number=3 End Enum Property DataType As DataTypes Get 'Your code here End Get Set(ByVal Value As DataTypes) 'Your code here End Set

              Steve Jowett ------------------------- Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'

              V Offline
              V Offline
              VB 8 0
              wrote on last edited by
              #6

              Thanks , Now i am able to show the Datatypes . Now if i select the DataType "Date" then in Text property of Propertygrid , I want to show the datetimepicker .If not i want to show nothing . For this i used .... Public Class MyDate Inherits UITypeEditor Dim CustomDate As DateTimePicker Public Overrides Function EditValue(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal provider As System.IServiceProvider, ByVal value As Object) As Object CustomDate = New DateTimePicker CustomDate.Format = DateTimePickerFormat.Custom CustomDate.CustomFormat = "d-MMM-yyyy" CustomDate.ShowUpDown = True CustomDate.Show() Return MyBase.EditValue(context, provider, value) End Function Public Overrides Function GetEditStyle(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.Drawing.Design.UITypeEditorEditStyle Return UITypeEditorEditStyle.DropDown End Function it is showing the dropdown ,but not getting the Datetimepicker . After selecting the date i want to show in Text Property . For this what i have to follow ?????????? VB 8.0

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups