473,385 Members | 1,275 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.

Using Functions Inside A Shared Member

I have a class that is just a bunch of Shared functions (basically, a bunch
of utilities I have grouped together). However, there are functions that I
want to write to use inside some of these Shared members that I do not want
available outside the class. Here is the basic layout of my class:
Public Class Utilities
Public Shared Function Utility1() As String
End Function

Private Function UtilityHelper() As Integer
End Function
End Class
I would like to use my function UtilityHelper() inside Utility1(), but not
make it available outside the class. However, when I try to do this I
recieve the following error:

Cannot refer to an instance member of a class from within a shared method or
shared member initializer without an explicit instance of the class.

How can I write methods that are used only inside a class, and can be used
in the class's Shared members? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Oct 28 '07 #1
1 1162
Private Shared Function ...
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:uF**************@TK2MSFTNGP05.phx.gbl...
>I have a class that is just a bunch of Shared functions (basically, a bunch
of utilities I have grouped together). However, there are functions that I
want to write to use inside some of these Shared members that I do not want
available outside the class. Here is the basic layout of my class:
Public Class Utilities
Public Shared Function Utility1() As String
End Function

Private Function UtilityHelper() As Integer
End Function
End Class
I would like to use my function UtilityHelper() inside Utility1(), but not
make it available outside the class. However, when I try to do this I
recieve the following error:

Cannot refer to an instance member of a class from within a shared method
or shared member initializer without an explicit instance of the class.

How can I write methods that are used only inside a class, and can be used
in the class's Shared members? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Oct 28 '07 #2

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

Similar topics

2
by: Wenjie | last post by:
Hello, I read someone posted assertions that even the (public) member function is not static, there are probably only one copy of the code in the executable. Then except the...
28
by: Daniel | last post by:
Hello =) I have an object which contains a method that should execute every x ms. I can use setInterval inside the object construct like this - self.setInterval('ObjectName.methodName()',...
1
by: Bryan Parkoff | last post by:
I know how to write "Pointer to Function" inside struct or class without using static, but I have decided to add static to all functions inside struct or class because I want member functions to be...
2
by: Henry | last post by:
Hi guys, I want to write some global functions which can be called from different asp.net page. In Visual Basic, there is a global module which allow me to do that. In Visual Basic .net, I...
11
by: tshad | last post by:
I am setting up some of my functions in a class called MyFunctions. I am not clear as to the best time to set a function as Shared and when not to. For example, I have the following bit...
4
by: Rubbrecht Philippe | last post by:
Hi there, I would like to develop an interface that when implemented in a class requires a number of shared properties or methods to be available. It seems a Shared Member can not be used as...
8
by: desktop | last post by:
I have read that the allocator class has the following nonmember functions: template <class In, class ForFor uninitialized_copy(In,In,For); template <class For, class T> void...
13
by: Chris Carlen | last post by:
Hi: I have begun learning Python by experimenting with the code snippets here: http://hetland.org/writing/instant-python.html In the section on functions, Magnus Lie Hetland writes: ...
4
by: dougans | last post by:
Hey there, Hope someone can help me, completely stuck with immigrating from php4 to OOP based php5. == index.php -- include(database.inc.php);
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.