CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1

    Option Strict On Disallows Late Binding

    Does anyone know how to resolve this error?

    Option Strict On Disallows Late Binding


    My code is as follows:
    Private Sub Data_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles btnGetData.Click, _
    btnSetData.Click

    Select Case sender.name
    Case btnGetData.Name
    fileData = New FileData

    fileData.FileName = CurDir() & "Test.txt"

    txtFileData.Text = fileData.GetData()
    fileData = Nothing

    Case btnSetData.Name

    Remainder of code goes here.....


    The error occurs on this statement:
    "Select Case sender.name"


    Any help would be appreciated!

    Thanks,
    Bob

    p.s. I tried using ctype and directCast on the Sender.Name reference, but I was not able to succesfully convert it.

  2. #2
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim snd As Button = DirectCast(sender, Button)
    MsgBox(snd.Name)
    End Sub

  3. #3
    Perfect-a-mundo my friend! Thanks for the help!

    Bob

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

Featured