Question about declaring arrays

  • Thread starter Thread starter Terry Olsen
  • Start date Start date
T

Terry Olsen

What's the difference between:

dim ipad as IPAddress()

and

dim ipad() as IPAddress

They both seem to work the same. Thanks!
 
Terry,

Terry Olsen said:
What's the difference between:

dim ipad as IPAddress()

and

dim ipad() as IPAddress

Nothing

Although
dim ipad as IPAdrres(100) does not go and
dim ipad(100) as IPAdress goes.

I hope this answers your questions

Cor
 
I was surprised to find that this worked also...
Dim ipad As IPAddress = Dns.ResolveToAddresses(Dns.GetHostName)(0)

That 0 at the end returns the first IPAddress in the list.
 
I was surprised to find that this worked also...
Dim ipad As IPAddress = Dns.ResolveToAddresses(Dns.GetHostName)(0)

That 0 at the end returns the first IPAddress in the list.

Dns.ResolveToAddress returns an array object - and that happens before
the assignment. This worked in VB6 as well (of course, not the Dns.*,
but the returning the element with the subscript)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top