I am very interested in knowing how i might code a function using the DateTimePicker control to see if i can to check and see if and when any date and day of any given year falls on a sunday so that the function will force a radiobutton.checked from one button to another. Do you have any suggestions about code for that?

As a matter of fact I do have something that you could look at and come up with something that may work for you but that is not the point of these forums. The point is, is we would like to see an effort from you and what you have tried. Also, are radio buttons an array and how many and what is the purpose of testing to see if a selected date is a Sunday and why do you need to change the radio buttons value?

Hint: Look up the WeekDay Function...

Good Luck

RadioButtons are not in an array and the purpose of this project assigns a number value to each button ranging from 1 to 7. These values are used in turn to do a plus and minus calculation on a single digit number.

In my own effort I started with the code shown below, however, it does not produce the desired result that is needed, nor does it cause a runtime error. Thanks for your reply, and I will study the WeekDay function. Thanks again.

The code...

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim result As Date
Dim Value As Date
Value = Sunday
result = DateTimePicker1.Value
If result = Sunday Then
RadioButton2.Checked = False
RadioButton1.Checked = True
MsgBox("It is a working code! .Thank You...", MsgBoxStyle.Information, "Confirmation")
Else
MsgBox("Sorry.Code did not work. Try again", MsgBoxStyle.Critical, "Invalid")

End If
End Sub
End Class

As a matter of fact I do have something that you could look at and come up with something that may work for you but that is not the point of these forums. The point is, is we would like to see an effort from you and what you have tried. Also, are radio buttons an array and how many and what is the purpose of testing to see if a selected date is a Sunday and why do you need to change the radio buttons value?

Hint: Look up the WeekDay Function...

Good Luck

WeekDay Function is working perfectly! Thanks for the tip! Below is new code that causes the desired results to happen just the way I wanted it to.

New code...

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyDate, MyWeekDay
MyDate = DateTimePicker1.Value
MyWeekDay = Weekday(MyDate)

If MyWeekDay = 1 Then
RadioButton2.Checked = False
RadioButton1.Checked = True
MsgBox("It is a working code! .Thank You...", MsgBoxStyle.Information, "Confirmation")
Else
MsgBox("Sorry.Code did not work. Try again", MsgBoxStyle.Critical, "Invalid")

End If
End Sub
End Class

I'm glad you got it working. Now I have two request of you...

1. Please mark this thread as solved
2. and next time you have a question, please post it in the correct forum as this is not the VB.NET Forum that you need. This forum is pre .NET tech...

Good Luck

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.