Hi there

I'm completing an application to display a weather report - unfortunately i can't seem to get the name entered to appear in the message shown and i can't get each picture to appear individually when the radio button related is chosen.

Here is the question i'm working off followed by the code i have got so far:


Create an application to display a weather report. The user can choose one of the radio buttons and display an icon and a message. The message should give the weather report in words and include the person’s name (taken from the text box at the top of the form). For example if the user chooses the sunny button, you might display “It looks like sunny weather today, John” (assuming that the user entered John in the text box).
Include keyboard access keys for the radio buttons and buttons. Include tooltips.


Public Class Form1

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
'End the project

Me.Close()
End Sub

Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
'Add the name to the message


End Sub

Private Sub radSunny_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radSunny.CheckedChanged
lblMessage.Text = "It looks like sunny weather today, (txtName.Text)"
End Sub

Private Sub radSnowy_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radSnowy.CheckedChanged
lblMessage.Text = "It looks like snowy weather today,(txtName.Text)"
End Sub

Private Sub radRainy_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radRainy.CheckedChanged
lblMessage.Text = "It looks like rainy weather today, (txtName.Text)"
End Sub

Private Sub radCloudy_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radCloudy.CheckedChanged
lblMessage.Text = "It looks like cloudy weather today, (txtName.Text)"
End Sub

End Class

you need to concatenate the name to the string. The way you have it you are including the literal txtName.Text whereas you want the contents of txtName.text.

lblMessage.Text = "It looks like cloudy weather today, " & txtName.Text
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.