<snip>
> However, when I try to call the validation function like this:
>
[quoted text clipped - 3 lines]
> I get an error stating "Value of type StringRecord cannot be converted
> to BaseRecord(Of Object)"
And indeed it can't. It's a BaseRecord(Of String). They're not
compatible types.
> I have tried making the function "Byval record as BaseRecord(Of T)"
> but it states that "Type T is not defined"
>
> Is there a way to pass this record as I am attempting or do I need to
> completely rethink the way I am wanting to do validation?
Make the method generic as well. I'm afraid I don't know the syntax for
that in VB, but in C# you'd write:
public static bool ValidateRecord<T> (BaseRecord<T> record)
{
return record.ID >= 0;
}

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
Mike - 05 Mar 2008 20:51 GMT
>On Mar 5, 11:52 am, Jon Skeet [C# MVP] <sk...@pobox.com> wrote:
>
[quoted text clipped - 10 lines]
> Jon Skeet - <sk...@pobox.com>http://www.pobox.com/~skeet Blog:http://www.msmvps.com/jon.skeet
> World class .NET training in the UK:http://iterativetraining.co.uk
Thanks, that worked perfectly!
For an VB users who may come across this post, the VB equivelant line
is:
Public Shared Function ValidateRecord(Of T)(ByVal record As
BaseRecord(Of T)) As Boolean
(a lengthy statement, but it gets the job done.
Thanks,
Mike Clark