Solved

Casting

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

861 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