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

GET SUBNET LOCATION IN VB.NET

Hi!

I try to get the subnet location info using the code below found at
http://msdn2.microsoft.com/en-us/lib....location.aspx.
But it only tells me that "instance" is used before it has been assigned a
value. Can anyone tell me what to do to get my subnet location info?

Public Property SubnetLocation() As String
Get
Dim instance As ActiveDirectorySubnet
SubnetLocation = instance.Location
Console.WriteLine("SubnetLocation: " & SubnetLocation)
End Get

Set(ByVal value As String)
Dim instance As ActiveDirectorySubnet
instance.Location = SubnetLocation
End Set
End Property

Regards

Morten Fagermoen

Oct 29 '06 #1
4 5104
You haven't yet created an instance of the "instance" variable, you've only
defined a place where a true instance can reside. You need to declare it
like this.

Dim instance As New ActiveDirectorySubnet(arguments)

where "arguments" are those values used to initialize the object. It requires
an active directory context, a subnet name, and an optional site name. Here
is the web page for the constructors.

http://msdn2.microsoft.com/en-us/lib...orysubnet.aspx

-----
Tim Patrick
Start-to-Finish Visual Basic 2005
Hi!

I try to get the subnet location info using the code below found at

http://msdn2.microsoft.com/en-us/lib...yservices.acti
vedirectory.activedirectorysubnet.location.aspx.

But it only tells me that "instance" is used before it has been
assigned a

value. Can anyone tell me what to do to get my subnet location info?

Public Property SubnetLocation() As String
Get
Dim instance As ActiveDirectorySubnet
SubnetLocation = instance.Location
Console.WriteLine("SubnetLocation: " & SubnetLocation)
End Get
Set(ByVal value As String)
Dim instance As ActiveDirectorySubnet
instance.Location = SubnetLocation
End Set
End Property
Regards

Morten Fagermoen

Oct 29 '06 #2
Thanks, that takes it one step further.

I should get the subnet location for the computer that runs the program. Do
you have an example, for a newbie, on how to write that?

Regards

Morten Fagermoen
"Tim Patrick" <in*****@invalid.com.invalidwrote in message
news:e3*************************@newsgroups.comcas t.net...
You haven't yet created an instance of the "instance" variable, you've
only defined a place where a true instance can reside. You need to declare
it like this.

Dim instance As New ActiveDirectorySubnet(arguments)

where "arguments" are those values used to initialize the object. It
requires an active directory context, a subnet name, and an optional site
name. Here is the web page for the constructors.

http://msdn2.microsoft.com/en-us/lib...orysubnet.aspx

-----
Tim Patrick
Start-to-Finish Visual Basic 2005
>Hi!

I try to get the subnet location info using the code below found at

http://msdn2.microsoft.com/en-us/lib...yservices.acti
vedirectory.activedirectorysubnet.location.aspx .

But it only tells me that "instance" is used before it has been
assigned a

value. Can anyone tell me what to do to get my subnet location info?

Public Property SubnetLocation() As String
Get
Dim instance As ActiveDirectorySubnet
SubnetLocation = instance.Location
Console.WriteLine("SubnetLocation: " & SubnetLocation)
End Get
Set(ByVal value As String)
Dim instance As ActiveDirectorySubnet
instance.Location = SubnetLocation
End Set
End Property
Regards

Morten Fagermoen

Oct 30 '06 #3
I'm not an ActiveDirectory programmer, but it seems that the subnet is just
a standard TCP/IP subnet. The ActiveDirectorySubnet() method is looking for
a string subnet, so you would pass it "255.255.255.0" or whatever subnet
applies in your case.

It wasn't clear from your original question whether you simply made a typo,
or if you really weren't clear on what an instance of an object was. If it
is the latter, I highly recommend that you spend some time learning the basics
of .NET programming in Visual Basic, as instances and objects are pretty
much the central idea of .NET programming. If it was just an oversight or
a typo, then please forgive my forwardness in making this assumption.

-----
Tim Patrick
Start-to-Finish Visual Basic 2005
Thanks, that takes it one step further.

I should get the subnet location for the computer that runs the
program. Do you have an example, for a newbie, on how to write that?

Regards

Morten Fagermoen

"Tim Patrick" <in*****@invalid.com.invalidwrote in message
news:e3*************************@newsgroups.comcas t.net...
>You haven't yet created an instance of the "instance" variable,
you've only defined a place where a true instance can reside. You
need to declare it like this.

Dim instance As New ActiveDirectorySubnet(arguments)

where "arguments" are those values used to initialize the object. It
requires an active directory context, a subnet name, and an optional
site name. Here is the web page for the constructors.

http://msdn2.microsoft.com/en-us/lib...ryservices.act
ivedirectory.activedirectorysubnet.activedirector ysubnet.aspx

-----
Tim Patrick
Start-to-Finish Visual Basic 2005
>>Hi!

I try to get the subnet location info using the code below found at

