[dba-VB] VB.Net - Option Strict disallows implicit conversion

Charlotte Foust cfoust at infostatsystems.com
Thu Jul 19 10:09:03 CDT 2007


That's one problem I always have with the books too, they tend to use a
lot of implicit conversion.  Of course, you learn a lot from making the
examples work with option strict on.  There are various ways to do it,
John.  You can use a Ctype() function to convert the object to a
clsSomething like this:  Ctype(SerializeData(....), clsSomething).  You
can also use a DirectCast function.

Charlotte Foust 

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Thursday, July 19, 2007 8:00 AM
To: dba-vb at databaseadvisors.com
Subject: [dba-VB] VB.Net - Option Strict disallows implicit conversion

I operate under Option Strict.  I have a situation where I am trying to
use code from a book.  That code assigns an object type to a class, i.e.

Dim lcls as clsSomething = SerializeData(...

SerializeData returns an object.  

How do I cast Serialize data to return a type clsSomething so that I
don't get the "option strict disallows..." error message? 

John W. Colby
Colby Consulting
www.ColbyConsulting.com 

_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com





More information about the dba-VB mailing list