| |

VerySource

 Forgot password?
 Register
Search
View: 706|Reply: 3

Validation text box

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-15 23:00:01
| Show all posts |Read mode
How to verify whether the text box is empty in winforms
Can you provide the code?
Reply

Use magic Report

0

Threads

119

Posts

67.00

Credits

Newbie

Rank: 1

Credits
67.00

 China

Post time: 2020-4-16 17:45:02
| Show all posts
if (text1.Text! = null&&text.Text.Trim (). Length> 0)
{
}
Reply

Use magic Report

0

Threads

110

Posts

63.00

Credits

Newbie

Rank: 1

Credits
63.00

 China

Post time: 2020-4-16 23:00:01
| Show all posts
Does the landlord want to ask if there are authentication controls like in WebForm?

Not in WinForm ..

Isn't it enough to write a judgment sentence?

if (this.TextBox1.Text.Trim ()! = "")
{
    // The description is not empty, operate ...
}
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-4-19 14:30:01
| Show all posts
example
Suppose there is a textbox1
 if ((textbox1.text! = null)&&textbox1.text.length ()> 0&&(textbox1.text! = ""))
{
}
 Another way is to write a regular expression based on what you want to enter the text box, as long as the input of the text box does not meet the specifications, an error will be reported
 The error reporting controls are errorprovider
Can pass erroprovider.seterror ("error prompt content")
  Set error notification.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list