12-09-19, 01:36 AM
(آخر تعديل لهذه المشاركة : 12-09-19, 01:37 AM {2} بواسطة asemshahen5.)
إذا كنت تقصد تعبئة الكومبوبوكس بالبلدان فهذا بسيط :
PHP كود :
Imports System.Collections.Generic
Imports System.Globalization
Public Class Form1
Dim countryList As SortedDictionary(Of String, String)
Public Sub ListCountries(SourceCombo As System.Windows.Forms.ComboBox)
If countryList Is Nothing Then
countryList = BuildCountryList()
End If
SourceCombo.DisplayMember = "Key"
SourceCombo.ValueMember = "Value"
SourceCombo.DataSource = New BindingSource(countryList, Nothing)
' No need to sort anything '
End Sub
Public Function BuildCountryList() As SortedDictionary(Of String, String)
Dim temp = New SortedDictionary(Of String, String)
For Each ci As CultureInfo In CultureInfo.GetCultures(CultureTypes.AllCultures)
Dim ri As RegionInfo
Try
ri = New RegionInfo(ci.Name)
Catch
' 'If a RegionInfo object could not be created don't use the CultureInfo for the country list.'
Continue For
End Try
' If the country is not already in the countryList add it...'
If Not temp.ContainsKey(ri.EnglishName) Then
temp.Add(ri.EnglishName, ri.ThreeLetterISORegionName)
End If
Next
Return temp
End Function
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
ListCountries(ComboBox1)
End Sub
End Class
سبحان الله وبحمده سبحان الله العظيم و الحمد لله ولا اله الا الله والله اكبر
