How do I determine gender text box, can only enter the men and women
CodePudding user response:
Use the drop-down box, adds the input text box
CodePudding user response:
Had better let people choose male or female,, if you use a text box can judge
If (textbox1 Text!="male" | | textbox1 Text!="female")
{
Messgaebox. Show (" can only enter the male or female ");
}
CodePudding user response:
The drop-down selection box, or radio group
CodePudding user response:
Male | women use regular expressions ^? $
CodePudding user response:
refer to the second floor ManBOyyy response: best let people choose male or female, and if you use a text box can judge If (textbox1 Text!="male" | | textbox1 Text!="female") { Messgaebox. Show (" can only enter the male or female "); } That's what I was writing, but not make, I play male or hint I enter male or female CodePudding user response:
reference 4 floor?????? Response: using regular expressions ^ [men | women]? $ Regular so you bai, also have to do judgment CodePudding user response:
reference 5 floor barbie bear reply: Quote: refer to the second floor ManBOyyy response: best let people choose male or female, and if you use a text box can judge If (textbox1 Text!="male" | | textbox1 Text!="female") { Messgaebox. Show (" can only enter the male or female "); } That's what I was writing, but not make, I play male or hint I enter male or female You copy my code, not prompt CodePudding user response:
refer to the third floor is nu month god reply: drop-down selection box, or radio group Drop-down box how to write ah, can change the pop-up text box CodePudding user response:
refer to 6th floor barbie bear response: Quote: refer to 4th floor?????? Response: using regular expressions ^ [men | women]? $ Regular written can bai, so too do judgment Regular expression match on into the next phase of bai, matching is not terminated, directly on the regular expression certainly works CodePudding user response:
references 9 floor?????? Response: Quote: refer to the sixth floor barbie bear response: The Quote: reference 4 floor???? Response: using regular expressions ^ [men | women]? $ Regular written can bai, so too do judgment Regular expression match on into the next phase of bai, matching is not terminated, directly on the regular expression must use Thank you very much, please consult a lot in the future CodePudding user response:
If you are not pure logic, so just like that, don't feel stupid, will solve the problem is the absolute principle If (male | | female) { } The else { } Other logic can also, like whether the query in the list, of course, stupid or not stupid is not important, the code will solve the problem in this scenario is good, he has the smallest, no coupling, there will be no performance problems, even after you write, the project's end will not modify, whether this place without struggle "high skills" CodePudding user response:
11 references wanghui0380 response: if you are not pure logic, so just like that, don't feel stupid, will solve the problem is the absolute principle If (male | | female) { } The else { } Other logic can also, like whether the query in the list, of course, stupid or not stupid is not important, the code will solve the problem in this scenario is good, he has the smallest, no coupling, there will be no performance problems, even after you write, the project's end will not modify, whether this place without struggle "highly skilled" I tried this, but not that CodePudding user response:
If (textbox1. Text=="male" | | textbox1. Text=="female") { //male or female character and conditions, do not do anything } The else { Here is your error message } Code is stupid, but enough to complete the task, in fact, you know, from the code logic is actually "is neither male nor female" is your logical condition, rather than "is not a male or female" CodePudding user response:
reference 5 floor barbie bear reply: Quote: refer to the second floor ManBOyyy response: best let people choose male or female, and if you use a text box can judge If (textbox1 Text!="male" | | textbox1 Text!="female") { Messgaebox. Show (" can only enter the male or female "); } That's what I was writing, but not make, I play male or hint I enter male or female If (textbox1 Text!="male" & amp; & Textbox1 Text!="female") { Messgaebox. Show (" can only enter the male or female "); } CodePudding user response:
refer to the second floor ManBOyyy response: best let people choose male or female, and if you use a text box can judge If (textbox1 Text!="male" | | textbox1 Text!="female") { Messgaebox. Show (" can only enter the male or female "); } Use & amp; & You this will stack overflow CodePudding user response:
refer to the second floor ManBOyyy response: best let people choose male or female, and if you use a text box can judge If (textbox1 Text!="male" | | textbox1 Text!="female") { Messgaebox. Show (" can only enter the male or female "); } Tip can use the tooltip CodePudding user response:
Use the tooltip here is just a principle demonstration logic control you need to refine their CodePudding user response:
I feel you should go inside the lost focus event judgment CodePudding user response:
The reference ℡ 17 floor? ? 2? 1?? Response: use the tooltip here is just a principle demonstration logic control you need to refine their CodePudding user response:
How to determine how to judge CodePudding user response:
The reference ℡ 19th floor? ? 2? 1?? nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull