Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Declaring/populating variable arrays in ASP.NET???

Reply
Thread Tools

Declaring/populating variable arrays in ASP.NET???

 
 
Friday
Guest
Posts: n/a
 
      05-06-2005
Sorry if this is the wrong group. I tried to find the one I thought
would be most relevant.

I'm an old PHP guy, who knows little about asp and NOTHING about
asp.net, but need to learn at least enough to convert a favorite PHP
script to work on an ASP.NET site.

I'm experimenting with simple example scripts that will help me learn
how to implement each "piece" of the puzzle.

Doing well so far... one piece of the puzzle at a time.
I need to create a simple funtion that will check the IP Address of a
visitor against an "array variable" of banned IPs.

In asp, it saeems simple enough. Here's the include that contains the
function to be called (in .asp):

##############################
<%
Dim sIPAddress
sIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
if sIPAddress = "" then
sIPAddress = Request.ServerVariables("REMOTE_ADDR")
End If
%>

<script language="VB" runat=server>

function BannedIP(sIPAddress)
Dim sBanned
sBanned =
Array("69.202.123.157","216.239.39.5","216.239.37. 5","216.239.37.104","2
16.155.200.231","216.155.200.232","216.155.200.233 ","216.155.200.234")

Dim i
For i = 0 to UBound( [sBanned] )
If selCriteria(i,1) = cstr(sBanned) Then
BannedIP = TRUE
Else
BannedIP = false
End Function

</script>
################################

The function is called from an existing .aspx page thus:
################################
if BannedIP(sIPAddress) then
' show it the "SORRY" page
Server.Execute("sorry.aspx")
' Then STOP! (same as PHP's "exit;" statement ???)
Response.End
' otherwise it's cool, go ahead and display this page below
End If
################################

ASP.NET doesn't like this at all!
It tells me: "'Array' is a type and cannot be used as an expression."


What is the proper syntax in ASP.NET for:
variable = Array("value1","value2","value3")

I would simply use the function as is, written in asp, but the pages
are VERY .aspx and choke on it.


ALSO: My next piece of the puzzle will be to tackle this one, using the
same test script:
If I want e to ban a violator with a dynamic IP, how do I deal with
entire C-blocks (e.g.: BannedIP is TRUE if sIPAdress contains
123.45.6.*)


Many TIA

Friday

--
#####################################
"The people cannot be all, & always well informed. The part which is wrong will
be discontented in proportion to the importance of the facts they misconceive.
If they remain quiet under such misconceptions it is a lethargy, the forerunner
of death to the public liberty. What country before ever existed a century & a
half without a rebellion? & what country can preserve it's liberties if their
rulers are not warned from time to time that their people preserve the spirit
of resistance? Let them take arms... The tree of liberty must be refreshed from
time to time with the blood of patriots & tyrants"
-- Thomas Jefferson
#####################################
 
Reply With Quote
 
 
 
 
Jody Gelowitz
Guest
Posts: n/a
 
      05-06-2005
> What is the proper syntax in ASP.NET for:
> variable = Array("value1","value2","value3")



Dim sBanned() As String =
{"69.202.123.157","216.239.39.5","216.239.37.5","2 16.239.37.104","216.155.200.231","216.155.200.232" ,"216.155.200.233","216.155.200.234"}

Jody


