ҡդӶ ʵŧ 纺촨շ٨絴͵ ᷹ФѺ

͵Դҷҧ Inbox Ѻ

˹ѡ
-
VB 6/VB.Net
ASP/ASP.Net
Ѻ¤
¹ҹ Flash Movie
ռͺش  
 RSS Feeds
 ǹŴ RSS Reader ...   Download  RSS Reader

Forum - www.g2gnet.com
Webmaster - www.g2gnet.com
Visitors - Session views
 5 6 1 6 1 5 8

7 ѹҤ ..2549
113 Users On-Line.
Visitors - Page views
 8 9 7 3 9 0 1
1 Ҿѹ ..2551

Google   
g2gnet.com
Ҵѡ:  

Ǩͺá鹤Ѻ੾еŢ (VB.Net)

Category »  VB 6/VB.Net
: Webmaster 15/6/2551   : 16:39
(ҹ : 38346) 
»ա͹͹ǵҧҵ (ҵԪǹФѺ ... 55555) ¶ " Dot Net ѹѧ ?" ... ǡмͺ仵Դ ͹кҢͧẺͧ ҵͺѺ ͧҵ¤Ѻ ... Һ͡ "ѹ͡ù DLL Dynamics Link Library ҹԹ ()" ... 55555+ ӹѹ繡º Ъ M$ ФѺ ... Ҿ͢Ѻ Ѻ VB6 ѡѧ෤ дѹ繤Ҵͧ VB6 ѹԴ OOP 100% ... 55555+ ... ǹйǤԴͧ VB6 100% ͡Ѻ ѭѺ VB.Net Ѻѹ ... Ш
 Ǩͺá鹤Ѻ੾еŢ Шشȹҹ (VB6 Ѻ)
 سҹ´ԸաäԴѺŢӹǹ ...
