开发者

insert null in texbox as dataset give me nonullexception

开发者 https://www.devze.com 2023-01-11 06:24 出处:网络
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

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

精彩评论

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