Skip to content

Instantly share code, notes, and snippets.

@Hedgehogs1974
Created June 21, 2023 23:09
Show Gist options
  • Save Hedgehogs1974/5bb49195099277544fb09a13d535750b to your computer and use it in GitHub Desktop.
Save Hedgehogs1974/5bb49195099277544fb09a13d535750b to your computer and use it in GitHub Desktop.
Dim Year As String = Text.ToString.Substring(0, 2)
Dim Month As String = Text.ToString.Substring(2, 2)
Dim Day As String = Text.ToString.Substring(4, 2)
Try
'日付型に変換して有効な値が設定されているか確認する
Dim tmp As String = String.Format("20{0}/{1}/{2}", Year, Month, Day)
DateTime.Parse(tmp)
Catch
MessageBox.Show("有効な日付を設定してください")
Me.Focus()
Return
End Try
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment