Chong Posted April 16, 2003 Posted April 16, 2003 I have created the text box at run time and but when I create a sub routine for a DoubClick, this Sub never run even if I double click the text box to clear the value in it. Below is my code, please help you have any idea why. Private WithEvents txtRank As System.Windows.Forms.TextBox Private Sub txtBoxCreate() Dim txtRank As New TextBox() nlApplicant.SuspendLayout() With txtRank .Width = 20 .Height = h .Location = New Point(x, y) .AutoSize = True .MaxLength = 2 .BackColor = System.Drawing.Color.White .Visible = True .Anchor = AnchorStyles.Bottom .Show() End With pnlApplicant.Controls.Add(txtRank) pnlApplicant.ResumeLayout(True) End Sub Private Sub txtRank_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtRank.DoubleClick txtRank.Text = "" End Sub Many thanks in advance. Chong Quote
Moderators Robby Posted April 16, 2003 Moderators Posted April 16, 2003 You need to Add a Handler for the text box, also, you don't need to declare it twice. AddHandler txtRank.DoubleClick, AddressOf txtRank_DoubleClick Quote Visit...Bassic Software
Chong Posted April 17, 2003 Author Posted April 17, 2003 Thank you very much! I'll give that a try. Chong Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.