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

͵Դҷҧ 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 0 8

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

Google   
g2gnet.com
Ҵѡ:  

Ţͧ TextBox 㹿Ẻѵѵ ... 100 Piper TextBox ʺ

Category »  VB 6/VB.Net
: Webmaster 7/7/2550 1:01:00
(ҹ : 45587) 

µ¤駷ͧ¹ͤǺѵ Control աʴẺ Dynamic ( Ŵ) ѹѡɳТͧ Run Time ¤ҨٻẺͧ Design Time ͨѺ Control ҡŧ ѧҾҹҧ


¡÷ӧҹẺ Run Time ͡ҹӡҧ CheckBox ѵѵ
ѹФӹdzӹǹ Ǣͷ㹡ûԹžѡҹ

... ͤ׹ҹ (5 ..) س˹˭ Ѵ ([email protected] ҡҹԴ¹ФѺ ǡѹ ͨ ʹ㨡¨ѴҾѴ˹ѡǹФѺ 55555) MSN ҶͧŢͧ TextBox 㹿 ҷѧ ҡ秧 Ҷ÷ѹ¨ѧ ()


ҧ

Private Sub Form_Load()
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
End Sub

ҧس [email protected] ͡ ҡẺ ... ֡Դ ... ͹ѹѡǹǫ ѹҹͧͧ "͹кҢͧ" ͧšФѺ ҤҨ¶֧¡ Object Control ͧѹ·ءԴ ... ҹЫ ҹҧͧҷͧ Control 觼ҹѵ () ... ͺ仡ͺҷ Control Code ҹ 55555 Դ ... ǡŧŧ

ѹ Control Դ˹ ѹդسѵԷҧ˹觡 ö Control ҧŧ仺ѹ ҡҧ͡ù TextBox ҧ麹ͧ ҡشҡͨ¹ 蹤 ͧ For Each Control (TextBox) ҧ躹 Form


Private Sub cmdClearForm_Click()
Dim Ctl As Control
    ' Ѻ Control ءǷҧŧ Form1
    For Each Ctl In Form1
        '  Control ǹѹ TextBox ӡҧѹ
        If TypeOf Ctl Is TextBox Then Ctl.Text = ""
    Next ' Control ǶѴ
End Sub

͹


ѧ

... TextBox Ѻµǡʺ« ẺѹЧ˹駤Ѻ ... ͧ ҡ ...

  • 㹿˹ա TextBox
  • ਤ˹ ѹ
    ٴ ûѺѹ (Sub Program) աҤѺ ѧҤèҹ Module Ҩдա

     

    
    ' С Module (ʡ .BAS)
    Option Explicit
    ' ·աѺ Control  ... 㹷ͪͿ
    Public Sub ClearForm(frm As Form)
    Dim Ctl As Control
        For Each Ctl In frm
            If TypeOf Ctl Is TextBox Then Ctl.Text = ""
        Next
    End Sub
    
    
    ' 㹿 (͹Ҩҡ Form1)
    Private Sub cmdClearForm_Click()
        ' 觤Ҫ Form1 Ѻ
        Call ClearForm(Form1)
    End Sub
    

    óբͧ Control ͹ѹФѺ ͧ ... ¡õǨͺ Control ЪԴ¤ TypeOf

    Conclusion: ͧԧ㹪Ե¤Ѻ ... ѹҧ仨ҡԹ ͵dz (չ) Ҩöͧ繵 ѡ 鹻д ûҳ Թ٧樹֧ʹ µҢͧҨͧҧҡ ͧѺŧ价 (չ) Ѻ鹷Ժѹ繵áѹ ...


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