List. Find. What is wrong with my code?

S

shapper

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
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

shapper said:
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top