Class design ToString

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

is there anyway of creating a class so that when it is used as the object
directly it does the toSting implementation
ie
public class recordID
private mid as string
public overloads function Tostring as string
retrun mid
end function
end class
so if i was using recorid anywhere then i dont get unable to convert to
string error
 
What you want is not available in VB.NET for VS2003, you need to overload the
"+" operation and the Cast operation which will be available in VS2005.
 
On Fri, 15 Apr 2005 10:04:02 -0700, "Jorge Matos"

You mean you can't do this in VB.NET?:

public override string ToString()
{
return TheStringYouWantToReturn;
}
What you want is not available in VB.NET for VS2003, you need to overload the
"+" operation and the Cast operation which will be available in VS2005.

Otis Mukinfus
http://www.otismukinfus.com
 
Back
Top