473,385 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Upcasting/ Downcasting in VB.NET?

Joe
I know that I can upcast and /downcast in C#. Can it be done in VB.NET? I
haven't seen any documentation on it.

TIA,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
Nov 19 '05 #1
3 4558
Using ctype you mean?
http://www.codeproject.com/dotnet/Ch...CastingNET.asp

dim s as string = "hello"
dim o as object = s 'automatically cast
dim x as string = ctype(o, string) 'or cstr

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Joe" <jo******@donotspam.yahoo.com> wrote in message
news:C4**********************************@microsof t.com...
I know that I can upcast and /downcast in C#. Can it be done in VB.NET? I
haven't seen any documentation on it.

TIA,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation

Nov 19 '05 #2
Yes, this is called "Boxing" and is a principle concept in the .NET Framework
and OO in general.

"Joe" wrote:
I know that I can upcast and /downcast in C#. Can it be done in VB.NET? I
haven't seen any documentation on it.

TIA,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation

Nov 19 '05 #3
Actually, boxing (as far as .NET is concerned) is an internal process
used to convert value types to references types. This is what allows
you, for instance, to assign an integer to an object reference.

I suspect the ctype reference in a previous post is what the original
question was looking for.

Jason L Lind wrote:
Yes, this is called "Boxing" and is a principle concept in the .NET Framework
and OO in general.

"Joe" wrote:

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: lawrence | last post by:
Lets suppose I have an class called DatastoreSelect. It has a method called getNextRow(). This method is not abstract, it is fully implemented. It also has a method called setInfoToBeSought, which...
6
by: Stuart Golodetz | last post by:
Hi, I've got a minor casting issue which I need to check about (marked // <--). I was trying to do a static_cast on it (which didn't work, though I'm not sure why this should be the case?) I...
2
by: Judith | last post by:
Hi there everyone I've got: class A { ... }; class B : public A { ... }
4
by: juli jul | last post by:
Hello, I did the following with Class A which is a parent and B inherits from it: B b1=new B(); A a1=new A(); a1=b1; Is it an upcasting in c#? Thank you!
4
by: Amod | last post by:
I want to call a child class constructor using the base class instance ... whats the xact mechanism to perform this function ? Regards, Amod
5
by: Mark | last post by:
I can't seem to get this subclass to upcast to a baseclass... see comments below #include <cstdlib> #include <iostream> #include "Base.h" #include "Sub1.h" using namespace std;
3
by: mati-006 | last post by:
Hi, I think the code will be the best way to explain what I mean: #include "arglib/arg_shared.h" class base { public: base() {} virtual ~base() {} };
5
by: Ryan van Roode | last post by:
Hello, An API function gives me an object of class 'Blah'. I have subclassed 'Blah' and added a few methods: class EnhancedBlah extends Blah { function enhancement1() {} function...
4
by: majsta | last post by:
Hello, I have the following code. #include <vector> #include <iostream> class Foo { public: Foo(){} virtual void print() const { std::cout << "foo" << std::endl;} };
0
by: Juha Nieminen | last post by:
If I'm not mistaken, general OOP wisdom says that upcasting should usually be avoided if possible. I have a situation, however, where I can't think of a better way than upcasting for this specific...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.