Please help me
i try to display all instances of SQL Server in a combobox.

Any help is greatly appreciated.

Recommended Answers

All 2 Replies

First add reference Microsoft SQLDMO Object Library.
then add this code :

Dim i As Integer
        Dim oNames As SQLDMO.NameList
        Dim oSQLApp As SQLDMO.Application
        oSQLApp = New SQLDMO.Application
        oNames = oSQLApp.ListAvailableSQLServers()
        AddHandler ComboBoxEdit4.SelectedIndexChanged, AddressOf comboBoxEdit4_SelectedIndexChanged

        For i = 1 To oNames.Count
            Me.ComboBoxEdit4.Properties.Items.Add(oNames.Item(i))

        Next i
commented: thanks it was solved my program +1

Yosha...
what a great code..
Thank you dude...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.