Question: Open the Translator Solution (Translator Solution.sln) file contained in the VB2015Chap07Translator Solution-Sub folder. The application should use three independent Sub procedures to translate the English

Open the Translator Solution (Translator Solution.sln) file contained in the VB2015\Chap07\Translator Solution-Sub folder. The application should use three independent Sub procedures to translate the English words into French, German, or Spanish. Code the application. (Hint: Depending on the way you code this application, the Code Editor might indicate that a String variable is being either passed or used before it has been assigned a value. If this is the case, assign the String.Empty constant to the variable in the Dim statement.) Test the application appropriately.

This is what I have so far and its not working right it dose not translate

Option Explicit On Option Strict On Option Infer Off

Public Class frmMain

Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click Me.Close() End Sub

Private Sub ClearLabel(sender As Object, e As EventArgs) Handles radBrother.CheckedChanged, radFather.CheckedChanged, radFrench.CheckedChanged, radGerman.CheckedChanged, radMother.CheckedChanged, radSister.CheckedChanged, radSpanish.CheckedChanged End Sub

Private Function GetFrench(ByVal myName As String) As String Select Case myName Case "Mother" lblTranslated.Text = "Mre" Case "Father" lblTranslated.Text = "Pre" Case "Sister" lblTranslated.Text = "Sur" Case "Brother" lblTranslated.Text = "Frre" End Select Return lblTranslated.Text End Function

Private Function GetGerman(ByVal myName As String) As String Select Case myName Case "Mother" lblTranslated.Text = "Mutter" Case "Father" lblTranslated.Text = "Vater" Case "Sister" lblTranslated.Text = "Schwester" Case "Brother" lblTranslated.Text = "Bruder" End Select Return lblTranslated.Text End Function

Private Function GetSpanish(ByVal myName As String) As String Select Case myName Case "Mother" lblTranslated.Text = "Madre" Case "Father" lblTranslated.Text = "Padre" Case "Sister" lblTranslated.Text = "Hermana" Case "Brother" lblTranslated.Text = "Hermano" End Select Return lblTranslated.Text End Function

Private Sub btnTranslate_Click(sender As Object, e As EventArgs) Handles btnTranslate.Click If radFrench.Checked Then lblTranslated.Text = GetFrench(lblTranslated.Text) ElseIf radSpanish.Checked Then lblTranslated.Text = GetSpanish(lblTranslated.Text) ElseIf radGerman.Checked Then lblTranslated.Text = GetGerman(lblTranslated.Text) End If End Sub Private Sub motherRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radMother.CheckedChanged, radFather.CheckedChanged, radSister.CheckedChanged, radBrother.CheckedChanged

Dim myRB As RadioButton = CType(sender, RadioButton)

Select Case myRB.Name Case "radMother" lblTranslated.Text = "Mother" Case "radFather" lblTranslated.Text = "Father" Case "radBrother" lblTranslated.Text = "Brother" Case "radSister" lblTranslated.Text = "Sister"

End Select

End Sub

End Class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!