iolaus писал(а):Почему?
Option Explicit
Private WithEvents CSE1 As VBControlExtender
Private Sub CSE1_ObjectEvent(Info As EventInfo)
Select Case Info.Name
Case "Click"
Debug.Print "click"
End Select
End Sub
Private Sub Form_Load()
With Me.Controls.Add("Project1.CSE", "CSE1", Me)
.Top = 0
.Left = Me.Width - .Width
.Visible = True
End With
Set CSE1 = Me.Controls("CSE1")
End Sub
option explicit
Private WithEvents CSE1 As CSE
Private Sub CSE1_Click
Debug.Print "click"
End Sub
Private Sub Form_Load()
Set CSE1 = Me.Controls.Add("Project1.CSE", "CSE1")
With CSE1
.Move Me.Width - .Width, 0
.Visible = True
End With
End Sub
Первый вариан мне если честно удобнее даже.
Что за "оболочка"?
Dim m_Width As Integer
Public Property Get Width() As Integer
Width = m_Width
End Property
Public Property Let Width(ByVal New_Width As Integer)
m_Width = New_Width
'PropertyChanged "Width"
End Property
Private txtdoug() As DtextBox
Private Sub Form_Load()
Dim i As Integer
For i = 0 To 4
ReDim Preserve txtdoug(i)
Set txtdoug(i) = New DtextBox
txtdoug(i).MyMake Me, i
With Form1.Controls("dtext" & i) ' TxtAny
.Left = 700
.Top = 700 + 500 * i
.Width = 1240
.Height = 240
.Text = .Name
.Visible = True
End With
Next i
End Sub
Private WithEvents txtdoug As TextBox
Public Sub MyMake(Fname As Form, i As Integer)
Set txtdoug = Fname.Controls.Add("vb.textbox", "Dtext" & i, Fname)
End Sub
Private Sub txtdoug_Click()
ShoMsg txtdoug
End Sub
Private Sub ShoMsg(txtAny As TextBox)
MsgBox txtAny.Name
End Sub
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 94