Wrox Programmer Forums
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 26th, 2003, 02:45 PM
Authorized User
Join Date: Jun 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default To Imar: Re: Sub Main

Hi Imar,

A few posts ago, you helped me out with a situation where I needed to access controls and subroutines from form1. You provided me the solution to call Sub Main as my start up object.

I have run into some problems where Sub Main is being called for no apparent reason (to me anyways). As an example, I have the following identical code tied to 4 separate button_click events. All buttons except for one work as expected. On the excption button, once I press OK after the messagebox appears, form1 instance (which is my main app window) is closed and the application attempts to run Sub Main on the module. The bottom line is that the application shuts down. I have seen this happen on another event in my application as well.

My questions are:

1) What is happening and how can I fix this?
2) Why does it happen on only the one button out of 4 that have are running identical routines?

Your help would be truly appreciated.

Here is the code:

If nudTradeManagerAdjust.Value = 0 Then
MessageBox.Show("Please enter an adjustment value into the spinner.", "Message")
Exit Sub
End If

Old July 26th, 2003, 02:54 PM
Authorized User
Join Date: Jun 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts

In addition,

I added another button to my form, copied the code from the expection button into the same event ofr the new button, and the problem does not exist. I guess this must have something to do with that specific control.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question for Imar aspcoder BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 22 April 28th, 2008 02:40 PM
Imar! help me shankhan Dreamweaver (all versions) 1 March 20th, 2005 05:45 PM
Imar - Please look at this larry Javascript How-To 4 July 8th, 2004 12:28 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.