Solved

Error using Startup event in vb.net application

Posted on 2011-09-23
4
926 Views
Last Modified: 2012-05-12
I have a simple application with one form that performs some simple tasks, but If I add the attached code my app doesn´t run in other machines without visual studio.
Namespace My

    ' The following events are available for MyApplication:
    ' 
    ' Startup: Raised when the application starts, before the startup form is created.
    ' Shutdown: Raised after all application forms are closed.  This event is not raised if the application terminates abnormally.
    ' UnhandledException: Raised if the application encounters an unhandled exception.
    ' StartupNextInstance: Raised when launching a single-instance application and the application is already active. 
    ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
    Partial Friend Class MyApplication

        Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
            If e.CommandLine(0).ToLower = "/silent" Then

                ' ... run your code from here ...

                e.Cancel = True ' Suppress the default Form and Exit the Application
            End If

            ' Otherwise the App starts as Normal with the Form specified as the "Startup object" in Project --> Properties!

        End Sub

    End Class


End Namespace

Open in new window

0
Comment
Question by:dimensionav
  • 2
4 Comments
 
LVL 17

Expert Comment

by:nepaluz
ID: 36585715
Shouldn't this line
Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup

Open in new window

be
Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As StartupEventArgs)Handles Me.Startup

Open in new window

0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 36586747
Use the "View Application Events" button in Project --> Properties and then change the two dropdowns across the top of the code editor to place the method stub for you.

Not sure why you'd be getting an error.  Specifically, what does the error say and what line does it point to?
0
 

Accepted Solution

by:
dimensionav earned 0 total points
ID: 36893928
I have updated the operating system of the other computer then the application Worked (I believe are .net framework patches).

What components of XP OS allow the execution of this code?
0
 

Author Closing Comment

by:dimensionav
ID: 37163644
Updating helped on this but I don´t know what are the specific updates that this application needs
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

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 …
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

770 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