Hi,

I have a problem to solve this, when the 1st language button clicked it should carry the language that already specified in xml but it seems my code doesn't work in that way. Can you help me please !

Form1

Private Sub FlashObj_FSCommand(ByVal sender As Object, ByVal e As AxShockwaveFlashObjects._IShockwaveFlashEvents_FSCommandEvent) Handles FlashObj.FSCommand

        If e.command = "LinkApp" Then
            Select Case e.args
                Case "1"
                    Call CurrLanguage("Malay")
                Case "2"
                    Call CurrLanguage("English")
                Case "3"
                    Call CurrLanguage("Chinese")
                Case "4"
                    Call ExitApplication("Exit")
            End Select
        End If
        Call resettimer()

    End Sub

    Private Function CurrLanguage(ByVal str As String)
        If str = "Malay" Then
            CurrLanguage = LANG_MALAY
            ToNextScreen()
        ElseIf str = "English" Then
            CurrLanguage = LANG_ENG
            ToNextScreen()
        ElseIf str = "Chinese" Then
            CurrLanguage = LANG_CHINESE
            ToNextScreen()
        End If
        Return ("")
        Call resettimer()

    End Function

Form2

Private Sub PlayFlash()

        FlashObj.Stop()
        If CurrLanguage = LANG_MALAY Then
            FlashObj.Movie = MultimediaPath & "\Ezy1-agency-Bahasa.swf"
        ElseIf CurrLanguage = LANG_ENG Then
            FlashObj.Movie = MultimediaPath & "\Ezy2-agency-English.swf"
        ElseIf CurrLanguage = LANG_CHINESE Then
            FlashObj.Movie = MultimediaPath & "\Ezy3-agency-Chinese.swf"
        End If
        FlashObj.Play()
    End Sub
    Private Sub frmStep1_AgencyDirect_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Dim nTotrec As Integer

        ReadPATCfgXML(4)
        Call ReadISTPosMalaysiaXML(0)

        If CurrLanguage = LANG_MALAY Then
            LANG_MALAY = "Malay"
            'FlashObj.Movie = MultimediaPath & "\Ezy1-agency-Bahasa.swf"
        ElseIf CurrLanguage = LANG_ENG Then
            LANG_MALAY = "English - US"
            'FlashObj.Movie = MultimediaPath & "\Ezy2-agency-English.swf"
        ElseIf CurrLanguage = LANG_CHINESE Then
            LANG_MALAY = "Chinese Simplified"
            ' FlashObj.Movie = MultimediaPath & "\Ezy3-agency-Chinese.swf"
        End If

        PlayFlash()

        Me.Visible = False
        countvar = 0
        tmrShowTimeOutDlg.Enabled = True
end sub

k

Recommended Answers

All 5 Replies

See if this helps.

Add a Public String in Form2 to store the language selected and add a Parameter to the Function.
Form2

Public sLanguageSelected As String

    Private Sub PlayFlash(ByVal selectedCurrentLanguage As String)
        FlashObj.Stop()
        If selectedCurrentLanguage = "LANG_MALAY" Then
            FlashObj.Movie = MultimediaPath & "\Ezy1-agency-Bahasa.swf"
        ElseIf selectedCurrentLanguage = "LANG_ENG" Then
            FlashObj.Movie = MultimediaPath & "\Ezy2-agency-English.swf"
        ElseIf selectedCurrentLanguage = "LANG_CHINESE" Then
            FlashObj.Movie = MultimediaPath & "\Ezy3-agency-Chinese.swf"
        End If
        FlashObj.Play()
    End Sub
    Private Sub frmStep1_AgencyDirect_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ReadPATCfgXML(4)
        Call ReadISTPosMalaysiaXML(0)
        '//=======================
        PlayFlash(sLanguageSelected) '// since language has already been sent from Form1, use that as a Parameter.
        '=======================\\
        Me.Visible = False
        countvar = 0
        tmrShowTimeOutDlg.Enabled = True
    End Sub

Now just set the String in Form2 from Form1.
Form1

Private Function CurrLanguage(ByVal str As String)
        If str = "Malay" Then
            Form2.sCurrentLanguage = "LANG_MALAY"
            ToNextScreen()
        ElseIf str = "English" Then
            Form2.sCurrentLanguage = "LANG_ENG"
            ToNextScreen()
        ElseIf str = "Chinese" Then
            Form2.sCurrentLanguage = "LANG_CHINESE"
            ToNextScreen()
        End If
        Return ("")
        Call resettimer()
    End Function

This does not relate to your question, but I hope it helps.

On Form1 you have a Function: Private Function CurrLanguage(ByVal str As String) which returns Nothing: Return ("") In the case you need to return something as a value to something else, use a Function.

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Text = setTitle(Me.Text)
    End Sub

    Private Function setTitle(ByVal str As String) As String
        Return str & " - added Text"
    End Function
End Class

Otherwise if just setting a value, use a Sub.

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        setTitle(Me.Text)
    End Sub

    Private Sub setTitle(ByVal str As String)
        Me.Text = str & " - added Text"
    End Sub
End Class

hi codeorder,

THANK YOU so much ! your explanation really very helpful.
When i launch application (form 1 )and select the language it does carry the language as specified to (form 2) but it the language selected doesn't carry to the next form. I have tried same method given by you but still the same !! I there anything i need to set in order it to carry the language selected to all the forms.

Thank You

Use Form2.sSelectedLanguage when loading other Forms since already declared Globally.

commented: Thank You so much ! your explaination really helpful :) +1

Thank You thank you thank you !!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.