Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populating list box

Status
Not open for further replies.

BobBob10

Programmer
Apr 24, 2005
57
GB
Using the following code

Dim blnGotListOfSQLServers As Boolean
Dim colSQLServers As Collection
Dim objSQLServer As Object
Dim m_dataset As DataSet
Dim m_clsNetAPI32 = New clsNetAPI32
blnGotListOfSQLServers = m_clsNetAPI32.GetListOfServers(colSQLServers)

If blnGotListOfSQLServers Then
For Each objSQLServer In colSQLServers
Me.List1.Items.Add(objSQLServer)
Next
End If


However List1 doesn't populate it populate blanks which is incorrect as when I step through the code values are present in the output window.

Any ideas?
 
Since objSQLServer is an object, perhaps you need to add put the objSQLServer's Name or whatever:
Code:
 Me.List1.Items.Add(objSQLServer.Name)
'or  Me.List1.Items.Add(objSQLServer.ToString)

Regards,
mansii
 
Ensure you have SQL2000 SP2 at latest. This is a known bug

Sweep
...if it works dont f*** with it
curse.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top