473,387 Members | 1,435 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,387 software developers and data experts.

Help with comp creation

Hi,
I am trying to follow the same structure as the MS Application Blocks for my
local stuff. I am trying to create an application block to process payments
which I'll hand out to other developers in my company. I created the project
Company.Application.Payment and in that project I created one class called
PaymentHelper.vb after compling I created a new project (win form) and then
reference the Company.Application.Payment.dll I then Imports
Company.Application.Payment. The problem is If I create a new sub and then
try

Private Sub CallComp()

PaymentHelper.ProcessPayment()

End Sub

it doesn't work. I have to do the foll

Private Sub CallComp()

Dim test as new PaymentHelper

test.ProcessPayment()

End Sub

Why?
Sep 22 '05 #1
3 1222
CT
You need to make the ProcessPayment method a Shared function in order to
access without creating an instance of the PaymentHelp class. Check out the
Shared keyword in the MSDN docs.

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, AND MSF
http://www.apress.com/book/bookDisplay.html?bID=105
Communities - http://community.integratedsolutions.dk

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
Hi,
I am trying to follow the same structure as the MS Application Blocks for
my
local stuff. I am trying to create an application block to process
payments
which I'll hand out to other developers in my company. I created the
project
Company.Application.Payment and in that project I created one class called
PaymentHelper.vb after compling I created a new project (win form) and
then
reference the Company.Application.Payment.dll I then Imports
Company.Application.Payment. The problem is If I create a new sub and then
try

Private Sub CallComp()

PaymentHelper.ProcessPayment()

End Sub

it doesn't work. I have to do the foll

Private Sub CallComp()

Dim test as new PaymentHelper

test.ProcessPayment()

End Sub

Why?

Sep 23 '05 #2
Thanks. One question though. Whats the difference on having

PaymentHelper.ProcessPayment()

instead of

Dim test as new PaymentHelper

test.ProcessPayment()

Thanks

"CT" wrote:
You need to make the ProcessPayment method a Shared function in order to
access without creating an instance of the PaymentHelp class. Check out the
Shared keyword in the MSDN docs.

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, AND MSF
http://www.apress.com/book/bookDisplay.html?bID=105
Communities - http://community.integratedsolutions.dk

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
Hi,
I am trying to follow the same structure as the MS Application Blocks for
my
local stuff. I am trying to create an application block to process
payments
which I'll hand out to other developers in my company. I created the
project
Company.Application.Payment and in that project I created one class called
PaymentHelper.vb after compling I created a new project (win form) and
then
reference the Company.Application.Payment.dll I then Imports
Company.Application.Payment. The problem is If I create a new sub and then
try

Private Sub CallComp()

PaymentHelper.ProcessPayment()

End Sub

it doesn't work. I have to do the foll

Private Sub CallComp()

Dim test as new PaymentHelper

test.ProcessPayment()

End Sub

Why?


Sep 23 '05 #3
CT
It depends on what the method does; it it doesn't store any intermdiate data
in the Payment class, there's no difference. However, if it does manipulate
any data in the class, i.e. not saved to a persistent storage such as a file
or a database, then you migth have a problem, in that the class is shared
between multiple callers, and not just the copy you have when you create an
instance of the class. There's more to it than that, but that shoudl give
you an idea.

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, AND MSF
http://www.apress.com/book/bookDisplay.html?bID=105
Communities - http://community.integratedsolutions.dk

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:AE**********************************@microsof t.com...
Thanks. One question though. Whats the difference on having

PaymentHelper.ProcessPayment()

instead of

Dim test as new PaymentHelper

test.ProcessPayment()

Thanks

"CT" wrote:
You need to make the ProcessPayment method a Shared function in order to
access without creating an instance of the PaymentHelp class. Check out
the
Shared keyword in the MSDN docs.

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, AND MSF
http://www.apress.com/book/bookDisplay.html?bID=105
Communities - http://community.integratedsolutions.dk

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
> Hi,
> I am trying to follow the same structure as the MS Application Blocks
> for
> my
> local stuff. I am trying to create an application block to process
> payments
> which I'll hand out to other developers in my company. I created the
> project
> Company.Application.Payment and in that project I created one class
> called
> PaymentHelper.vb after compling I created a new project (win form) and
> then
> reference the Company.Application.Payment.dll I then Imports
> Company.Application.Payment. The problem is If I create a new sub and
> then
> try
>
> Private Sub CallComp()
>
> PaymentHelper.ProcessPayment()
>
> End Sub
>
> it doesn't work. I have to do the foll
>
> Private Sub CallComp()
>
> Dim test as new PaymentHelper
>
> test.ProcessPayment()
>
> End Sub
>
> Why?


Sep 23 '05 #4

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

Similar topics

2
by: Gary L. Burnore | last post by:
REQUEST FOR DISCUSSION (RFD) unmoderated group comp.databases.mysql This is an invitation to discuss the following proposal to create newsgroup comp.databases.mysql. Please note that YOU CANNOT...
8
by: William Drew | last post by:
REQUEST FOR DISCUSSION (RFD) unmoderated group comp.databases.mysql This is an invitation to discuss the following proposal to create newsgroup comp.databases.mysql. Please note that YOU...
0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
0
by: Jonathan Grobe | last post by:
From: Nigel Perry <nigel@cosc.canterbury.ac.nz> Newsgroups: news.announce.newgroups,news.groups Subject: RFD: comp.std.csharp Date: Tue, 08 Jul 2003 00:26:01 +0000 REQUEST FOR DISCUSSION (RFD)...
0
by: Cara | last post by:
LAST CALL FOR VOTES (of 2) unmoderated group comp.databases.etl Newsgroups line: comp.databases.etl Extraction, transformation, loading issues. Votes must be received by 23:59:59 UTC, 12 Dec...
0
by: Cara Altman | last post by:
REQUEST FOR DISCUSSION (RFD) unmoderated group comp.databases.etl This is a formal Request For Discussion (RFD) for the creation of a world-wide unmoderated Usenet newsgroup...
11
by: Christopher Benson-Manica | last post by:
At the moment, I've got the following situation (not my code): // Assume appropriate headers have been included enum MyType { ctypeNone, ctypeA, ctypeB, ctypeC }; class MyBaseClass { static...
7
by: Eric Gunnerson | last post by:
If you would like to see this group created, please reply to this post, making sure you leave news.groups on the newsgroups line. "Nigel Perry" <nigel@cosc.canterbury.ac.nz> wrote in message...
6
by: Andy | last post by:
Someone posted this official proposal to create comp.databases.postgresql.general again. He wrote his own charter. As far as I know, he did not consult any of the postgresql groups first. There...
8
by: vicktorio | last post by:
Hi there, I want to design a Visual C++(or atleast a C++) USB HID GUI. The problem is that I don't know much about USB or even developing applications with it. So what I need is something to...
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: 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
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: 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
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...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.