Results 1 to 3 of 3

Thread: late binding

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678

    late binding

    Hi,
    Could you please explain why and where late binding is used in .net with a few examples?
    Thanks

  2. #2
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036
    Hi

    Simply don't late bind!

    Calls on objects causes late binding that require extra work at runtime. Operators on objects causes late binding.

    VB Code:
    1. dim o,o1,o2 as object
    2. o = o1 + o2 '' late binding

    Option Strict ON will catch late binding

    Regards
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

  3. #3
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Originally posted by Asgorath
    Hi

    Simply don't late bind!

    Calls on objects causes late binding that require extra work at runtime. Operators on objects causes late binding.

    VB Code:
    1. dim o,o1,o2 as object
    2. o = o1 + o2 '' late binding

    Option Strict ON will catch late binding

    Regards
    Jorge
    Hi,

    I have the following function

    [Highlight=VB]
    Function standev(ByVal mean As Double, ByVal grades As Array) As Double
    Dim x As Integer
    Dim totaltop As Double = 0
    For x = 0 To grades.Length - 1
    totaltop = totaltop + (grades(x) - mean) * (grades(x) - mean)
    Next
    Return Math.Sqrt(totaltop / (grades.Length))
    End Function
    [vbcode

    As you point out, with Option Strict On grades(x) is late binding.

    However, if I cut and paste the entire sub code into a button_click event I have no problem.

    Are you saying that it is the calling of the Sub which causes the problem? (Grades() is a form scope integer array).
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width