code_junkie

.NET Designtime Datasource (for Combobox)

Nov 12th, 2011
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. Public Class Time
  2. Private _timeValue As String
  3. Private _timeDisplay As String
  4.  
  5. Public Sub New(ByVal Value As String, ByVal Display As String)
  6. Me._timeDisplay = Display
  7. Me._timeValue = Value
  8. End Sub
  9.  
  10. Public Property Display() As String
  11. Get
  12. Return Me._timeDisplay
  13. End Get
  14. Set(ByVal value As String)
  15. Me._timeDisplay = value
  16. End Set
  17. End Property
  18.  
  19. Public Property Value() As String
  20. Get
  21. Return Me._timeValue
  22. End Get
  23. Set(ByVal value As String)
  24. Me._timeValue = value
  25. End Set
  26. End Property
  27. End Class
  28.  
  29. Public Class Times : Inherits List(Of Time)
  30. Public Sub New()
  31.  
  32. End Sub
  33. End Class
  34.  
  35. 'This works
  36. <System.ComponentModel.DataObject()> _
  37. Public Class Time
  38. Private _timeValue As String
  39. Private _timeDisplay As String
  40.  
  41. Public Sub New()
  42.  
  43. End Sub
  44.  
  45. Public Sub New(ByVal Value As String, ByVal Display As String)
  46. Me._timeDisplay = Display
  47. Me._timeValue = Value
  48. End Sub
  49.  
  50. 'This doesn't work
  51. <System.ComponentModel.DataObjectMethod()> _
  52. Public Function getDisplay() As String
  53. Return Me._timeDisplay
  54. End Function
  55.  
  56. 'This doesn't work
  57. <System.ComponentModel.DataObjectMethod()> _
  58. Public Function getValue() As String
  59. Return Me._timeValue
  60. End Function
  61. End Class
Add Comment
Please, Sign In to add comment