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

[µo°Ý] °ÊºA·s¼W±±¨î«á«ç»òIJµo¨Æ¥ó

[µo°Ý] °ÊºA·s¼W±±¨î«á«ç»òIJµo¨Æ¥ó

§Q¥Î¥H¤Uµ{¦¡«Ø¥ß¤F,3­ÓTextBox
Private Sub CommandButton1_Click()
Dim i,k As Integer
Dim theTextBox  As Control
K=10
For i= 1 to  3
Set theTextBox =ME.Controls.Add("Forms.TextBox.1", "TextBox"&i, True)
With  theTextBox
  .Left = 210
  .Top=K
  K=.Top+.Height+ 18
End with
Next i
Set  theTextBox =Nothing
End sub
«áÄò¨C­ÓTextBox·Q­n_Change()ªº¨Æ¥ó¡A¨Ã±±¨î¨C­ÓTextBox¥u¯à¿é¤J¼Æ¦r
½Ð°Ý¸Ó«ç»ò¼g???

¥»©«³Ì«á¥Ñ GBKEE ©ó 2016-4-8 13:47 ½s¿è

¦^´_ 1# modelcrazyer
1 ªí³æ¼Ò²Õµ{¦¡½X
  1. Option Explicit
  2. Dim AA(1 To 3) As New Class1
  3. Private Sub CommandButton1_Click()
  4.     Dim theTextBox  As Control, K As Integer, I As Integer
  5.     K = 10
  6.     For I = 1 To 3
  7.         Set theTextBox = Me.Controls.Add("Forms.TextBox.1", "TextBox" & I, True)
  8.         Set AA(I).C_TextBox = theTextBox
  9.         With theTextBox
  10.                 .Left = 210
  11.                 .Top = K
  12.                 K = .Top + .Height + 18
  13.         End With
  14.     Next I
  15.     Set theTextBox = Nothing
  16. End Sub
½Æ»s¥N½X
2 ª«¥óÃþ§O¼Ò²Õ·s¼W¤@¼Ò²Õ:·|¦Û°Ê©R¦W Class1
  1. Option Explicit
  2. Public WithEvents C_TextBox As MSForms.TextBox
  3. Private Sub C_TextBox_Change()
  4.     If Not IsNumeric(C_TextBox) Then MsgBox C_TextBox & " ¤£¬O¼Æ¦r"
  5. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

ÁÂÁ¡A´N¬O³o¼Ë¡C·PÁ¤j¤jÀ°¦£

TOP

¥i¥H¬Ù²¤theTextBox
ª½±µSet AA(I).C_TextBox = Me.Controls.Add("Forms.TextBox.1", "TextBox" & I, True)
¤]¥i¥H

TOP

¥i¥H¬Ù²¤theTextBox
ª½±µSet AA(I).C_TextBox = Me.Controls.Add("Forms.TextBox.1", "TextBox" & I, True ...
linyancheng µoªí©ó 2016-4-11 13:30

¦¹³Bµ´¹ï¤£¥i¥H°½Ãi±N theTextBox ¬Ù²¤¡A
¦pªG¤©¥H¬Ù²¤¦¨¡G
  1.         '  Set theTextBox = Me.Controls.Add("Forms.TextBox.1", "TextBox" & I, True)
  2.         '  Set AA(I).C_TextBox = theTextBox
  3.         Set AA(I).C_TextBox = Me.Controls.Add("Forms.TextBox.1", "TextBox" & I, True)
½Æ»s¥N½X
±µ¤U¨Óªº°õ¦æ±N·|¥X²{
  1. °õ¦æ¶¥¬q¿ù»~ 91¡G
  2. ¨S¦³³]©wª«¥óÅܼƩΠWith °Ï¶ôÅܼÆ
½Æ»s¥N½X
©Ò¥H GBKEE ¤j¤j­ì¥»ªº³]©w»P¦Ò¶q¬O¥¿½TµL»~»~ªº¡G
  1.         Set theTextBox = Me.Controls.Add("Forms.TextBox.1", "TextBox" & I, True)
  2.         Set AA(I).C_TextBox = theTextBox

  3.         With theTextBox
  4.                 .
  5.                .
  6.         End With
½Æ»s¥N½X

TOP

¦^´_ 4# linyancheng
°£«D§A¤£¨Ï¥Î theTextBox «Å§i¤§ÅܼơA¦Óª½±µ±N¥¦¼g¦¨¡G
  1.     For I = 1 To 3
  2.         '  Set theTextBox  = Me.Controls.Add("Forms.TextBox.1", "TextBox" & I, True)
  3.         '  Set AA(I).C_TextBox =theTextBox     '  ¥i¥H¬Ù²¤ theTextBox
  4.         Set AA(I).C_TextBox = Me.Controls.Add("Forms.TextBox.1", "TextBox" & I, True)
  5.         
  6.         '  With theTextBox
  7.         With AA(I).C_TextBox
  8.                 .Left = 50
  9.                 .Top = K
  10.                 K = .Top + .Height + 18
  11.         End With
  12.     Next I
½Æ»s¥N½X
¤è¥i¡C

TOP

·PÁ¦U¦ì!!²×©ó¸Ñ¨M¤F!!

TOP

        ÀR«ä¦Û¦b : Ä@­n¤j¡B§Ó­n°í¡B®ð­n¬X¡B¤ß­n²Ó¡C
ªð¦^¦Cªí ¤W¤@¥DÃD