473,508 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BindingList FindCore, how do you implement this? Why doesn't this not work?

If you could answer this, I would be very appreciative:
Why does this code die on line 63 with the error "Specified method is not supported." error message?

1 Imports System.ComponentModel

2

3 Public Enum DataType As Integer

4 [String] = 0

5 [Integer] = 1

6 [Date] = 2

7 End Enum

8

9 Public Class SessionStateValue

10

11 Private _KeyName As String

12 Private _DataType As DataType

13 Private _KeyValue As Object

14

15 Public Sub New(ByVal keyName As String, _

16 ByVal dataType As DataType, _

17 ByVal keyValue As Object)

18

19 _KeyName = keyName

20 dataType = dataType

21 _KeyValue = keyValue

22

23 End Sub

24

25 Public ReadOnly Property KeyName() As String

26 Get

27 Return _KeyName

28 End Get

29 End Property

30

31 Public readonly Property DataType() As DataType

32 Get

33 Return _DataType

34 End Get

35 End Property

36

37 Public Property KeyValue() As Object

38 Get

39 Return _KeyValue

40 End Get

41 Set(ByVal value As Object)

42 _KeyValue = value

43 End Set

44 End Property

45

46 End Class

47

48 Public Class SessionStateValues

49

50 Inherits System.ComponentModel.BindingList(Of SessionStateValue)

51

52 Protected Overrides ReadOnly Property SupportsSearchingCore() As Boolean 'I thought this would fix the problem

53 Get

54 Return True

55 End Get

56 End Property

57

58 Public Function ItemByKeyName(ByVal keyName As String) As SessionStateValue

59

60 Dim Ordinal As Integer

61 Dim Properties As PropertyDescriptorCollection = TypeDescriptor.GetProperties(GetType(SessionStateV alue))

62

63 Ordinal = MyBase.FindCore(Properties.Item("KeyName"), keyName)

64

65 Dim SessionStateValue As SessionStateValue = Me.Items(Ordinal)

66

67 Return SessionStateValue

68

69 End Function

70

71 End Class

72

73 Public Class SessionState

74

75 Private _SessionId As String

76 Private _SessionStateValues As SessionStateValues

77

78 Public Sub New(ByVal sessionId As String)

79 _SessionId = sessionId

80 _SessionStateValues = New SessionStateValues

81 End Sub

82

83 Public ReadOnly Property SessionId() As String

84 Get

85 Return _SessionId

86 End Get

87 End Property

88

89 Public ReadOnly Property SessionStateValues() As SessionStateValues

90 Get

91 Return _SessionStateValues

92 End Get

93 End Property

94

95 End Class

'Here's where I use the above objects:

1

2

3 Public Class Form1

4

5 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

6

7 End Sub

8

9 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

10

11 Dim SessionState As New SessionState("eqwerre233214")

12

13 SessionState.SessionStateValues.Add(New SessionStateValue("UserName", DataType.String, "Chad"))

14 Dim SessionStateValue As SessionStateValue = SessionState.SessionStateValues.ItemByKeyName("Use rName") '<----Dies "inside" this call

15

16 End Sub

17 End Class

Jan 11 '07 #1
0 1993

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4853
by: guy | last post by:
VB2005 a generic collection that inherits from BindingList, with the code to support sorting added (ApplySortCore, SpportsSortingCore etc.) however when this collection is populated and bound...
1
8908
by: Pieter | last post by:
Hi, I have my own custom BindingList, that inherits from BindingList, and implements IComponent. I would like to implement a Find-method, that will allow me to search for a property of my...
1
3030
by: Dave Booker | last post by:
Is there a reason why the BindingList constructor doesn't create a new BindingList? Create a form with four ListBoxes and the following will result in them all containing the exact same thing. ...
1
1840
by: Pieter | last post by:
Hi, I use a customized Generic List (VB.NET 2.0) inherited from BindingList(Of T). I made some methods in this BindingList, to allow me to do some standard functions on the BindingList-Items....
6
16813
by: jwilson128 | last post by:
I am trying to decide whether to use a system.ComponentModel.BindingList(of T) or a Sytem.Collections.Generic.List(of T) for a custom collection. In testing a simple, read-only data binding to a...
10
1625
by: Rick | last post by:
VS 2005 I have a class of BindingList(of T) to use as a datasource for a lookup combobox. The combobox is to lookup the Terms for a Purchase Order. When I implement this on my Winform, the...
1
2097
by: Jim Balo | last post by:
Hi, When I bind a BindingList<to a DataGridView and then call RemoveAt(n) on it, I get ArgumentOutOfRange. Could someone explain why? Sample: public partial class TestForm2 : Form {...
5
3982
by: jehugaleahsa | last post by:
Hello: I have a mapping class that can take generic data objects and locate/ add/remove/update DataRows in a DataTable. I associate them using attributes: TableAttribute and ColumnAttribute. I...
3
9667
by: jehugaleahsa | last post by:
Hello: I am binding a DataGridView with a BindingList<T>, where T is a custom business object that implements INotifyPropertyChanged. When you bind a DataGridView to a DataTable, it has this...
0
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7328
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7499
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5631
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4709
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
422
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.