DatetimePicker.Visible = False로 설정했으며 TextBox를 클릭하면 텍스트 상자 안에 표시됩니다. 내 코드는 하나의 텍스트 상자에서 작동하지만 다른 텍스트 상자에서는 작동하지 않습니다.텍스트 상자에 DateTimePicker 표시
Private Sub Show_DTP(Ctl As Control)
Dim x As Integer = 0
Dim y As Integer = 0
Dim Width As Integer = 0
Dim height As Integer = 0
Dim rect As Rectangle
Select Case Ctl.Name
Case "TxtTest"
rect = TxtTest.DisplayRectangle()
x = rect.X + TxtTest.Left
y = rect.Y + TxtTest.Top
Width = rect.Width + 4
height = rect.Height
With My_DTP
.SetBounds(x, y, Width, height)
.Visible = True
.Focus()
End With
Case "Txt2"
rect = Txt2.DisplayRectangle()
x = rect.X + Txt2.Left
y = rect.Y + Txt2.Top
Width = rect.Width + 4
height = rect.Height
With My_DTP
.SetBounds(x, y, Width, height)
.Visible = True
.Focus()
End With
End Select
End Sub
Private Sub Text_Click(sender As Object, e As EventArgs) Handles TxtTest.Click, Txt2.Click
Dim Txt As System.Windows.Forms.TextBox = DirectCast(sender, TextBox)
My_DTP.Visible = False
Show_DTP(Txt)
End Sub
무엇이 잘못 되었나요?
무엇을하려고합니까? – Plutonix
사례 명세서 (C#의 경우 중단) 뒤에 "Exit Select"가 없습니다. –
@Plutonix, 일부 텍스트 상자 내에 동일한 DTP를 표시하려고합니다. 그리고이 DTP를 사용하여 텍스트 상자에 값을 입력합니다. – LuckyLuke82