473,399 Members | 3,401 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,399 software developers and data experts.

subroutine with fixed list of parameter

hi friend,

I have a function which can accept 2 parameters ,
one as any double value
second as "Y" or "N"

public sub abc(byval dblvalue as double,byval strvalue as string)

end sub
I want the subroutine to accept only "Y" or "N" as parameter else should
give error at design time when the subroutine is been used by other
programmers

how is this possible ?
I would also like to give description of the parameters when the user try to
enter the
parameters as we see in intellisence.

do we have to use reflection package ??

please give me the soln..
waiting !!

thanks

vipul
Nov 20 '05 #1
3 1208
"vipul DotNet" <yp***@hotmail.com> schrieb
hi friend,

I have a function which can accept 2 parameters ,
one as any double value
second as "Y" or "N"

public sub abc(byval dblvalue as double,byval strvalue as string)

end sub
I want the subroutine to accept only "Y" or "N" as parameter else
should give error at design time when the subroutine is been used by
other programmers

how is this possible ?

I would also like to give description of the parameters when the user
try to enter the
parameters as we see in intellisence.
public sub abc(byval dblvalue as double,byval value as BOOLEAN)

Convert value to a string only when necessary.

do we have to use reflection package ??

No.
--
Armin

Nov 20 '05 #2

thanks but my requirement is ...

what if i have to allow the programmer who is using my subroutine
should enter only the values out of which i provide to him

public sub abc(byval dblvalue as double,byval strvalue as string)

say i want the values from my list say strvalues=
"america"
"australia"
"newzeland"
"England"
and no other value in the second parameter ,which he should be able to
select by intellisence.
vipul
Nov 20 '05 #3
"vipul DotNet" <yp***@yahoo.com> schrieb

thanks but my requirement is ...

what if i have to allow the programmer who is using my subroutine
should enter only the values out of which i provide to him

public sub abc(byval dblvalue as double,byval strvalue as string)

say i want the values from my list say strvalues=
"america"
"australia"
"newzeland"
"England"
and no other value in the second parameter ,which he should be able
to select by intellisence.


Class Country
Public Shared ReadOnly America As New Country("America")
Public Shared ReadOnly Australia As New Country("Australia")

Public ReadOnly Name As String
Private Sub New(ByVal Name As String)
Me.Name = Name
End Sub
End Class
Procedure:
public sub abc(byval dblvalue as double,byval strvalue as COUNTRY)

Call:
abc(4711, Country.America)

Not "Country", but "America" will be listed when typing "Country."

- OR -

Enum Countries
America
Australia
End Enum

public sub abc(byval dblvalue as double,byval strvalue as Countries)

--
Armin

Nov 20 '05 #4

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

Similar topics

1
by: Hon Seng Phuah | last post by:
Hi, I am quite new to perl development and have a question very stupid question. I hope that someone can help me. Does perl support in/out parameter subroutine? Like in C/C++, we have a...
3
by: Bill | last post by:
I've got a subroutine, defined as Private, takes two parameters, that is called lots of times from different ASP scripts. I need specific error handling when it is called from only one particular...
1
by: Paul D. Fox | last post by:
I'd like to populate four dropdowns using code behind. Each dropdown contains the same list. How can I populate them using a subroutine. Something like: InitializeDropDownList(ddlQuadrant1)...
2
by: Richard | last post by:
Hi. How can I pass a subroutine as a parameter to another subroutine? How would the formal parameter list needs to be declared in order to receive a rubroutine (address)? Thanks in advance, ...
7
by: Richard Grant | last post by:
Hi. In c/C++ i can pass the address of a subroutine to another subroutine as an actual parameter How do I do that in VB .NET What should be the syntax for a parameter to receive the address of a...
3
by: IamIan | last post by:
I am using os.spawnv in Python 2.1 to do some geoprocessing in a subroutine/process. Everything works great, except when the processing is done the subroutine just waits for a couple minutes before...
2
by: Mark Drummond | last post by:
Hi all. I've been using Perl for many years now, but I am a "use it and learn it as you need it" type. I having some trouble passing a list to the "search" subroutine from Net::LDAP. I am trying...
2
by: mj.redfox.mj | last post by:
Hi, Pretty basic question, apologies but being a bit of a newbie I still don't know the answer to this kind of thing! I have a repeater which, upon databind calls a subroutine, as below: ...
3
by: sangith | last post by:
Hi, I have question on processing the file handle in a subroutine. Here is my program without subroutine: open FH1, "<outfile" or die "cannot open the file for reading: $!\n"; while...
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: 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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.