-
Delegates
I was looking at creating a simple generic sort routine yesterday. The
routine would call a delegate function to do the "what is greater than what"
comparison. Seems simple enough but whenever I have what looks like a
correct delegate signature declared in my form the form will not display in
the IDE and I get an error.
Delegate Function IsGreater(ByVal v1 As Integer, ByVal v2 As Integer) As
Boolean
The error is "unexpected token 'Function' of type 'KW_Function' at line 61
column 14. Expected a 'KW_Sub' token. Unsurprisingly if I change from a
function to a sub it does not error. Is there something wrong with my using
a function?
This is the delegate signature. Could someone try putting this in a windows
application and then try and use it in a form in the IDE.
Thanks
Pat Long
-
Re: Delegates
> Is there something wrong with my using a function?
Pat: I'm not sure what the problem is (might the name IsGreater already be
defined elsewhere?), but there's an example of exactly what you're trying to
do at http://www.freevbcode.com/ShowCode.Asp?ID=2150 .
---
Phil Weber
-
Re: Delegates
"Patrick Long" <Patrick_long@csi.com> wrote in message
news:3ade8be0$1@news.devx.com...
>
> Delegate Function IsGreater(ByVal v1 As Integer, ByVal v2 As Integer) As
> Boolean
>
> The error is "unexpected token 'Function' of type 'KW_Function' at line 61
> column 14. Expected a 'KW_Sub' token. Unsurprisingly if I change from a
> function to a sub it does not error. Is there something wrong with my
using
> a function?
What you're describing sounds like the WinForms Form Editor (specifically
its parser) failing to understand a function delegate. It has similar
problems with some attributes. If you think it is valid code try to compile
it. If I'm right, for the rest of beta 1 you'll have to either not use the
form editor or shift the code to another file.
>
> Thanks
>
> Pat Long
>
Regards,
Mark Hurd, B.Sc.(Ma.) (Hons.)
-
Re: Delegates
Hi Patrick,
I believe that is actually a known bug with Beta 1, and has been fixed for
later builds.
"Patrick Long" <Patrick_long@csi.com> wrote in message
news:3ade8be0$1@news.devx.com...
> I was looking at creating a simple generic sort routine yesterday. The
> routine would call a delegate function to do the "what is greater than
what"
> comparison. Seems simple enough but whenever I have what looks like a
> correct delegate signature declared in my form the form will not display
in
> the IDE and I get an error.
>
> Delegate Function IsGreater(ByVal v1 As Integer, ByVal v2 As Integer) As
> Boolean
>
> The error is "unexpected token 'Function' of type 'KW_Function' at line 61
> column 14. Expected a 'KW_Sub' token. Unsurprisingly if I change from a
> function to a sub it does not error. Is there something wrong with my
using
> a function?
>
> This is the delegate signature. Could someone try putting this in a
windows
> application and then try and use it in a form in the IDE.
>
> Thanks
>
> Pat Long
>
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks