Late Binding Problem - Need Help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Siv

    Late Binding Problem - Need Help

    Hi,
    I have this block of old code:

    Private Sub txtBoxes_DragDr op(ByVal sender As Object, ByVal e As
    System.Windows. Forms.DragEvent Args) _
    Handles txtQL12.DragDro p, txtQL11.DragDro p, txtQL10.DragDro p,
    txtQL09.DragDro p, _
    txtQL08.DragDro p, txtQL07.DragDro p, txtQL06.DragDro p,
    txtQL05.DragDro p, _
    txtQL04.DragDro p, txtQL03.DragDro p, txtQL02.DragDro p,
    txtQL01.DragDro p, _
    txtV01.DragDrop , txtV02.DragDrop , txtV03.DragDrop , txtV04.DragDrop ,
    _
    txtV05.DragDrop , txtV06.DragDrop , txtV07.DragDrop , txtV08.DragDrop ,
    _
    txtV09.DragDrop , txtV10.DragDrop , txtV11.DragDrop , txtV12.DragDrop ,
    _
    txtV13.DragDrop , txtV14.DragDrop , txtV15.DragDrop , txtV16.DragDrop ,
    _
    txtV17.DragDrop , txtV18.DragDrop , txtV19.DragDrop , txtV20.DragDrop ,
    _
    txtQuoteValidFr om.DragDrop

    sender.Text += e.Data.GetData( DataFormats.Tex t).ToString

    End Sub

    I am converting my application so that it runs with Option Strict on and the
    compiler complains about the late binding being used here (sender.text), can
    anyone recommend a neat way of handling this without having to write an
    individual event procedure for each of these text boxes that will avoid the
    late binding issue. I have pondered it for a while and can't think of a way
    of doing it that will not hit the same late binding issue.

    Thanks for your help.

    Siv
    Martley, Near Worcester, UK.

  • Armin Zingler

    #2
    Re: Late Binding Problem - Need Help

    "Siv" <g@removethiste xtsivill.comsch rieb
    sender.Text += e.Data.GetData( DataFormats.Tex t).ToString
    >
    End Sub
    >
    I am converting my application so that it runs with Option Strict on
    and the compiler complains about the late binding being used here
    (sender.text), can anyone recommend a neat way of handling this
    without having to write an individual event procedure for each of
    these text boxes that will avoid the late binding issue. I have
    pondered it for a while and can't think of a way of doing it that
    will not hit the same late binding issue.
    If it's all textboxes:

    directcast(send er, textbox).Text += ...


    Armin

    Comment

    • Siv

      #3
      Re: Late Binding Problem - Need Help

      Armin,
      Yes they are. I was unaware of that function. Brilliant, I'll try it and see
      if it works. If it does it will save a heck of a lot of code.
      Thanks for your help.

      Siv

      "Armin Zingler" <az.nospam@free net.dewrote in message
      news:uvf2qW2gIH A.4320@TK2MSFTN GP06.phx.gbl...
      "Siv" <g@removethiste xtsivill.comsch rieb
      > sender.Text += e.Data.GetData( DataFormats.Tex t).ToString
      >>
      > End Sub
      >>
      >I am converting my application so that it runs with Option Strict on
      >and the compiler complains about the late binding being used here
      >(sender.text ), can anyone recommend a neat way of handling this
      >without having to write an individual event procedure for each of
      >these text boxes that will avoid the late binding issue. I have
      >pondered it for a while and can't think of a way of doing it that
      >will not hit the same late binding issue.
      >
      If it's all textboxes:
      >
      directcast(send er, textbox).Text += ...
      >
      >
      Armin
      >

      Comment

      • Siv

        #4
        Re: Late Binding Problem - Need Help

        Armin,
        Yes, the compiler seems happy now. I still have a lot more code to convert
        before I can run the app, but will post back here with the results when I
        do.

        Thanks again. Something I have learned today!

        Siv

        "Armin Zingler" <az.nospam@free net.dewrote in message
        news:uvf2qW2gIH A.4320@TK2MSFTN GP06.phx.gbl...
        "Siv" <g@removethiste xtsivill.comsch rieb
        > sender.Text += e.Data.GetData( DataFormats.Tex t).ToString
        >>
        > End Sub
        >>
        >I am converting my application so that it runs with Option Strict on
        >and the compiler complains about the late binding being used here
        >(sender.text ), can anyone recommend a neat way of handling this
        >without having to write an individual event procedure for each of
        >these text boxes that will avoid the late binding issue. I have
        >pondered it for a while and can't think of a way of doing it that
        >will not hit the same late binding issue.
        >
        If it's all textboxes:
        >
        directcast(send er, textbox).Text += ...
        >
        >
        Armin
        >

        Comment

        • Siv

          #5
          Re: Late Binding Problem - Need Help

          Armin,
          I have now completed the conversion and the directcast function hasn't
          caused any problems.
          Many thanks.

          Siv

          "Armin Zingler" <az.nospam@free net.dewrote in message
          news:uvf2qW2gIH A.4320@TK2MSFTN GP06.phx.gbl...
          "Siv" <g@removethiste xtsivill.comsch rieb
          > sender.Text += e.Data.GetData( DataFormats.Tex t).ToString
          >>
          > End Sub
          >>
          >I am converting my application so that it runs with Option Strict on
          >and the compiler complains about the late binding being used here
          >(sender.text ), can anyone recommend a neat way of handling this
          >without having to write an individual event procedure for each of
          >these text boxes that will avoid the late binding issue. I have
          >pondered it for a while and can't think of a way of doing it that
          >will not hit the same late binding issue.
          >
          If it's all textboxes:
          >
          directcast(send er, textbox).Text += ...
          >
          >
          Armin
          >

          Comment

          Working...