Solved

Casting

Posted on 2006-10-27
2
332 Views
Last Modified: 2010-04-23
   Private Sub MainForm_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.VisibleChanged
        MessageBox.Show("hi")
   
        'WRONG
        If(sender As AKB.Tool.SafetyIsolationEditor.MainForm).Then
           
        End If


    End Sub


==============


How do I properly cast sender so that it is treated as the Form object?
0
Comment
Question by:knowlton
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
Comment Utility
To cast:

    Dim frm As Form = CType(sender, Form)

To check the Type:

    Dim frm As Form = CType(sender, Form)
    If TypeOf frm Is  AKB.Tool.SafetyIsolationEditor.MainForm Then
           
    End If
0
 
LVL 5

Author Comment

by:knowlton
Comment Utility
Thank you.

Coming over from C# to VB .NET for a few months (contract work).
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now