Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 14th, 2005, 01:08 PM
Registered User
 
Join Date: Feb 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Type Casting in VBA


I have a project wherein I need to cast an object as a Control. Unfortunately, I can't seem to get CType to work in VBA. Does VBA support the CType keyword, and if does, what specific references need to be set the project.

Thanks in Advance

Reply With Quote
  #2 (permalink)  
Old February 14th, 2005, 08:52 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

Unfortunately VBA doesn't support type casting. It isn't a fully object-oriented language. You can neither inherit classes in your own custom class definitions, nor can you get your objects to behave polymorphically (e.g., cast them as an instance of their base class). VB6 doesn't support inheritance/polymorphism either, but VB.NET and C# do.

HTH,

Bob

Reply With Quote
  #3 (permalink)  
Old March 5th, 2006, 04:49 PM
Registered User
 
Join Date: Mar 2006
Location: dhaka, dhaka, Bangladesh.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

what is VB6??


upama
Reply With Quote
  #4 (permalink)  
Old March 5th, 2006, 05:25 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

VB6 was Microsoft’s primary, high-level, Windows application development language and platform. About 3 million developers in the U.S. alone use it. Microsoft recently decided to discontinue development and support for it, however, and VB.NET (which is completely unlike VB6, ‘cept for the “V” and the “B”) and C# are Microsoft’s current, primary, high-level, Windows application development languages.

Bob

Reply With Quote
  #5 (permalink)  
Old March 5th, 2006, 08:10 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

 
Quote:
quote:VB6 doesn't support inheritance/polymorphism either, but VB.NET and C# do.


Should have said VB6 doesn't support implementation inheritance (which is why it doesn't support polymorphism either). It does, however, support interface inheritance (but by definition interfaces define empty members - methods, properties, etc. - and don't contain any member implementations). NET does all this stuff.

Bob

Reply With Quote
  #6 (permalink)  
Old April 13th, 2012, 02:43 PM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Type Casting in VBA is Partially Supported

If you want to find a control in the current sheet in excel for example named "MyLabel" and set it's image property to a file located on "C:\Images\Image1.jpg"
you can yuse the following code

==================================
Dim lbl As MSForms.Label
Set lbl = Me.OLEObjects("MyLabel").Object
lbl.Picture = LoadPicture("C:\Images\Image1.jpg")
===================================
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Casting pfrigo BOOK: Professional .NET 2.0 Generics 3 November 19th, 2007 04:49 PM
Casting - Can you help koco C# 1 September 24th, 2007 09:41 AM
Type Casting in VBA miriv365 VB.NET 0 February 14th, 2005 01:07 PM
casting textbox to sqlserver number data type yoord BOOK: Beginning ASP.NET 1.0 1 October 17th, 2004 07:09 AM



All times are GMT -4. The time now is 02:27 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.