473,508 Members | 2,398 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Having Trouble Populating A ListBox With Network Computer Names

Hi. I am using the following code to try and populate two list boxes.
The first, lstWorkgroups, is to show a list of the workgroups on my
network. The second, lstComputers, is to show a list of the computers
under each workgroup. This code works fine until it finds something it
doesn't like when searching for the computers within a workgroup. For
some reason, objFolder3.Items.Count and objFolder4.Items.Count get set
to zero, and there's no way to continue after that. If anyone could look
at my code and try to help, it would be appreciated.

Private Sub frmGetComp_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim l As Integer
objFolder =
objShell.NameSpace_(Shell32.ShellSpecialFolderCons tants.ssfNETWORK)
For i = 0 To (objFolder.Items.Count - 1)
If objFolder.Items().Item(i).Name.Equals_("Entire Network")
Then
objFolder2 = CType(objFolder.Items().Item_(i).GetFolder,
Shell32.Folder)
For k = 0 To (objFolder2.Items.Count - 1)
If
objFolder2.Items().Item_(k).Name.Equals("Microsoft Windows Network")
Then
objFolder3 =
CType(objFolder2.Items_().Item(k).GetFolder, Shell32.Folder)
For l = 0 To_(objFolder3.Items.Count - 1)

lstWorkgroups.Items.Add_(objFolder3.Items.Item(l). Name)
If objFolder3.Items.Item_(l).Name =
"Specific Workgroup Here" Then
objFolder4 =
CType_(objFolder3.Items.Item(l).GetFolder, Shell32.Folder)
For j = 0 To _(objFolder4.Items.Count -
1)
Try

lstComputers.Items.Add(objFolder4.Items.Item(j).Na me)
Catch ex As Exception
MessageBox.Show_("Your program
is screwed up!")
End Try
Next
End If
Next
End If
Next
End If
Next
End Sub
All of the objFolders shown here are declared as global, as is the
objShell. Also, the way the code is set is just to test to work with one
specific work group. If I can get one to work, I can get them all to
work. I know this might be confusing, and I apologize for that, but if
anyone has any ideas, please help!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
0 1119

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

Similar topics

0
3232
by: George | last post by:
cross posted to comp.database.oracle by mistake. I'm getting the infamous ora 12154 - TNS could not resolve connect identifier error. My computer is running windows 2000 pro in standalone mode...
1
1950
by: cloverme | last post by:
Hi, I need help populating a listbox from a database on a webform. I created a an access database with a table, fields and data. Then I created a WebForm in vb.net and added a DropDownList...
8
2221
by: Steven Van Dyke | last post by:
Hi I need a code snippet to determine if my computer is connected to a network or not. There's probably a System.Net function for it, but I cannot find it. Thanks, Steve
8
2527
by: jack-b | last post by:
Hi, I have a list box which displays countries names and a second listbox which displays their cites (based on the selection made in ListBox 1) If the user selects USA i want to display cities...
4
2879
by: WB | last post by:
I'm just starting out with C# after many years with VB 6.0. I'm trying to fill a listbox with a list of computer names (almost 100) from app.config. First, is app.config the place to store and...
3
2374
by: Jay Ruyle | last post by:
I'm trying to figure out a way to list several items in a listbox and let the user select any number of items in the listbox. I have tried to code in the items as bitwise items but all it stores...
15
26644
by: NasirMunir | last post by:
I am trying to populate a listbox from another listbox on a access form. My first listbox has names of tables on a linked odbc databse. I am trying to display the tuples of the table in the second...
0
1015
by: Anil Gupte | last post by:
I am having some issues with Listboxes Here is my code: Dim DSContent As New DataSet DSContent = L3GContent.GlobalDataSet URLListBox.BeginUpdate() For Each dr As DataRow In...
5
13304
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
0
7336
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
7405
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...
1
7066
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
7504
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
5643
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5059
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...
0
3214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.