Hi,
I have an application in vb.net 2003 and now converted to vb.net 2005
Application is running properly but some warning message is show in error list..
Following warning has been given: Function 1Code:Public Function UserIpAddress() Try Dim IntPos As Integer Dim strDecode As String Dim hostName As String = System.Net.Dns.GetHostName Dim IpAddress As String = System.Net.Dns.GetHostEntry(hostName).AddressList(0).ToString For IntPos = 1 To Len(IpAddress) strDecode = strDecode & SmEncrypt(Mid(IpAddress, IntPos, 1)) Next UserIpAddress = strdecode Return UserIpAddress Catch ex As Exception Exit Function End Try End Function ‘—Function 2 Private Function RetDay(ByVal dt As Integer) As String Select Case dt Case 1 RetDay = "Monday" Case 0 RetDay = "Sunday" End Select End Function
1. Function without an 'AS' clause ; return type of object assumed.
2. Function 'UserIpAddress' doesn't return a value on all code paths.
A null reference exception could occur at run time when the result is used.
Function 2:
Warinig: Function 'RetDay' doesn't return a value on all code paths.
A null reference exception could occur at run time when the result is used.
--If I write the return retday in every case than also the same warning is given
Me.Cursor.Current = Cursors.WaitCursor
(warinig: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.)
If I write the code trn.rollback in catch
variable 'trn' is used before it has been assigned a value.
A null reference exception could result at runtime.
thanks
asm




Reply With Quote