ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] textbox²©ö°£¿ù

[µo°Ý] textbox²©ö°£¿ù

¦U¦ì«e½ú±z¦n¡G

½Ð°Ý¤@¤Utextbox ²©ö°£¿ù¸Ó¦p¦ó¨Ï¥Î¡H
°ÝÃD¦p¤U¡G

¤p§Ì¬Oªì¾ÇªÌ¡A©Ò¥H¥u·|°ò¥»ªº¡C
°²³]¦@¦³¥|­Ótextbox¡]¥H¤U²ºÙtb¡^
tb5¡Btb6¬°¤@²Õ¦ý¿W¥ß¡Ftb7¡Btb8¬°¤@²Õ¦ý¿W¥ß
¦]¬°¬O¼gµ¹§O¤H¥Îªº¡A
©Ò¥H­n¦Ò¼{©Ò¦³¥i¯à©Ê¡A
¥L¦³¥i¯à¥u¦³¿é¤Jtb5¤Îtb6¡AµM«átb7§Ñ°O§R°£¡A©Ò¥H´N¦³¥H¤Uªºµª®×¡C
    If TB5.Value <> "" And TB6.Value <> "" And TB7.Value <> "" Then
    MsgBox "½Ð¾Ü¤@¿é¤J"
    GoTo END1
    End If
   
¦pªG¿é¤Jtb5¡Aµ²ªGtb7§Ñ°O§R°£¡A©ÎªÌ¬O¥»¨Ó¬O­n¿é¤Jtb7ªº¡Atb5§Ñ°O§R°£¡C
    If TB5.Value <> "" And TB7.Value <> "" Then
    MsgBox "½Ð¾Ü¤@¿é¤J"
    GoTo END1
    End If
   
¦pªG¿é¤Jtb6¡Aµ²ªGtb7§Ñ°O§R°£¡A©ÎªÌ¬O¥»¨Ó¬O­n¿é¤Jtb7ªº¡Atb6§Ñ°O§R°£¡C
    If TB6.Value <> "" And TB7.Value <> "" Then
    MsgBox "½Ð¾Ü¤@¿é¤J"
    GoTo END1
    End If

¥H¦¹Ãþ±À¡F³o¨Ç³£¬O¤p§Ì¼gªº¡F
    If TB6.Value <> "" And TB8.Value <> "" Then
    MsgBox "½Ð¾Ü¤@¿é¤J"
    GoTo END1
    End If

   
    If TB5.Value <> "" And TB6.Value <> "" And TB7.Value <> "" And TB8.Value <> "" Then
    MsgBox "½Ð¾Ü¤@¿é¤J"
    GoTo END1
    End If

    If TB5.Value <> "" And TB7.Value <> "" And TB8.Value <> "" Then
    MsgBox "½Ð¾Ü¤@¿é¤J"
    GoTo END1
    End If

    If TB6.Value <> "" And TB7.Value <> "" And TB8.Value <> "" Then
    MsgBox "½Ð¾Ü¤@¿é¤J"
    GoTo END1
    End If

    If TB5.Value <> "" And TB6.Value <> "" And TB8.Value <> "" Then
    MsgBox "½Ð¾Ü¤@¿é¤J"
    GoTo END1
    End If
   
    If TB5.Value = "" And TB6.Value = "" And TB7.Value = "" And TB8.Value = "" Then
    MsgBox "½Ð¾Ü¤@¿é¤J"
    GoTo END1
    End If

´N¬Otb5¡Btb6¥i¦P®É¿é¤J©Î¥u¿é¤J¤@­Ó¡A¦ý¬Otb7¡u©Î¡vtb8¿é¤J´N­n¥X²{´£¥Ü¿ù»~¤è¶ô¡C
©ÎªÌ¬O¤Ï¹L¨Ó»¡tb7¡Btb8¥i¦P®É¿é¤J©Î¥u¿é¤J¤@­Ó¡A¦ý¬Otb5¡u©Î¡vtb6¿é¤J´N­n¥X²{´£¥Ü¿ù»~¤è¶ô¡C
¦³¿ìªkÁo©ú¤@ÂIªº°µªk¶Ü¡H

ªþµù¤@´£¡A·|¥Îgoto ¬O¦]¬°¤£ª¾¹D«ç¼Ëµ²§ô¡A
·s¤âµo°Ý¡A½Ð¦U¦ìÅé½Ì¼gªº¤º®e«D±`¸¨¥î¡AÁÂÁ¡I

¥»©«³Ì«á¥Ñ lpk187 ©ó 2015-4-12 23:12 ½s¿è

¦^´_ 1# LITTLEFAT7048


§Ñ°O§R°£¡H¬O¤°»ò·N«ä¡H¦pªG§Ñ°O§R°£¥i¥H¥Îµ{¦¡À°¥L§R°£¡I
¥t¡Aµ²§ôµ{§Ç¥i¥H¥Î exit sub ©Î end

TOP

If Trim(TB5 + TB6) <> "" And Trim(TB7 + TB8) <> "" Then
   MsgBox "½Ð¾Ü¤@¿é¤J"
   GoTo END1
End If

TOP

¦^´_ 3# bobomi


¥i¥H¥Î¡IÁÂÁ±z¡I
¤£¹L¦pªG¥þ³¡¡]5.6.7.8¡^³£¬OªÅ¥Õªº¥Ø«e¤£·|·PÀ³¨ì¡A
ÁöµM»¡¨º­Ó±¡ªpÀ³¸Ó¬O¤£·|µo¥Í¡C

¥i¥H½Ð°Ýtrimªº¥Î³~¶Ü¡H

ºô¸ô¤W¬O³o»ò¼g¡G
Trim()        ±q¥Ø«eªº String ª«¥ó¤¤²¾°£©Ò¦³ªº«e¸m©M«áºÝªÅ¥Õ¦r¤¸¡C
Trim(Char[])        ±q¥Ø«eªº String ª«¥ó¤¤²¾°£°}¦C¤¤«ü©w¤§¤@²Õ¦r¤¸ªº©Ò¦³«e¸m©M«áºÝ«ü©w¶µ¥Ø¡C

¨º³o­Ó­n«ç»ò¸ÑÄÀ¡H
    If Trim(TB5 + TB6) <> "" And Trim(TB7 + TB8) <> "" Then
¦pªGTB5¡u©Î¡vTB6¤£µ¥©óªÅ¥Õ¡A¦Ó¥BTB7¡u©Î¡vTB8¤£µ¥©óªÅ¥Õ¡HµM«á...
¡]³o¼Ë¦n¹³¨S¦³¸ÑÄÀ¨ìTrim....??¡^

¦Ó¥B¬°¦óTB5«á­±¤£»Ý­n.Value©Î¬O.Text¤§Ãþªº¡A¯u¯«©_¡I
ÁöµMµª®×¥X¨Ó¤F¡A¦pªG¤è«Kªº¸Ü¡A¥i§_§iª¾¸ÑÃD¹Lµ{¡H·PÁ±z¡I

TOP

¦^´_ 2# lpk187


§Ñ°O§R°£¡A¥i¯à¬OTB5¤ÎTB7¦P®É¦³¤å¦r¡A
¦ý¬O§Ú¤£¯à½T©w¹ï¤è¨ì©³­þ­Ó¬O¤£­nªº¡A
©Ò¥H¥u¯à¥Î´£¥Üªº¸ò¥L»¡¡A½Ð¾Ü¤@¿é¤J¡I
³o¼Ë¥L´N·|§â¥L¤£­nªº§R°£±¼¡C

À°¥L§R°£ªº¤è¦¡¡A¤p§Ì·|¥Î¡C
°²³]¬OTB5¡A¨º»ò´N¥ÎTB5.Text=""
ªì¾ÇªÌ¡A³£¬O¤gªk½m¿û§rXD...
¥i¥H¹F¨ì¥Øªº¡A¤S¥i¥HÅý¦Û¤v¤F¸Ñ¡A
¦ý¬O¦pªG¦³¾÷·|ÁÙ¬O­n¦h¾Ç¤@ÂI¤èªk:D...

¦A³Â·Ð«e½ú­Ì½ç±Ð¤F¡IÁÂÁ±z¡I

TOP

¤£¹L¦pªG¥þ³¡¡]5.6.7.8¡^³£¬OªÅ¥Õªº¥Ø«e¤£·|·PÀ³¨ì --> §Úº|¬Ý³o±ø¥ó

[ªk1]

A = Trim(TB5 + TB6)
B = Trim(TB7 + TB8)
If  A <> "" And B <> ""  OR  A ="" And B = "" Then
   MsgBox "½Ð¾Ü¤@¿é¤J"
   GoTo END1
End If

[ªk2]

A = Trim(TB5 + TB6)
B = Trim(TB7 + TB8)
If  NOT (A =  ""  XOR  B = "" ) Then
   MsgBox "½Ð¾Ü¤@¿é¤J"
   GoTo END1
End If

'===

Trim( ) : ¦pªG§A¿é¤Jªº¬O¥þ³¡¬OªÅ¥Õ, ¤]ºâ¬Oµ¥©ó§A¨S¦³¿é¤J¥ô¦ó­È

¦pªG§A¤¹³\¿é¤J¥i¥H¬O¥þ³¡¬OªÅ¥Õ, ¨º´N§â Trim() ½ð°£±¼
½ð°£±¼ Trim À³¸Ó´N¦n²z¸Ñ¤F

'====
¬°¦ó TB5 «á­±¤£»Ý­n.Value ?  
.Value ¬O¹w³]ÄÝ©Ê, ¨S¼g®É¥L¦Û¤v·|§PÂ_¦¨§A´N¬O­n¥Î .Value

TOP

¦^´_ 6# bobomi


¬Ý¨ì¬ü¤k¦Ñ®v¦^ÂСA·íµM­n¦^¡A
©êºp©êºp¡A³ÌªñÂø¨Æ¤ñ¸û¦h¡A¤ñ¸ûºC¦^ >_<...

==

A = Trim(TB5 + TB6)
B = Trim(TB7 + TB8)
If  A <> "" And B <> ""  OR  A ="" And B = "" Then
   MsgBox "½Ð¾Ü¤@¿é¤J"
   GoTo END1
End If

¦³ÂIÃøO_O...
¸ÕµÛ¦A¸ÑÄÀ¤@¦¸¦n¤F¡C
¦pªGTB5©ÎTB6³£¤£¬OªÅ¥Õ¦Ó¥BTB7¤ÎTB8³£¤£¬OªÅ¥Õ...
©Î¬O¡F
¦pªGTB5©ÎTB6³£¬OªÅ¥Õ¦Ó¥BTB7¤ÎTB8³£¬OªÅ¥Õ¡AµM«á... MsgBox "½Ð¾Ü¤@¿é¤J"
¤£µMTrim(TB5 + TB6)©Î¬OTrim(TB7 + TB8)¨ä¤¤¤@­ÓªÅ¥Õ§¡¬OEnd If
³o¼Ë½Ķ·Pı¦³¶¶­ò....¡]¦Û§Ú·Pı¨}¦nXD...¡^

+¦b³o¸ÌÀ³¸Ó¬O¬°¤F­nÅýTB5¤ÎTB6¦¨¤@­Ó¸s²Õ¡H
µM«á¦A¤À§O§PÂ_ªº·N«ä¶Ü¡H©Ò¥H¥i¥H¸ÑÄÀ¬°¡u©Î¡vªº·N«ä¶Ü¡H

==

A = Trim(TB5 + TB6)
B = Trim(TB7 + TB8)
If  NOT (A =  ""  XOR  B = "" ) Then
   MsgBox "½Ð¾Ü¤@¿é¤J"
   GoTo END1
End If

³o­Ó¼gªk¤ñ¸ûµu¡A¤ñ¸û¦n¡C

¹ï¨â­Ó Boolean ¹Bºâ¦¡°õ¦æÅ޿褬¥¸ (Logical Exclusion)¡A©Î¹ï¨â­Ó¼Æ­È¹Bºâ¦¡°õ¦æ¦ì¤¸¤¬¥¸ (Bitwise Exclusion)¡C

¦pªG expression1 ¬°¥B expression2 ¬Oresult ªº­È¬°
True                                 True                   False
True                                 False                  True
False                                True                   True
False                                False                  False

·Ó¤W­±ªº»¡ªk¡A¦pªG¥HA¨Ó»¡¡G
TB5="" ©MTB6="" ¬° False
TB5<>"" ©MTB6="" ¬° True
TB5="" ©MTB6<>"" ¬° True
TB5<>"" ©MTB6<>"" ¬° False

­YA©MB¬Û¤ñªº¸Ü¡A
¨º»òA©MB§¡¬°ªÅ¥Õ®É¡A«h¬°False¡F
§¡¤£µ¥©óªÅ¥Õ®É¡A¤]¬OFalse¡F

©Ò¥HIf NOT TRUE THEN MsgBox "½Ð¾Ü¤@¿é¤J"
¬O³o¼Ë¸ÑÄÀ¶Ü¡H

¨º°ÝÃD¤S¨Ó¤F¡A
¤G­Ó°ÝÃD¡G
¤@¡B
¬°¦ó­n¥ÎA = Trim(TB5 + TB6)
¦Ó¤£¥Î A= TB5+TB6 ©O¡H
¦n¹³¤@ª½³Q Trim ³o­Ó¨ç¼Æ¥d¨ì...

¤G¡B
(A =  ""  XOR  B = "" )³o­Ó¦¡¤l¤¤¡A
¬O¬°¤F­nÅý TB5 ©M TB6 ¤À§O¥hÀ˵ø¬O§_©MA=""¬Û¦P¬O¶Ü¡H
Á|¨Ò¨Ó»¡¡G
TB5=""   A=""   ³o¼Ë¨â­Ó³£¬O""¡A©Ò¥H¬°False
TB5<>""    A=""    ³o¼Ë¬°True
¦]¬°­è¤~¤Wºô§äXORªº¤º®e¦n¹³¬O­n¹Bºâ¦¡¡A
©Ò¥H¤~­nµ¹¥L¤@­Óµ¥©ó¡]=¡^¥h°µ¹Bºâªº·Pı¡C

­è¤~¸Õ¤F¤@¤U¡A¤]¥i¥H¥Î (A<>"" XOR B<>"") ­C...
¦n¹³¬O¨S¤°»ò·N¸qªº¸Õ¥Î¡A¥u¬O¦b´ú¸Õ XOR ªº·N«ä¦Ó¤w...

==

Trim( ) : ¦pªG§A¿é¤Jªº¬O¥þ³¡¬OªÅ¥Õ, ¤]ºâ¬Oµ¥©ó§A¨S¦³¿é¤J¥ô¦ó­È

¦pªG§A¤¹³\¿é¤J¥i¥H¬O¥þ³¡¬OªÅ¥Õ, ¨º´N§â Trim() ½ð°£±¼
½ð°£±¼ Trim À³¸Ó´N¦n²z¸Ñ¤F

©Ò¥H¦pªG¬O¥HTrim(TB5 + TB6)ªº¨ç¼Æ¨Ó»¡ªº¸Ü¡A
¦pªG¸Ì­±ªº­ÈTB5=""  TB6<>"" ³o¼Ë­n«ç»ò¸ÑÄÀ©O¡H
¦pªG¸Ì­±ªº­ÈTB5=""  TB6=""¤S­n«ç»ò¸ÑÄÀ©O¡H

¬ü¤k¦Ñ®v¡A¯u¬O©êºp¡A
¦]¬°ªì¾Ç¡A¤£À´ªº¹ê¦b¬O¤ñ¸û¦hXD...

¦p±z¦³ªÅ¡B¦³¶¢®É¡A¦A³Â·Ð±z¬Ý¤@¤U°ÝÃD§Y¥i¡A
ÁÂÁ±z¡I

TOP

¦^´_  bobomi


¬Ý¨ì¬ü¤k¦Ñ®v¦^ÂСA·íµM­n¦^¡A
©êºp©êºp¡A³ÌªñÂø¨Æ¤ñ¸û¦h¡A¤ñ¸ûºC¦^ >_
LITTLEFAT7048 µoªí©ó 2015-4-17 23:02


­Ó¤H¤p¨£¸Ñ
  1. 1.¥tÃþªº¤è¦¡
  2. If tb5 <>"" or tb6 <>"" and tb7<>"" or tb8 <>"" then
  3.     MsgBox "½Ð¾Ü¤@¿é¤J"
  4.     GoTo END1
  5. elseif tb5="" and tb6="" and tb7="" and tb8="" then
  6.     MsgBox "¼Æ­È¥þªÅ¥Õ¡A½Ð­«·s¿é¤J"
  7.     GoTo END1       
  8. End If



  9. 2.Trim(TB5+TB6)
  10. 2-1 TB5=""  TB6<>"" >>A = Trim(¦³¸ê®Æ) >> ²¾°£ªÅ¥Õ¦r¤¸«á >> A=¦³¸ê®Æ
  11. Ex:TB5=""   TB6=3   >>A = Trim(""+3)    >> ²¾°£ªÅ¥Õ¦r¤¸«á >> A=3   
  12. 2-2 TB5=""  TB6=""  >>A = Trim(ªÅ¸ê®Æ) >> ²¾°£ªÅ¥Õ¦r¤¸«á >> A=ªÅ¸ê®Æ
  13. Ex:TB5=""   TB6=""   >>A = Trim(""+"")    >> ²¾°£ªÅ¥Õ¦r¤¸«á >> A=""
  14.    
½Æ»s¥N½X

  ¦h°µ¦h·Q¦h¾Ç²ß¡A¤Ö¬Ý¤Ö¿ù¤Ö°g³~

  ¦h°µ=¦h¦h½m²ß¡A¦h¦h½s¼g¡C
  ¦h·Q=·Q·Q¬°¤°»ò¤H®aµ{¦¡­n¨º¼Ë¼g¡A¦pªG´«¦¨¦Û¤v¡A¤S·|«ç¼g¡C
  ¦h¾Ç²ß=¾Ç²ß¤H®aªºµo°Ý¨Ã¸Ñµª¡A¾Ç²ß¤H®aªº¼gªk

  ¤Ö¬Ý=¥u¬Ý¤£°µ¤]ªPµM

TOP

¥ý§â Trim( )  ®³±¼, ·í§@¨S¦³¼g¹L

    Code                ->        »¡©ú                                                   
(TB5 + TB6) <> "" -> ªí¥Ü TB5, TB6 ¤G¤H¤§¤¤ '¦Ü¤Ö¦³1¤H' ¦³ keyin
(TB7 + TB8) <> "" -> ªí¥Ü TB7, TB8 ¤G¤H¤§¤¤ '¦Ü¤Ö¦³1¤H' ¦³ keyin

If  (TB5 + TB6) <> "" And (TB7 + TB8) <> ""  Then

§â ¡ô¡ô¡ô¡ô¡ô¡ô ªº Code ¨ú¥N¦¨ »¡©ú ±o¨ì ¡õ¡õ¡õ¡õ¡õ¡õ

If  (TB5, TB6 ¤G¤H¤§¤¤ '¦Ü¤Ö¦³1¤H' ¦³keyin)   ¦P®É (TB7, TB8 ¤G¤H¤§¤¤ '¦Ü¤Ö¦³1¤H' ¦³keyin) Then
   MsgBox "½Ð¾Ü¤@¿é¤J"
   GoTo END1
end if

TOP

ÁÂÁÂmark«e½ú¤Îbobomi¬ü¤k¦Ñ®v¡I©êºp¡A¤W¯Z®É¶¡³£¤ñ¸û¦£¡A¦Ó¥B¤½¥qºô¸ô¦³Âê¡A©Ò¥H±`±`«ÜºC¦^¡I

TOP

        ÀR«ä¦Û¦b : ·O´d¨S¦³¼Ä¤H¡A´¼¼z¤£°_·Ð´o¡C
ªð¦^¦Cªí ¤W¤@¥DÃD