I have a t开发者_运维知识库extbox that cannot be null. when the textbox is null dataset give me error but when I type characters in textbox and then delete them, dataset doesn't give me error.because this textbox in dataset shouldn't be null. how do I check it?
I'd suggest using the String.IsNullOrEmpty
property to check the string before submitting it to your backend storage. You can read the documentation here.
When you type characters in a Textbox and delete them all, it does not go back to being NULL
.
The textbox is now Empty.
You can check it this way:
if (string.IsNullOrEmpty(textbox.text))
精彩评论