Calling Classes in Win 8.1
Calling Classes in Win 8.1
Calling Classes in Win 8.1
Calling Classes in Win 8.1
Calling Classes in Win 8.1
Calling Classes in Win 8.1 Calling Classes in Win 8.1 Calling Classes in Win 8.1 Calling Classes in Win 8.1 Calling Classes in Win 8.1 Calling Classes in Win 8.1 Calling Classes in Win 8.1 Calling Classes in Win 8.1
Calling Classes in Win 8.1 Calling Classes in Win 8.1
Calling Classes in Win 8.1
Go Back  Xtreme Visual Basic Talk > > > Calling Classes in Win 8.1


Reply
 
Thread Tools Display Modes
  #1  
Old 08-13-2015, 11:17 AM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default Calling Classes in Win 8.1


Does anyone have any experience with using VBNet 2010
running in windows 8.1?

I just noticed that when i create a class and place a public
sub inside of it, the form can not access any sub sub inside
of the class with first creating a SHARED sub.

Before, i could just write the sub like this:
Public Sub Whatever()

Now i have to write it out like this, in order for the form
to have access to it:
Public Shared Sub Whatever()

I'm just wondering if anyone else has experienced this since
switching over to windows 8.1.

I never had to do this in windows 7.
Reply With Quote
  #2  
Old 08-13-2015, 04:48 PM
passel's Avatar
passelCalling Classes in Win 8.1 passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,024
Default

I don't have Windows 8.x available, so can test anything, but it doesn't make much sense to me.
What is your class name?
What is your instance name?
What does the line calling the Sub look like?
What scope is the class defined in?

Give a short example of code that fails in Win8, but not in Win7 so we can compare.
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote
  #3  
Old 08-14-2015, 11:14 AM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default

Here is a little app i made. It does nothing
at all though.

Just try calling the PLAYER from the form
and see if intellesense picks up the sub
inside the class that isn't a shared sub.

Also found out that public variables work
the same way. They have to be a shared
variable before they can be detected.
Attached Files
File Type: zip TestApp.zip (68.2 KB, 1 views)
Reply With Quote
  #4  
Old 08-14-2015, 01:31 PM
PlausiblyDamp's Avatar
PlausiblyDampCalling Classes in Win 8.1 PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

That is exactly how things should work...

If you want to access non-shared members then you need to create an instance of the Player class.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #5  
Old 08-14-2015, 08:32 PM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default

Your probably right PlausiblyDamp. I did a little
search today and at first i wasn't finding anything
useful but eventually i start running into a lot of
website that used their classes the same way that
i have to now, sharing subs inside a class.

It's funny though that i never had to do that using
windows 7. That's a head scratcher..
Reply With Quote
  #6  
Old 08-15-2015, 06:09 PM
PlausiblyDamp's Avatar
PlausiblyDampCalling Classes in Win 8.1 PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

That is how classes have worked since .Net 1.0 - if you want to access a member through the class name then the member needs to be shared, otherwise you need to go via an instance of the class.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #7  
Old 08-16-2015, 10:03 AM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default

Thank you passel and PlausiblyDamp. Both of
you were right about creating an instance of the class.

I had completely forgotten to do that.

On the upside side of things though, i learned another
way, to access a class by sharing it's subs, functions
and variables.

Thanks to both of you for your help.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Calling Classes in Win 8.1
Calling Classes in Win 8.1
Calling Classes in Win 8.1 Calling Classes in Win 8.1
Calling Classes in Win 8.1
Calling Classes in Win 8.1
Calling Classes in Win 8.1 Calling Classes in Win 8.1 Calling Classes in Win 8.1 Calling Classes in Win 8.1 Calling Classes in Win 8.1 Calling Classes in Win 8.1 Calling Classes in Win 8.1
Calling Classes in Win 8.1
Calling Classes in Win 8.1
 
Calling Classes in Win 8.1
Calling Classes in Win 8.1
 
-->