Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Error using Startup event in vb.net application

Posted on 2011-09-23
4
Medium Priority
?
956 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 86

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

722 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