here's a class that will allow you to calculate sunrise and sunset. i hardcoded my latitude and longitude. if you don't live in memphis, you'll need to enter your own latitufe and longitude as the first two variables in the call to CalculateSolarTimes.
if you don't know your latitude and longitude, launch google earth and enter your address. it will show the latutude and longitude in the lower left corner of the screen. if you use google earth, remember that the latitude and longitude displayed are in degrees, minutes, and seconds. The app expects the latitude and longitude to be a double.
if it is after sunset on the current day, i added a day and ran the calculation again so that it would always tell you the next sunrise,
Private Sub UpdateSunriseAndSunset()Dim oSunrise As New SunriseAndSunset
Dim dtSunrise As Date
Dim dtSolarNoon As Date
Dim dtSunset As Date
Dim dtTomorrow As DateDim dtNow As Date = Date.Now
' Get sunrise, solar noon, and sunset
oSunrise.CalculateSolarTimes(35.1, 89.8666, dtNow, dtSunrise, dtSolarNoon, dtSunset)
' If it's after sunset calculate the next sunrise, solar noon, and sunset
If dtNow.TimeOfDay > dtSunset.TimeOfDay Then
dtTomorrow = dtNow.AddDays(1)
oSunrise.CalculateSolarTimes(35.1, 89.8666, dtTomorrow, dtSunrise, dtSolarNoon, dtSunset)
' do something with the sunrise and sunset you just calculated