QuestionMarch 17, 2026

Which of the following statements would clear the text displayed in a Label control named cityLabel? cityLabel.Text=''clear''; cityLabel.Text=''none''; cityLabel.Text=''empty''; Clear my selection

Which of the following statements would clear the text displayed in a Label control named cityLabel? cityLabel.Text=''clear''; cityLabel.Text=''none''; cityLabel.Text=''empty''; Clear my selection
Which of the following statements would clear the text displayed in a Label control named cityLabel?
cityLabel.Text=''clear'';
cityLabel.Text=''none'';
cityLabel.Text=''empty'';
Clear my selection

Solution
4.6(134 votes)

Answer

cityLabel.Text = ""; Explanation 1. Identify correct property usage In C#, a Label control uses the `.Text` property to display text. To clear it, assign an empty string `""` to `Text`. 2. Verify given options The only valid syntax is `cityLabel.Text = "";`. Other provided strings ("clear", "none", "empty") do not remove text; they simply set those words.

Explanation

1. Identify correct property usage<br /> In C#, a Label control uses the `.Text` property to display text. To clear it, assign an empty string `""` to `Text`.<br />2. Verify given options<br /> The only valid syntax is `$cityLabel.Text = "";$`. Other provided strings ("clear", "none", "empty") do not remove text; they simply set those words.
Click to rate:

Similar Questions