I have managed to find out the problem. It seems that if I
insert a wifi card and also insert the ipaq h2210 into the
cradle (cradle connected to pc , wifi unconnected) then
I get two interfaces, WLAN1 0.0.0.0., and
Serial on USB 192.168.55.101. However, if the ppc is
not in the cradle, or if the wifi card is removed, there will
be this exception I mentioned before. Good luck figuring
this out!!!
Also, Peter's notation, Dim a As OpenNETCF.Net.Adapter = ac(0)
will not work, we must use ac.item(0), or as you did with the
for each way. Again, I don't understand why the brackets do not
work, I thought this does work for lists/collections, maybee they
didn't define the () operator (or is that C++ ??).
I also noticed that the VB sample HTMLViewerVB also does't
work, well it does not even pass the editor without 3 syntax
errors, so I guess the whole OPENCF project is still buggy and
unready.
"Paul G. Tobey [eMVP]" <ptobey no spam AT no instrument no spam DOT
com>
wrote in message Yes, it works fine, although you've told us *nothing* about what
device
you
are running it on. Try running the sample from the samples area. Here's
the code sequence to get a list of adapters and look at the name of each:
Dim al as OpenNETCF.Net.AdapterCollection
al = OpenNETCF.Net.Networking.GetAdapters
For Each a As OpenNETCF.Net.Adapter In al
' a.name is the name of the adapter.
Next
Paul T.
"Greenwell" <gdfgdfgdfg> wrote in message
I can't know how many adapters are returned because
to know that I need to check ac.Count and this is
throwing an exception. Has this code run o.k.
for anyone?
Have you tried Alex's example using For Each? How many adapters are
returned?
Peter
--
Peter Foot
Windows Embedded MVP
www.inthehand.com |
www.opennetcf.org
Do have an opinion on the effectiveness of Microsoft Windows Mobile
and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups
"Greenwell" <gdfgdfgdfg> wrote in message
It is still not working, no there is a runtime error as follows:
An unhandled exception of type 'System.ArgumentOutOfRangeException'
occurred
in mscorlib.dll
This happens, when I debug, when I set into
If ac.Count > 0 Then
Here is the complete program
'smart device, non graphical, deploy ppc
Imports OpenNETCF.Net
Module Module1
Sub Main()
Dim ac As OpenNETCF.Net.AdapterCollection = Networking.GetAdapters()
If ac.Count > 0 Then
'first adapter
Dim a As OpenNETCF.Net.Adapter = ac.Item(0) ' ac(0) didn't work
MsgBox(a.CurrentIpAddress)
End If
End Sub
End Module
You can't create an Adapter directly. Instead use the Networking
class
to
retrieve current adapters:-
Dim ac As OpenNETCF.Net.AdapterCollection =
Networking.GetAdapters()
If ac.Count > 0 Then
'first adapter
Dim a As OpenNETCF.Net.Adapter = ac(0)
MsgBox(a.CurrentIpAddress)
End If
Peter
--
Peter Foot
Windows Embedded MVP
www.inthehand.com |
www.opennetcf.org
Do have an opinion on the effectiveness of Microsoft Windows Mobile
and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups
"Greenwell" <hgjghjghjghjghj> wrote in message
I tried this, it doesn't like it, I'm getting
...Module1.vb(8): 'OpenNETCF.Net.Adapter.Private Sub New(info As
OpenNETCF.Net.IP_ADAPTER_INFO)' is not accessible in this context
because
it
is 'Private'.
??
message
Do you want perhaps to create an instance of the Adapter
class
before
using
it? Something like
Dim a As New OpenNETCF.Net.Adapter()
--
Alex Feinman
---
Visit
http://www.opennetcf.org
"Greenwell" <hgjghjghjghjghj> wrote in message
I downloaded the OpenNETCF framework and tried the
following:
Imports OpenNETCF.Net
Module Module1
Sub Main()
Dim a As OpenNETCF.Net.Adapter
MsgBox(a.CurrentIpAddress)
End Sub
End Module
The result is - An unhandled exception of type
'System.NullReferenceException' occurred in tst-opencf.exe
Any ideas?