Saturday, March 24, 2012

List. Find. What is wrong with my code?

Hi,

I just created a predicate class following some articles there is an
error.

Could you please, tell me, what might be going on?

1 Public Class FindRowByName
2
3 Private _RowName As String
4 Public Property RowName() As String
5 Get
6 Return _RowName
7 End Get
8 Set(ByVal value As String)
9 _RowName = value
10 End Set
11 End Property ' RowName
12
13 Public Sub New(ByVal rowName As String)
14 Me.RowName = rowName
15 End Sub ' New
16
17 Public Function Search(ByVal row As BoxRows.Row) As Boolean
18 Return String.Compare(row.Name, Me.RowName)
19 End Function ' Search
20
21 End Class ' FindRowByName

I am using it as follows:

1 Dim p As New FindRowByName("Hello")
2 Dim result As Boolean = rows.Find(p.Search)

On line 2 I get the message:

"Argurment not specified for parameter row ..."

But in all examples the parameter is not passed.

Any idea?

Thanks,

Miguelshapper wrote:

Quote:

Originally Posted by

Hi,
>
I just created a predicate class following some articles there is an
error.
>
Could you please, tell me, what might be going on?
>
1 Public Class FindRowByName
2
3 Private _RowName As String
4 Public Property RowName() As String
5 Get
6 Return _RowName
7 End Get
8 Set(ByVal value As String)
9 _RowName = value
10 End Set
11 End Property ' RowName
12
13 Public Sub New(ByVal rowName As String)
14 Me.RowName = rowName
15 End Sub ' New
16
17 Public Function Search(ByVal row As BoxRows.Row) As Boolean
18 Return String.Compare(row.Name, Me.RowName)
19 End Function ' Search
20
21 End Class ' FindRowByName
>
I am using it as follows:
>
1 Dim p As New FindRowByName("Hello")
2 Dim result As Boolean = rows.Find(p.Search)
>
On line 2 I get the message:
>
"Argurment not specified for parameter row ..."
>
But in all examples the parameter is not passed.
>
Any idea?
>
Thanks,
>
Miguel
>


What kind of collection is it that you are trying to search in? What is
the type of the rows variable?

--
Gran Andersson
_____
http://www.guffa.com

0 comments:

Post a Comment