"Friday" <> wrote in message
news:060520051306302444%...
> Sorry if this is the wrong group. I tried to find the one I thought
> would be most relevant.
>
> I'm an old PHP guy, who knows little about asp and NOTHING about
> asp.net, but need to learn at least enough to convert a favorite PHP
> script to work on an ASP.NET site.
>
> I'm experimenting with simple example scripts that will help me learn
> how to implement each "piece" of the puzzle.
>
> Doing well so far... one piece of the puzzle at a time.
> I need to create a simple funtion that will check the IP Address of a
> visitor against an "array variable" of banned IPs.
>
> In asp, it saeems simple enough. Here's the include that contains the
> function to be called (in .asp):
>
> ##############################
> <%
> Dim sIPAddress
> sIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
> if sIPAddress = "" then
> sIPAddress = Request.ServerVariables("REMOTE_ADDR")
> End If
> %>
>
> <script language="VB" runat=server>
>
> function BannedIP(sIPAddress)
> Dim sBanned
> sBanned =
> Array("69.202.123.157","216.239.39.5","216.239.37. 5","216.239.37.104","2
> 16.155.200.231","216.155.200.232","216.155.200.233 ","216.155.200.234")
>
> Dim i
> For i = 0 to UBound( [sBanned] )
> If selCriteria(i,1) = cstr(sBanned) Then
> BannedIP = TRUE
> Else
> BannedIP = false
> End Function
>
> </script>
> ################################
>
> The function is called from an existing .aspx page thus:
> ################################
> if BannedIP(sIPAddress) then
> ' show it the "SORRY" page
> Server.Execute("sorry.aspx")
> ' Then STOP! (same as PHP's "exit;" statement ???)
> Response.End
> ' otherwise it's cool, go ahead and display this page below
> End If
> ################################
>
> ASP.NET doesn't like this at all!
> It tells me: "'Array' is a type and cannot be used as an expression."
>
>
> What is the proper syntax in ASP.NET for:
> variable = Array("value1","value2","value3")
>
> I would simply use the function as is, written in asp, but the pages
> are VERY .aspx and choke on it.
>
>
> ALSO: My next piece of the puzzle will be to tackle this one, using the
> same test script:
> If I want e to ban a violator with a dynamic IP, how do I deal with
> entire C-blocks (e.g.: BannedIP is TRUE if sIPAdress contains
> 123.45.6.*)
>
>
> Many TIA
>
> Friday
>
> --
> #####################################
> "The people cannot be all, & always well informed. The part which is wrong
> will
> be discontented in proportion to the importance of the facts they
> misconceive.
> If they remain quiet under such misconceptions it is a lethargy, the
> forerunner
> of death to the public liberty. What country before ever existed a century
> & a
> half without a rebellion? & what country can preserve it's liberties if
> their
> rulers are not warned from time to time that their people preserve the
> spirit
> of resistance? Let them take arms... The tree of liberty must be refreshed
> from
> time to time with the blood of patriots & tyrants"
> -- Thomas Jefferson
> #####################################



 
Reply With Quote
 
 
 
 
Friday
Guest
Posts: n/a
 
      05-06-2005
In article <>, Jody Gelowitz
<> wrote:

> > What is the proper syntax in ASP.NET for:
> > variable = Array("value1","value2","value3")

