Solved

Casting

Posted on 2006-10-27
2
341 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to open a link from vb.net app 3 23
Events in static methods 3 50
Help with Query not working in client's PC 1 35
Help with LINQ and XML 10 27
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 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