Hi please help as the code is all ok and this is a very famous code on the net. This code is working fine on C# but not working in VB.net. I don't know why on run time it is not showing any item in the dropdownlist please help,
VB.NET:
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Collections.Generic
Public Partial Class _Default
Inherits System.Web.UI.Page
Private regionCountryData As Dictionary(Of String, ListItem())
Protected Overrides Sub OnInit(e As EventArgs)
MyBase.OnInit(e)
regionCountryData = New Dictionary(Of String, ListItem())()
regionCountryData("Americas") = New ListItem() {New ListItem("USA"), New ListItem("Canada"), New ListItem("Brazil")}
regionCountryData("EMEA") = New ListItem() {New ListItem("Switzerland"), New ListItem("Dubai"), New ListItem("Nigeria")}
regionCountryData("Asia Pacific") = New ListItem() {New ListItem("India"), New ListItem("Japan"), New ListItem("Australia")}
End Sub
Protected Sub Page_Load(sender As Object, e As EventArgs)
If Not IsPostBack Then
RegionList.Items.Add("---Please select---")
For Each region As String In regionCountryData.Keys
RegionList.Items.Add(region)
Next
CountryList.Items.Add("---Please select---")
End If
End Sub
End Class