http://msdn2.microsoft.com/en-us/lib...oryservices.ac
ti vedirectory.activedirectorysubnet.location.aspx.

But it only tells me that "instance" is used before it has been
assigned a

value. Can anyone tell me what to do to get my subnet location
info?

Public Property SubnetLocation() As String
Get
Dim instance As ActiveDirectorySubnet
SubnetLocation = instance.Location
Console.WriteLine("SubnetLocation: " & SubnetLocation)
End Get
Set(ByVal value As String)
Dim instance As ActiveDirectorySubnet
instance.Location = SubnetLocation
End Set
End Property
Regards
Morten Fagermoen

Oct 30 '06 #4
Thanks again, you are not on the wrong direction when assuming that I
haven't understood all of the basics yet. But it's getting better every
day, thanks to people like you answering stupid questions.

Once again, thank you for your help!!

Morten

"Tim Patrick" <in*****@invalid.com.invalidwrote in message
news:e3*************************@newsgroups.comcas t.net...
I'm not an ActiveDirectory programmer, but it seems that the subnet is
just a standard TCP/IP subnet. The ActiveDirectorySubnet() method is
looking for a string subnet, so you would pass it "255.255.255.0" or
whatever subnet applies in your case.

It wasn't clear from your original question whether you simply made a
typo, or if you really weren't clear on what an instance of an object was.
If it is the latter, I highly recommend that you spend some time learning
the basics of .NET programming in Visual Basic, as instances and objects
are pretty much the central idea of .NET programming. If it was just an
oversight or a typo, then please forgive my forwardness in making this
assumption.

-----
Tim Patrick
Start-to-Finish Visual Basic 2005
>Thanks, that takes it one step further.

I should get the subnet location for the computer that runs the
program. Do you have an example, for a newbie, on how to write that?

Regards

Morten Fagermoen

"Tim Patrick" <in*****@invalid.com.invalidwrote in message
news:e3*************************@newsgroups.comca st.net...
>>You haven't yet created an instance of the "instance" variable,
you've only defined a place where a true instance can reside. You
need to declare it like this.

Dim instance As New ActiveDirectorySubnet(arguments)

where "arguments" are those values used to initialize the object. It
requires an active directory context, a subnet name, and an optional
site name. Here is the web page for the constructors.

http://msdn2.microsoft.com/en-us/lib...ryservices.act
ivedirectory.activedirectorysubnet.activedirecto rysubnet.aspx

-----
Tim Patrick
Start-to-Finish Visual Basic 2005
Hi!

I try to get the subnet location info using the code below found at

http://msdn2.microsoft.com/en-us/lib...oryservices.ac
ti vedirectory.activedirectorysubnet.location.aspx.

But it only tells me that "instance" is used before it has been
assigned a

value. Can anyone tell me what to do to get my subnet location
info?

Public Property SubnetLocation() As String
Get
Dim instance As ActiveDirectorySubnet
SubnetLocation = instance.Location
Console.WriteLine("SubnetLocation: " & SubnetLocation)
End Get
Set(ByVal value As String)
Dim instance As ActiveDirectorySubnet
instance.Location = SubnetLocation
End Set
End Property
Regards
Morten Fagermoen

Oct 30 '06 #5

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

Similar topics

1
by: Nobody | last post by:
I have a website that is built around a web-application that my company purchased. My company has full ownership and administrative rights to this software and its corresponding files. It uses...
0
by: Pierre Rouleau | last post by:
Hi all, socket.gethostbyname_ex(socket.gethostname()) will return the list of IP addresses on a the local host. I did not find any function that can be used to get the subnet mask and default...
0
by: Jerry Negrelli | last post by:
Does anyone know how to get the subnet of a machine in C# (without using WMI's NetworkAdapterConfiguration object)? I've queried the Active Directory to get the visible subnets -- perhaps I can...
6
by: ohynes | last post by:
hey newbie here wondering if there is anyone out there who can help me im trying to make a c# subnet calulator using the IPAddress class i cant seem to figure out how to do all the subnet...
1
by: Glenn M | last post by:
I know how i can use request.userhostaddress to get the requesting ip address. is their any way i can get the requesting clients subnet mask also?
1
by: MS Newsgroups | last post by:
Hi, does anyone have a function, or some insight in how i would go about to be able to calculate the first and last address in a IP subnet based on a network address and bits Example...
3
by: JamesB | last post by:
Hmm, this doesn't seem to work. I am probably tackling it completely the wrong way, but basically I want a function to receive two IP's and a subnet mask and return True if IP1 and 2 are on the...
1
by: Terry Olsen | last post by:
Is there an "elegant" way to determine if an IP address is on my subnet? Or do I just compare the first 2 or 3 octets?
1
by: =?Utf-8?B?Q2FybG9z?= | last post by:
Guys, I have a little problem here. I have an AD domain with one DC and 2 other member servers and when I go to My Network Places and browse the network, I can seamless see a list of all...
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
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...
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
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.