开发者

Check if multi line textbox is empty?

开发者 https://www.devze.com 2023-03-26 14:48 出处:网络
I currently have the following XAML: <TextBox Text=\"\" x:Name=\"textFeedbackFeedback\" Margin=\"11.593,0,29.307,42.96\" TextWrapping=\"Wrap\"

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消