[Solved]Now Date/Now Day
Right now in VB I'm using a "DateInterval.Month" procedure and a "DateInterval.Day" procedure. Right now this is saying that it is February 4th. Is there a way to change that? I need the current date.
If you trying to find the date just do Today.
Ex: Label1.text = today
I need to check whether textbox1 = current month and textbox2 = current day.
Uhhhh, no I don't need the time. Like I said before, I need to check whether or not TextBox1.Text = Current Month and TextBox2.Text = Current Day.
First
Namespace
[php]
Imports System.Globalization
Imports System.Threading
[/php]
Form Load Event or whatever triggers the event
I used a button
[php]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Info As CultureInfo = Thread.CurrentThread.CurrentCulture
Dim Curmonth As String = Info.DateTimeFormat.GetMonthName(DateTime.Now.Mont h)
Dim Curday As String = Info.DateTimeFormat.GetDayName(DateTime.Now.Day)
TextBox1.Text = Curmonth
TextBox2.Text = Curday
End sub
[/php]
My code will get the current month and current day and display them into separate text boxes.
Have fun
Slight error in my code
I apologize
[php]
Dim Info As CultureInfo = Thread.CurrentThread.CurrentCulture
Dim Curmonth As String = Info.DateTimeFormat.GetMonthName(DateTime.Now.Mont h)
Dim Curday As String = Info.DateTimeFormat.GetDayName(DateTime.Today.DayO fWeek)
TextBox1.Text = Curmonth
TextBox2.Text = Curday
[/php]
This should work
Your code should be
[php]
Dim Info As CultureInfo = Thread.CurrentThread.CurrentCulture
Dim Curmonth As String = Info.DateTimeFormat.GetMonthName(DateTime.Now.Mont h)
Dim Curday As String = Info.DateTimeFormat.GetDayName(DateTime.Today.DayO fWeek)
Dim strMonth As String
Dim strDay As String
Dim strName As String
strName = TextBox1.Text
strMonth = TextBox2.Text
strDay = TextBox3.Text
If Curmonth = strMonth And Curday = strDay Then
'Current date equals entered date
MessageBox.Show("'Message here'")
Else
'Current date does not equal entered date
MessageBox.Show("'Message here'")
End If
End Sub
[/php]
use the datatimepicker utility