If you have the SQL CLient tools installed on your system then you will have the SQLDMO Object library which you can use to do it.
VB Code:
  1. Option Explicit
  2. 'Add a reference to M$ SQLDMO Object Library.
  3. Private Sub Command1_Click()
  4.  
  5.     Dim oSQLApp As SQLDMO.Application
  6.     Dim oNames As SQLDMO.NameList
  7.     Dim i as integer
  8.  
  9.     Set oSQLApp = New SQLDMO.Application
  10.     'POPULATE CBO ONLY WITH SQL SERVERS
  11.     Set oNames = oSQLApp.ListAvailableSQLServers
  12.     cboServer.Clear
  13.     For i = 1 To oNames.Count
  14.         cboServer.AddItem oNames.Item(i)
  15.     Next i
  16.     If oNames.Count = 0 Then
  17.         cboServer.AddItem "NO SQL SERVERS FOUND"
  18.     EndIf
  19.  
  20. End Sub
  21.  
  22. Private Sub Command2_Click()
  23.  
  24.     Set goSQL = New SQLDMO.SQLServer
  25.     goSQL.Connect CStr(cboServer), CStr(txtLoginName), CStr (txtPassword) 'oSQL.HostName
  26.     If goSQL.ConnectionID <= 0 Then
  27.         MessageBox.Show("CONNECTION FAILED!!!")
  28.         Exit Sub
  29.     End If
  30.     sRc = goSQL.ExecuteWithResults("USE master SELECT * FROM     sysdatabases", SQLDMOExec_Default).Rows
  31.     sRs = " "
  32.     i = 0
  33.     cboDatabase.Clear
  34.     Do Until i = sRc
  35.         i = i + 1
  36.         sRs = goSQL.ExecuteWithResults("USE master SELECT * FROM sysdatabases", SQLDMOExec_Default).GetColumnString(i, 1)
  37.         cboDatabase.AddItem sRs
  38.     Loop
  39.     cboDatabase = cboDatabase.List(0)
  40.  
  41. End Sub