Passing values new to vb.net 2ND QUESTION

PLEASE SEE MY LAST POST: http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21210943.html

BUT WHAT IF I ADD A 3RD ONE HOW DOES IT KNOW WHICH ONE TO CALL?
LVL 12
pigmentartsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pigmentartsAuthor Commented:
or if i want to call the Console.WriteLine(SetupGo.strSetupMessage) it does not work.

sorry about this just want to get my head around it
0
pigmentartsAuthor Commented:
all i really want to do is have a lots of class with different strings in which i can call from, any i want. this is not a project i am just playing and tring to understand how classes work.
0
koruzicaCommented:
You can have unlimited constructors; but they must differ by parameter types,
becouse thats how language distinguishes between them:

example:

class foo

public sub new()
end sub

public sub new(str as string)
end sub

public sub new(str as string, str2 as string)
end sub

public sub new(str as boolean)
end sub

end class

In this case all the constructors take different parameters (by type)
so if you call

dim class as new foo(TRUE)
it will be
public sub new(str as boolean)
which will be called

Simon
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

koruzicaCommented:
i must correct the example:

If you create a new class with the following call:

dim myClass as new foo(TRUE)

it will be:
public sub new(str as boolean)
which will be called
0
pigmentartsAuthor Commented:
i get it thank you, much better understanding, thanks
0
pigmentartsAuthor Commented:
but what if i wanted to call another string how does it knwo which one, in your example you have str and str2, so what if i wanted to call both or just one? would this work Dim SetupGo As New Setup( str as string, str2 as string)?
0
koruzicaCommented:
exactly :)

So if you need to pass 3 strings to your class,
then you must create new constructor in that class:

public sub new(str1 as string, str2 as string, str3 as string)
end sub

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pigmentartsAuthor Commented:
thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.