hello all i have a website in vb.net.i want to make my website globalized for this i have a webpage Default.aspx in this page i take a dropdown in which there is several languages when i select the language from the dorpdown and clicking on the button the text are converted into the selected language.to acheive this i write the code in .vb file is as follows
Imports System.Resources
Imports System.Globalization
Imports System.Threading
Partial Class _Default
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not Page.IsPostBack Then
drpLanguages.Items.Add(New _
System.Web.UI.WebControls.ListItem("English", "en-NZ"))
Dim sLang As String = "en-NZ"
SetCulture(sLang)
End If
End Sub
Private Sub SetCulture(ByVal sLang As String)
Dim gStrings As String
Thread.CurrentThread.CurrentUICulture = New CultureInfo(sLang)
Thread.CurrentThread.CurrentCulture = _
CultureInfo.CreateSpecificCulture(sLang)
p1.InnerHtml = gStrings.GetString("p1")
btnlang.Text = gString.GetString("btnlang")
End Sub
Protected Sub btnlang_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnlang.Click
Dim sLang As String = drpLanguages.SelectedItem.Value
SetCulture(sLang)
End Sub
End Class
and also add a .vb file named as Webform1 and the code is as folows----
Imports Microsoft.VisualBasic
Imports System.Resources
Imports System.Globalization
Imports System.Threading
Public Class Webform1
Protected gStrings As New _
ResourceManager("SatelliteAssemblies.Default", _
GetType(Webform1).Assembly)
End Class
but the problem is when i run this age the error is
""name gStrings is not declare."
please help me out what should i do to overcome from this problem.
should i made and initialization on page_load .
i make all the resourse file.
thanks and regard
subiya ahsan