The compiler is telling you this because it is possible that your
object may or may not have a
property or field (e.g. oInstance.SerialNumber), yet you continue to
assign it to a variable (e.g. sSerial).

This link might give you a clue:

http://dotnetdud.blogspot.com/2008/04/late-bound-resolution-in-net.html



Regards,


Benj




On Apr 5, 10:54 am, "*nixtechno" <[email protected]> wrote:
> I'm getting more and more into keeping everything pretty strict within
> whatever I code, however I keep finding some issue under a function of
> mine that I would like to see if anyone else can chime in and help out
> here by resolving this late binding "Warning" However I want to make
> it work, I just can't figure out the proper syntax on getting it to do
> late binding as you know, if you declare the variable to be of a
> specific type, the compiler can perform early binding at compile time.
> This results in improved performance!!!
>
> So if anyone can assist, I would appreciate it, as I tried a few ways,
> maybe someone has the right syntax and how it should be done... I may
> be a bit whooped but it's getting to near end here with this LAST
> warning left:
>
> "Warning   1       Late bound resolution; runtime errors could occur"
>
> Public Function GetUnique() As String
>                         Static sSerial As String
>
>                         Dim oCompSysWMI As Object
>                         Dim oInstance As Object
>
>                         Try
>                                 'End If
>                                 If sSerial = "" Then
>                                         oCompSysWMI = 
> GetObject("WinMgmts:").InstancesOf("Win32_Bios")
>                                         For Each oInstance In oCompSysWMI
>                                                 sSerial = 
> Trim(oInstance.SerialNumber)
>                                                 Exit For
>                                         Next
>                                 End If
>                         Catch ex As Exception
>                                 Return GetHash(String.Empty)
>                         End Try
>
>                         Return GetHash(sSerial)
>                 End Function

Reply via email to