Solved

Casting

Posted on 2006-10-27
2
347 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
ID: 17820740
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
ID: 17821010
Thank you.

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

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

785 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