ASCII = American Standard Code for Information Interchange
ҷس鹤촵ѡ "A" ͧѹѡ͡Ѻ ѹѡᵡҧҧѡ俿 + Ѻ Ground + Ѻ - ʶҹ High Voltage Ѻ Low Voltage ... ҨйѹººСǶ֧§ "0" Ѻ "1" (Ţк Binary ҹ 2) ѧѡ "A" ᷹Ţҹ 2 (Binary) Ҩ 0 1 0 0 0 0 0 1 65 㹰ҹ 10 (Ҩҡ 0+64+0+0+0+0+0+1 = 65 Ҩ¡ѹ ASCII Code ФѺͧ) ... ФѺҧҢͧ ASCII (ҹ ʡ) ѹ繷º ѧ鹤 ASCII Code Ѻѡ 0 - 9
  • "0" = 0 0 1 1 0 0 0 0 48 (ҹ 10)
  • "1" = 0 0 1 1 0 0 0 1 49 (ҹ 10)
  • "2" = 0 0 1 1 0 0 1 0 50 (ҹ 10)
  • ..... ....
  • "9" = 0 0 1 1 1 0 0 1 57 (ҹ 10)
    ͧ繷ҧҧ¤Ѻͧ ... ⨷㹢͹Ǩͺá鹤Ѻ੾еŢ ... ѧǤԴẺ˹ٹ͹غ
  • ҡ顴Ţҧ 0 - 9 (ͧ ASCII Code ҧ 48 ֧ 57) 觤 ASCII Code Ѻ׹ (ѧ Asc, Chr Ҫ ѧ ѹѡ ASCII Code ҹ)
  • ͡˹ͨҡ еͧͤá ͹˹աá
    ǤԴẺ 1 :
    ҧ¹ǤԴҡ VB6 ... ѧ鹼蹵Ƿҧ ASCII Code ö KeyAscii VB6 ҹ Dot Net ѧ鹨֧ͧ e.KeyChar (ѹкؤ ͡ "S") Ҫ ŧ ASCII Code ¤ Asc ա
    ǹ e.Handled 㹤¢ͧ ú觺͡ʶҹСͤ˵ءó Keypress ...
  • ҡѹ False ʴԴ Return Ҥ衴 ( ASCII )
  • ҡѹ True ʴԴ Return Ҥ衴 0 (աá)
    
        Private Sub TextBox1_KeyPress(ByVal sender As Object, _
                                      ByVal e As System.Windows.Forms.KeyPressEventArgs _
                                      ) _
                                      Handles TextBox1.KeyPress
    
            Dim KeyAscii As Short = Asc(e.KeyChar)
            Select Case KeyAscii
                Case 48 To 57
                    e.Handled = False
                Case 8, 13, 46 ' Backspace = 8, Enter = 13, Delete = 46
                    e.Handled = False
                Case Else
                    e.Handled = True
            End Select
        End Sub
    
    ¹Ẻҡ TextBox ӹǹҡзѧ䧴 ... ¹繿ѧ (Function) ᷹ԤѺͧ
    
        Private Sub TextBox1_KeyPress(ByVal sender As Object, _
                                      ByVal e As System.Windows.Forms.KeyPressEventArgs _
                                      ) _
                                      Handles TextBox1.KeyPress
    
            Dim KeyAscii As Short = Asc(e.KeyChar)
            ' Ǩͺ Return ҡѺ True  False
            e.Handled = CheckDigitOnly(KeyAscii)
        End Sub
    	
        Function CheckDigitOnly(ByVal index As Integer) As Boolean
            Select Case index
                Case 48 To 57 ' Ţ 0 - 9
                    CheckDigitOnly = False
                Case 8, 13, 46 ' Backspace = 8, Enter = 13, Delete = 46
                    CheckDigitOnly = False
                Case Else
                    CheckDigitOnly = True
            End Select
        End Function
    
    ǤԴẺ 2 :
    Ẻ 1 ֡ѹкҹԹ ͧŴٻẺŧ ... ѧ ( ) Asc(ѡ) кصѡйµç Asc("0") դ ASCII Code ҡѺ 48
    
        Private Sub TextBox1_KeyPress(ByVal sender As Object, _
                                      ByVal e As System.Windows.Forms.KeyPressEventArgs _
                                      ) _
                                      Handles TextBox1.KeyPress
            Select Case Asc(e.KeyChar)
                Case 48 To 57
                    e.Handled = False
                Case 8, 13, 46 ' Backspace = 8, Enter = 13, Delete = 46
                    e.Handled = False
                Case Else
                    e.Handled = True
            End Select
        End Sub
    
    ǤԴẺ 3 :
    ѧ (ͤ) Chr(ʡ) Ҫ 蹤 Chr(48) դҡѺѡ "0"
    
        Private Sub TextBox1_KeyPress(ByVal sender As Object, _
                                      ByVal e As System.Windows.Forms.KeyPressEventArgs _
                                      ) _
                                      Handles TextBox1.KeyPress
            Select Case e.KeyChar
                Case Chr(48) To Chr(57)
                    e.Handled = False
                Case Chr(8), Chr(13), Chr(46)
                    e.Handled = False
                Case Else
                    e.Handled = True
            End Select
        End Sub
    
    ǤԴẺ 4 :
    ǹѡµç "0", "1", ... "9" (ͧͧ Double Quote "")
    
        Private Sub TextBox1_KeyPress(ByVal sender As Object, _
                                      ByVal e As System.Windows.Forms.KeyPressEventArgs _
                                      ) _
                                      Handles TextBox1.KeyPress
            Select Case e.KeyChar
                Case "0" To "9"
                    e.Handled = False
                Case Chr(8), Chr(13), Chr(46)
                    e.Handled = False
                Case Else
                    e.Handled = True
            End Select
        End Sub
    
    Conclusion:
    ҧáѹҧѺͧ ... ҾѹѴѧ Ҩ֡Ҩҡá "ǤԴ Algorithm" 㹡ѭҹ ѹ¹ŧ仵ҹ ¹ٻẺ (Syntax) Ըաùҹ Шҡҧʹ͹ ѹǤԴ¡ "鹰ҹ" (ѡǶ֧繻Ш) ... ͧ͹Ѻ֡ҴǡѺͧͧ Bit/Byte Դͧŵҧ оǡФ BASIC ͧҧͧ㹡ѭ Ѳ-ʹ͡աҡ

  • ͵ - g2gNet Dot Com
    Ţ¹ҳԪ硷͹ԡ 0407314800231
    CopyLeft © 2004 - 2099 g2gNet.Com All rights reserved.
    Email: [email protected] . 08-6862-6560