создаю юзерконтрол, пихаю туда текстбокс, ставлю обработчик на Enter этого текст боксаб например мессагу, созжаю форму кидаю на нее свой контрол, добавляю пару других, выполняю, в итоге событие Enter для моего контрола выполняется только раз, и не только Enter, до Leave вообще невозможно достучаться ни первый ни второй раз!!! что это такое. вот этот контрол, в нем ничего такого нет: Public Class Block Inherits System.Windows.Forms.UserControl #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'UserControl overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents txtTitle As System.Windows.Forms.Label Friend WithEvents txtBox As System.Windows.Forms.TextBox Private Sub InitializeComponent() Me.txtTitle = New System.Windows.Forms.Label() Me.txtBox = New System.Windows.Forms.TextBox() Me.SuspendLayout() ' 'txtTitle ' Me.txtTitle.BackColor = System.Drawing.Color.White Me.txtTitle.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(204, Byte)) Me.txtTitle.Location = New System.Drawing.Point(32, 8) Me.txtTitle.Name = "txtTitle" Me.txtTitle.Size = New System.Drawing.Size(176, 64) Me.txtTitle.TabIndex = 0 Me.txtTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter ' 'txtBox ' Me.txtBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.txtBox.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(204, Byte)) Me.txtBox.Location = New System.Drawing.Point(48, 24) Me.txtBox.Multiline = True Me.txtBox.Name = "txtBox" Me.txtBox.Size = New System.Drawing.Size(136, 32) Me.txtBox.TabIndex = 2 Me.txtBox.Text = "" ' 'Block ' Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.txtBox, Me.txtTitle}) Me.Name = "Block" Me.Size = New System.Drawing.Size(344, 144) Me.ResumeLayout(False) End Sub #End Region Private Sub txtBox_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtBox.Leave MsgBox(1) End Sub Private Sub txtBox_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtBox.Enter MsgBox(1) End Sub End Class
Ответить
|