>
>
> Dim sBanned() As String =
>
> {"69.202.123.157","216.239.39.5","216.239.37.5","2 16.239.37.104","216.155.200.
> 231","216.155.200.232","216.155.200.233","216.155. 200.234"}
>
> Jody


Many Thanks!
Can't wait to try it.

>
>
> "Friday" <> wrote in message
> news:060520051306302444%...
> > Sorry if this is the wrong group. I tried to find the one I thought
> > would be most relevant.
> >
> > I'm an old PHP guy, who knows little about asp and NOTHING about
> > asp.net, but need to learn at least enough to convert a favorite PHP
> > script to work on an ASP.NET site.
> >
> > I'm experimenting with simple example scripts that will help me learn
> > how to implement each "piece" of the puzzle.
> >
> > Doing well so far... one piece of the puzzle at a time.
> > I need to create a simple funtion that will check the IP Address of a
> > visitor against an "array variable" of banned IPs.
> >
> > In asp, it saeems simple enough. Here's the include that contains the
> > function to be called (in .asp):
> >
> > ##############################
> > <%
> > Dim sIPAddress
> > sIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
> > if sIPAddress = "" then
> > sIPAddress = Request.ServerVariables("REMOTE_ADDR")
> > End If
> > %>
> >
> > <script language="VB" runat=server>
> >
> > function BannedIP(sIPAddress)
> > Dim sBanned
> > sBanned =
> > Array("69.202.123.157","216.239.39.5","216.239.37. 5","216.239.37.104","2
> > 16.155.200.231","216.155.200.232","216.155.200.233 ","216.155.200.234")
> >
> > Dim i
> > For i = 0 to UBound( [sBanned] )
> > If selCriteria(i,1) = cstr(sBanned) Then
> > BannedIP = TRUE
> > Else
> > BannedIP = false
> > End Function
> >
> > </script>
> > ################################
> >
> > The function is called from an existing .aspx page thus:
> > ################################
> > if BannedIP(sIPAddress) then
> > ' show it the "SORRY" page
> > Server.Execute("sorry.aspx")
> > ' Then STOP! (same as PHP's "exit;" statement ???)
> > Response.End
> > ' otherwise it's cool, go ahead and display this page below
> > End If
> > ################################
> >
> > ASP.NET doesn't like this at all!
> > It tells me: "'Array' is a type and cannot be used as an expression."
> >
> >
> > What is the proper syntax in ASP.NET for:
> > variable = Array("value1","value2","value3")
> >
> > I would simply use the function as is, written in asp, but the pages
> > are VERY .aspx and choke on it.
> >
> >
> > ALSO: My next piece of the puzzle will be to tackle this one, using the
> > same test script:
> > If I want e to ban a violator with a dynamic IP, how do I deal with
> > entire C-blocks (e.g.: BannedIP is TRUE if sIPAdress contains
> > 123.45.6.*)
> >
> >
> > Many TIA
> >
> > Friday
> >
> > --
> > #####################################
> > "The people cannot be all, & always well informed. The part which is wrong
> > will
> > be discontented in proportion to the importance of the facts they
> > misconceive.
> > If they remain quiet under such misconceptions it is a lethargy, the
> > forerunner
> > of death to the public liberty. What country before ever existed a century
> > & a
> > half without a rebellion? & what country can preserve it's liberties if
> > their
> > rulers are not warned from time to time that their people preserve the
> > spirit
> > of resistance? Let them take arms... The tree of liberty must be refreshed
> > from
> > time to time with the blood of patriots & tyrants"
> > -- Thomas Jefferson
> > #####################################

>
>


--
#####################################
"The people cannot be all, & always well informed. The part which is wrong will
be discontented in proportion to the importance of the facts they misconceive.
If they remain quiet under such misconceptions it is a lethargy, the forerunner
of death to the public liberty. What country before ever existed a century & a
half without a rebellion? & what country can preserve it's liberties if their
rulers are not warned from time to time that their people preserve the spirit
of resistance? Let them take arms... The tree of liberty must be refreshed from
time to time with the blood of patriots & tyrants"
-- Thomas Jefferson
#####################################
 
Reply With Quote
 
Friday
Guest
Posts: n/a
 
      05-06-2005
In article <>, Jody Gelowitz
<> wrote:

> > What is the proper syntax in ASP.NET for:
> > variable = Array("value1","value2","value3")

>
>
> Dim sBanned() As String =
>
> {"69.202.123.157","216.239.39.5","216.239.37.5","2 16.239.37.104","216.155.200.
> 231","216.155.200.232","216.155.200.233","216.155. 200.234"}
>
> Jody


Darn...
Now I'm geting an error: "Expression expected."

at: Dim sBanned() As String =

Something else wrong withmy little fndtion.
Any thoughts?

Now my little test reads:
##############################
<%
Dim sIPAddress
sIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
if sIPAddress = "" then
sIPAddress = Request.ServerVariables("REMOTE_ADDR")
End If
%>

<script language="VB" runat=server>

function BannedIP(sIPAddress)

Dim sBanned() As String =
("69.202.123.157","216.239.39.5","216.239.37.5","2 16.239.37.104","2
16.155.200.231","216.155.200.232","216.155.200.233 ","216.155.200.234")

Dim i
For i = 0 to UBound( [sBanned] )
If selCriteria(i,1) = cstr(sBanned) Then
BannedIP = TRUE
Else
BannedIP = false
End Function

</script>
################################

The function is called from an existing .aspx page thus:
################################
if BannedIP(sIPAddress) then
' show it the "SORRY" page
Server.Execute("sorry.aspx")
' Then STOP! (same as PHP's "exit;" statement ???)
Response.End
' otherwise it's cool, go ahead and display this page below
End If
################################

--
#####################################
"The people cannot be all, & always well informed. The part which is wrong will
be discontented in proportion to the importance of the facts they misconceive.
If they remain quiet under such misconceptions it is a lethargy, the forerunner
of death to the public liberty. What country before ever existed a century & a
half without a rebellion? & what country can preserve it's liberties if their
rulers are not warned from time to time that their people preserve the spirit
of resistance? Let them take arms... The tree of liberty must be refreshed from
time to time with the blood of patriots & tyrants"
-- Thomas Jefferson
#####################################
 
Reply With Quote
 
Brock Allen
Guest
Posts: n/a
 
      05-06-2005
Dim sBan as String() = {...}

-Brock
DevelopMentor
http://staff.develop.com/ballen



> In article <>, Jody Gelowitz
> <> wrote:
>
>>> What is the proper syntax in ASP.NET for:
>>> variable = Array("value1","value2","value3")

>> Dim sBanned() As String =
>>
>> {"69.202.123.157","216.239.39.5","216.239.37.5","2 16.239.37.104","216
>> .155.200. 231","216.155.200.232","216.155.200.233","216.155. 200.234"}
>>
>> Jody
>>

> Darn...
> Now I'm geting an error: "Expression expected."
> at: Dim sBanned() As String =
>
> Something else wrong withmy little fndtion.
> Any thoughts?
> Now my little test reads:
> ##############################
> <%
> Dim sIPAddress
> sIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
> if sIPAddress = "" then
> sIPAddress = Request.ServerVariables("REMOTE_ADDR")
> End If
> %>
> <script language="VB" runat=server>
>
> function BannedIP(sIPAddress)
>
> Dim sBanned() As String =
> ("69.202.123.157","216.239.39.5","216.239.37.5","2 16.239.37.104","2
> 16.155.200.231","216.155.200.232","216.155.200.233 ","216.155.200.234")
>
> Dim i
> For i = 0 to UBound( [sBanned] )
> If selCriteria(i,1) = cstr(sBanned) Then
> BannedIP = TRUE
> Else
> BannedIP = false
> End Function
> </script>
> ################################
> The function is called from an existing .aspx page thus:
> ################################
> if BannedIP(sIPAddress) then
> ' show it the "SORRY" page
> Server.Execute("sorry.aspx")
> ' Then STOP! (same as PHP's "exit;" statement ???)
> Response.End
> ' otherwise it's cool, go ahead and display this page below
> End If
> ################################




 
Reply With Quote
 
John H W
Guest
Posts: n/a
 
      05-06-2005
Friday, Jody's replied on the Array, but the syntac on your VB code needs a
couple of tweeks:
function BannedIP(sIPAddress as String) as Boolean
Dim sBanned, i as integar

sBanned = _
Array("69.202.123.157","216.239.39.5","216.239.37. 5","216.239.37.104", _
"216.155.200.231","216.155.200.232","216.155.200.2 33","216.155.200.234")

For i = 0 to UBound( [sBanned] )
If sIPAddress = cstr(sBanned(i)) Then
BannedIP = TRUE
Exit For
Else
BannedIP = false
End If
Next
End Function

I am assuming that you are passing the IPAddress to be checked. Also, if you
want to check through the whole array, you will want to check each element of
the array. Also, you will want to break if it finds a banned address.

Just to let you know, I have 25 years of C, C++, C#, and only 1 year of VB
(and then only in MS Office. So you might know more about VB than I.

John H W

"Friday" wrote:

> Sorry if this is the wrong group. I tried to find the one I thought
> would be most relevant.
>
> I'm an old PHP guy, who knows little about asp and NOTHING about
> asp.net, but need to learn at least enough to convert a favorite PHP
> script to work on an ASP.NET site.
>
> I'm experimenting with simple example scripts that will help me learn
> how to implement each "piece" of the puzzle.
>
> Doing well so far... one piece of the puzzle at a time.
> I need to create a simple funtion that will check the IP Address of a
> visitor against an "array variable" of banned IPs.
>
> In asp, it saeems simple enough. Here's the include that contains the
> function to be called (in .asp):
>
> ##############################
> <%
> Dim sIPAddress
> sIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
> if sIPAddress = "" then
> sIPAddress = Request.ServerVariables("REMOTE_ADDR")
> End If
> %>
>
> <script language="VB" runat=server>
>
> function BannedIP(sIPAddress)
> Dim sBanned
> sBanned =
> Array("69.202.123.157","216.239.39.5","216.239.37. 5","216.239.37.104","2
> 16.155.200.231","216.155.200.232","216.155.200.233 ","216.155.200.234")
>
> Dim i
> For i = 0 to UBound( [sBanned] )
> If selCriteria(i,1) = cstr(sBanned) Then
> BannedIP = TRUE
> Else
> BannedIP = false
> End Function
>
> </script>
> ################################
>
> The function is called from an existing .aspx page thus:
> ################################
> if BannedIP(sIPAddress) then
> ' show it the "SORRY" page
> Server.Execute("sorry.aspx")
> ' Then STOP! (same as PHP's "exit;" statement ???)
> Response.End
> ' otherwise it's cool, go ahead and display this page below
> End If
> ################################
>
> ASP.NET doesn't like this at all!
> It tells me: "'Array' is a type and cannot be used as an expression."
>
>
> What is the proper syntax in ASP.NET for:
> variable = Array("value1","value2","value3")
>
> I would simply use the function as is, written in asp, but the pages
> are VERY .aspx and choke on it.
>
>
> ALSO: My next piece of the puzzle will be to tackle this one, using the
> same test script:
> If I want e to ban a violator with a dynamic IP, how do I deal with
> entire C-blocks (e.g.: BannedIP is TRUE if sIPAdress contains
> 123.45.6.*)
>
>
> Many TIA
>
> Friday
>
> --
> #####################################
> "The people cannot be all, & always well informed. The part which is wrong will
> be discontented in proportion to the importance of the facts they misconceive.
> If they remain quiet under such misconceptions it is a lethargy, the forerunner
> of death to the public liberty. What country before ever existed a century & a
> half without a rebellion? & what country can preserve it's liberties if their
> rulers are not warned from time to time that their people preserve the spirit
> of resistance? Let them take arms... The tree of liberty must be refreshed from
> time to time with the blood of patriots & tyrants"
> -- Thomas Jefferson
> #####################################
>

 
Reply With Quote
 
Friday
Guest
Posts: n/a
 
      05-06-2005
In article <0B6764CE-12A9-4E6C-B393->, John H
W <> wrote:

> Friday, Jody's replied on the Array, but the syntac on your VB code needs a
> couple of tweeks:
> function BannedIP(sIPAddress as String) as Boolean
> Dim sBanned, i as integar


I see. Thank You.
But.... do I use Jody's example for declaring the variable or the
following example [variable=Array(...)]???
>
> sBanned = _
> Array("69.202.123.157","216.239.39.5","216.239.37. 5","216.239.37.104", _
> "216.155.200.231","216.155.200.232","216.155.200.2 33","216.155.200.234")
>
> For i = 0 to UBound( [sBanned] )
> If sIPAddress = cstr(sBanned(i)) Then
> BannedIP = TRUE
> Exit For
> Else
> BannedIP = false
> End If
> Next
> End Function
>
> I am assuming that you are passing the IPAddress to be checked.


Yes.

> Also, if you
> want to check through the whole array, you will want to check each element of
> the array. Also, you will want to break if it finds a banned address.
>
> Just to let you know, I have 25 years of C, C++, C#, and only 1 year of VB
> (and then only in MS Office. So you might know more about VB than I.
>


Not quite.
Just an old PHP guy.

--
 
Reply With Quote
 
John H W
Guest
Posts: n/a
 
      05-06-2005
I have not used Array as such. How I do it is:

Dim sIPAddress( as String
I would use 8 or some other amount that I would not exceed. I then use
another function to fill it from an XML or other "formated" file, passing the
array, i.e.,

brtn = FillBannedAddresses(sIPAddress())

Then declare the other function as
public function FillBannedAddresses(ByRef sIPAddress() as string) as Boolean
I then return a true if filled (false if a problem)

In this other function, I would open the file, parse it and load the
addresses into the passed array (byref).

I am leaving work now or I would give you some more "pointers."

John H W

"Friday" wrote:

> In article <0B6764CE-12A9-4E6C-B393->, John H
> W <> wrote:
>
> > Friday, Jody's replied on the Array, but the syntac on your VB code needs a
> > couple of tweeks:
> > function BannedIP(sIPAddress as String) as Boolean
> > Dim sBanned, i as integar

>
> I see. Thank You.
> But.... do I use Jody's example for declaring the variable or the
> following example [variable=Array(...)]???
> >
> > sBanned = _
> > Array("69.202.123.157","216.239.39.5","216.239.37. 5","216.239.37.104", _
> > "216.155.200.231","216.155.200.232","216.155.200.2 33","216.155.200.234")
> >
> > For i = 0 to UBound( [sBanned] )
> > If sIPAddress = cstr(sBanned(i)) Then
> > BannedIP = TRUE
> > Exit For
> > Else
> > BannedIP = false
> > End If
> > Next
> > End Function
> >
> > I am assuming that you are passing the IPAddress to be checked.

>
> Yes.
>
> > Also, if you
> > want to check through the whole array, you will want to check each element of
> > the array. Also, you will want to break if it finds a banned address.
> >
> > Just to let you know, I have 25 years of C, C++, C#, and only 1 year of VB
> > (and then only in MS Office. So you might know more about VB than I.
> >

>
> Not quite.
> Just an old PHP guy.
>
> --
>

 
Reply With Quote
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      05-06-2005
John H W <> wrote:
> I have not used Array as such. How I do it is:
>
> Dim sIPAddress( as String
> I would use 8 or some other amount that I would not exceed. I then use
> another function to fill it from an XML or other "formated" file, passing the
> array, i.e.,
>
> brtn = FillBannedAddresses(sIPAddress())
>
> Then declare the other function as
> public function FillBannedAddresses(ByRef sIPAddress() as string) as Boolean
> I then return a true if filled (false if a problem)
>
> In this other function, I would open the file, parse it and load the
> addresses into the passed array (byref).


Yuk. Exceptions are there precisely to indicate problems without you
needing to pass anything by reference or check return values all the
time.

Mind you, if you know how many you're going to parse beforehand, you
wouldn't need to pass the array variable by reference anyway...

--
Jon Skeet - <>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
 
Reply With Quote
 
John H W
Guest
Posts: n/a
 
      05-06-2005
Jon [C# MVP]:

I use exceptions, but sometimes I like the old, tried and true methods (25
years of writing code, starting with cobal, then C, C++, C# & VB.Net). In
the called funtion, I could use an exception, but opening a file, while
testing whether it is open, saves five or six lines for an exception.

Then while reading in the addresses, I check at each read, again testing in
the same if statement, saving even more lines it would take to "switch" to
another exception.

In thinking about what I wrote below while driving home, instead of using
the boolean, I would return the number of addresses read, so my code would
look like:

nNumberRead = FillBannedAddresses(sIPAddress())
if nNumberRead > 0 then
For i = 0 to nNumberRead then
...
Next
end if

Of course, in C#, I would just write:

AddressList *sIPAddress; // where AddressList is a structure for a linked list
if (nNumberRead = FillBannedAddresses(sIPAddress)) > 0 {
... }

Don't forget, Jon, we are giving pointers to a person who is new to VB, but
has plenty of programming experience. When this is the case, I like to give
small directions or pointers and letting the persons use his own experience.
Introducing expections is too great a leap and can cause problems relating to
expections.

I also like "small" functions. Problems are easier and quicker to find.
Therefore, because of memory scope, you have to pass a reference or the info
he needs will "disappear" when he needs to use it. I am fairly new to VB
myself, but when I did try to return a "string array" from a function
[myarray = FunctionReturnString()] contained only the first element - all the
other elements were empty. While it is possible I did not do it correctly,
passing myarray by reference worked [FunctionReturnString(myarray) and
FunctionReturnString(byref myarray as string)].

But I would like to thank you for all your help in these newsgroups.

John H W

"Jon Skeet [C# MVP]" wrote:

> John H W <> wrote:
> > I have not used Array as such. How I do it is:
> >
> > Dim sIPAddress( as String
> > I would use 8 or some other amount that I would not exceed. I then use
> > another function to fill it from an XML or other "formated" file, passing the
> > array, i.e.,
> >
> > brtn = FillBannedAddresses(sIPAddress())
> >
> > Then declare the other function as
> > public function FillBannedAddresses(ByRef sIPAddress() as string) as Boolean
> > I then return a true if filled (false if a problem)
> >
> > In this other function, I would open the file, parse it and load the
> > addresses into the passed array (byref).

>
> Yuk. Exceptions are there precisely to indicate problems without you
> needing to pass anything by reference or check return values all the
> time.
>
> Mind you, if you know how many you're going to parse beforehand, you
> wouldn't need to pass the array variable by reference anyway...
>
> --
> Jon Skeet - <>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multidimensional arrays and arrays of arrays Philipp Java 21 01-20-2009 08:33 AM
"Variable variable name" or "variable lvalue" mfglinux Python 11 09-12-2007 03:08 AM
Looping through variable number of arrays variable times? Mike P Javascript 27 11-06-2005 10:16 AM
Arrays.asList() returning java.util.Arrays$ArrayList Alexandra Stehman Java 5 06-17-2004 06:04 PM
How do I scope a variable if the variable name contains a variable? David Filmer Perl Misc 19 05-21-2004 03:55 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57