Check if multi line textbox is empty?
I currently have the following XAML:
<TextBox Text="" x:Name="textFeedbackFeedback"
Margin="11.593,0,29.307,42.96" TextWrapping="Wrap"
VerticalContentAlignment="Top" VerticalAlignment="Bottom"
Height="92.08" AcceptsReturn="True" VerticalScrollBarVisibility="Visible"/>
I have tried using a lot of variations of:
if(textFeedbackFeedback.text == "")
if(textFeedbackFeedback.text开发者_Python百科 == null)
if(textFeedbackFeedback.text == string.Empty)
if(string.IsNullOrEmpty(textFeedbackFeedback.Text))
But for some reason it doesn't stop there and continues as if there is data in there, can someone help me out here.
Thanks.
try if(string.IsNullOrWhiteSpace(textFeedbackFeedback.Text))
if that doesn't work, try finding out the length of the text, and the integer/ascii values of the chracters in the text.
You could try using the .Trim() function on the text to eliminate any white space that might be in there.
精彩评论