投稿日 | : 2004/06/08(Tue) 01:14 |
投稿者 | : 花ちゃん |
Eメール | : |
URL | : |
タイトル | : Re: テキストボックス内での日付・数字の入力・表示方法 |
下記のような方法でもよければ
Private Sub Form_Load()
Text1.MaxLength = 10
End Sub
Private Sub Text1_Change()
Text1.Text = SetDateStyle(Text1.Text)
End Sub
Function SetDateStyle(myStr As String) As String
Dim Temp As String
Temp = Replace(myStr, "/", "")
If Len(Temp) = 8 Then
SetDateStyle = Format$(Temp, "####/##/##")
If IsDate(SetDateStyle) = False Then
Beep
SetDateStyle = ""
End If
Else
SetDateStyle = myStr
End If
End Function