08-10-19, 08:35 AM
(آخر تعديل لهذه المشاركة : 08-10-19, 08:38 AM {2} بواسطة asemshahen5.)
ضع ComboBox على الفورم و جرب السب التالي :
ضع في كود تحميل الفورم :
PHP كود :
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
PHP كود :
LoadServer(ComboBox1)
ComboBox1.SelectedIndex = 0
سبحان الله وبحمده سبحان الله العظيم و الحمد لله ولا اله الا الله والله اكبر
