How can I... in VB.Net?

K

Ken Allen

I am relatively new to VB.Net, but have programmed in VB4/5/6 and VC++ 4/5/6
for a number of years. I am being thrown into .Net in a rush to solve a
couple of problems and I am having a bit of trouble with two concepts in
VB.Net.

The first is the concept of not having the application terminate until all
of the forms have been unloaded, especially when the application is set to
launch into a 'main' subroutine rather than a form. With VB6 the application
would not terminate until any forms I had loaded were unloaded, but VB.Net
seems to terminate (and automatically unload any forms) when the initial
subroutine exits. I have not been able to locate any reference in the
documentation to how this can be achieved -- I am certain it is there, but
it does not seem easy to find.

Second is the ability to enumerate all of the servers on the domain, or
within a domain. One of the environments I work in has a mixture of NT4 and
a few Win2000AS servers, and we frequently use the File Explorer to scan the
list of servers. With the new .Net framework there are now a large number of
built-in classes, such as EventLog, that permit access to the contents of
other servers, but I cannot find a simple .Net mechanism for enumerating the
list of servers that are visible on the network. Does such an interface
exist?

-Ken
 
R

Russ Bishop

Ken Allen said:
The first is the concept of not having the application terminate until all
of the forms have been unloaded, especially when the application is set to
launch into a 'main' subroutine rather than a form. With VB6 the application
would not terminate until any forms I had loaded were unloaded, but VB.Net
seems to terminate (and automatically unload any forms) when the initial
subroutine exits. I have not been able to locate any reference in the
documentation to how this can be achieved -- I am certain it is there, but
it does not seem easy to find.

In your sub Main() you need to call app.run:

Dim fMain as New frmMain
Application.Run(fMain)


Second is the ability to enumerate all of the servers on the domain, or
within a domain. One of the environments I work in has a mixture of NT4 and
a few Win2000AS servers, and we frequently use the File Explorer to scan the
list of servers. With the new .Net framework there are now a large number of
built-in classes, such as EventLog, that permit access to the contents of
other servers, but I cannot find a simple .Net mechanism for enumerating the
list of servers that are visible on the network. Does such an interface
exist?

There isn't any such thing. However I wrote one that uses the network APIs:

http://www.boneville.net/programming/masterbrowse.zip
http://www.boneville.net/programming/masterbrowsesrc.zip

the compiled vs source versions respectively.


-- russ
 
K

Ken Allen

Wow. Cool. Thank you.

How did you track this one down? I can find the reference to
Application.Run(), but I still do nto see any documentation on the need to
use it or the behavior of the program if one does not use it. This is most
frustrating.

Thank you for the source on the enumeration of the systems. Odd that MS
would leave this out when the remainder of the framework contains such as
rich set of features!

-Ken
 

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

Top