开发者

insert null in texbox as dataset give me nonullexception

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))

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