Hi @Mansour_Dalir ,
You can create a custom ToolStripControlHost and add the MaskedTextBox to it.
Public Class MaskedTextBoxToolStripControlHost
Inherits ToolStripControlHost
Public Sub New()
MyBase.New(New MaskedTextBox())
End Sub
Public ReadOnly Property MaskedTextBoxControl As MaskedTextBox
Get
Return CType(Me.Control, MaskedTextBox)
End Get
End Property
End Class
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim maskedTextBoxHost As New MaskedTextBoxToolStripControlHost()
maskedTextBoxHost.MaskedTextBoxControl.Mask = "00/00/0000"
maskedTextBoxHost.MaskedTextBoxControl.Size = New Size(100, 20)
ToolStrip1.Items.Add(maskedTextBoxHost)
End Sub
End Class
Best Regards.
Jiachen Li
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.