Hello,
I have a simple VB.Net application.
There are two textboxes:
- TeacherResult
- TeacherInput
One button:
- AddTeacher
After the click on AddTeacher: The input of the user in the TeacherInput textbox will show the input in the TeacherResult textbox.
TeacherResult.Text = "The name of the teacher is: " & TeacherInput.Text
The TeacherInput is cleared with TeacherInput.Text = ""
If the input is empty and the AddTeacher button is clicked the program give a warning. But also after the input of the user the program give a warning, because the TeacherInput is cleared after the button click.
How can I solve this in a good way?
My code
Private Sub AddTeacher_Click(sender As Object, e As RoutedEventArgs) Handles AddTeacher.Click
If TeacherInput.Text = "" Then
WarningText.Visibility = Windows.UI.Xaml.Visibility.Visible
WarningText.Text = "There is no input"
Else
TeacherResult.Text = "The name of the teacher is: " & TeacherInput.Text
End If
TeacherInput.Text = ""
End Sub
End Class
Sorry for my bad English.
Thanks in advance.
What I have tried:
Search on Microsoft website and Google search