naina.m 0 Newbie Poster

I have made a usercontrol and in it I have define a sub add() this subroutine is dynamically creating a maskedtextbox
in windows form i have used this usercontrol and add a button to the usercontrol in the windows form
what i want is when i double click the button it should create a maskedtextbox


so far the coding I did is

in the usercontrol

Public Class TeleUserControl

Private Sub TeleUserControl_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub


Public Sub add()
Dim txtDataShow As New MaskedTextBox
txtDataShow.Height = 19
txtDataShow.Width = 50
txtDataShow.TextAlign = _
HorizontalAlignment.Center
txtDataShow.BorderStyle = _
BorderStyle.FixedSingle

txtDataShow.Location = New Point(50, 50)
Me.Controls.Add(txtDataShow)

End Sub

End Class


and in the windows form

Public Class maskForm
Dim Tp As New MaskUserControl.TeleUserControl (maskusercontrol :- windows control library)


Private Sub TeleUserControl1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TeleUserControl1.Load
End Sub
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Tp.add()
End Sub

End Class

my problem is that I am not able to see the text box when i am clicking on the button

can anyboby help me on this please

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.