Could any one help me with this error warning I am getting with my function.
Then end function is underline and the error message is as follows (Function 'GetShiftType' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.)Code:Private Function GetShiftType() As String Dim StartTime, EndTime As Date Dim StartHour, EndHour As Double StartTime = dtpStartTime.Text EndTime = dtpEndTime.Text StartHour = StartTime.TimeOfDay.TotalHours EndHour = EndTime.TimeOfDay.TotalHours If StartHour >= 7.0 AndAlso StartHour <= 8.5 AndAlso EndHour >= 12.0 AndAlso EndHour <= 16.0 Then txtShiftType.Text = "Ealy" btnUpdate.Focus() ElseIf StartHour >= 12.0 AndAlso StartHour <= 15.0 AndAlso EndHour >= 19.0 AndAlso EndHour <= 21.0 Then txtShiftType.Text = "Late" btnUpdate.Focus() ElseIf StartHour >= 7.0 AndAlso StartHour <= 8.5 AndAlso EndHour >= 19.0 AndAlso EndHour <= 21.0 Then txtShiftType.Text = "Long Day" btnUpdate.Focus() ElseIf StartHour >= 19.0 AndAlso StartHour <= 21.0 AndAlso EndHour >= 7.0 AndAlso EndHour <= 9.0 Then txtShiftType.Text = "Night" btnUpdate.Focus() ElseIf StartHour >= 15.0 AndAlso StartHour <= 18.0 AndAlso EndHour >= 0.0 Then txtShiftType.Text = "Toalight" btnUpdate.Focus() Else MessageBox.Show("The specified start and end times do not match any known shift.", "Check shift time") dtpStartTime.Focus() End If End Function
Thanks




Reply With Quote