Sub LoadServer(ByVal Combo As ComboBox)
Try
Dim Instance As New ArrayList
Dim Rk As New ArrayList
Instance.AddRange(Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server", "InstalledInstances", "MSSQLSERVER"))
If Instance.Count > 0 Then
For Each Element As String In Instance
If Element = "MSSQLSERVER" Then
Combo.Items.Add("(Local)")
Combo.Items.Add(System.Environment.MachineName)
Else
Combo.Items.Add("(Local)" + "\" + Element)
Combo.Items.Add(System.Environment.MachineName + "\" + Element)
End If
Next Element
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical + MsgBoxStyle.MsgBoxRight + MsgBoxStyle.MsgBoxRtlReading, "Error")
End Try
End Sub