473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Programs Ends when form button is clicked.

I am teaching myself visual basic .net 2003. I bought a book and worked the
examples, but I cannot figure out what I am doing wrong on my first
application.

I have a form that is called from a module:

frmSelectGroup.ShowDialog()

This works fine and the form opens. On the form, the user is asked to
select some options and then click "Continue". When the "Continue" button
is clicked, the program goes to the "End Sub" line of the Private Sub
Button1_Click and then ends. The program never returns back to the module
to finish the rest of the code in that section.

Am I missing something obvious?

Thanks...
Nov 22 '05 #1
2 910
"Greg" <gr**@nospam.com> wrote in message
news:Op**************@TK2MSFTNGP12.phx.gbl...
I am teaching myself visual basic .net 2003. I bought a book and worked the examples, but I cannot figure out what I am doing wrong on my first
application. This works fine and the form opens. On the form, the user is asked to
select some options and then click "Continue". When the "Continue" button
is clicked, the program goes to the "End Sub" line of the Private Sub
Button1_Click and then ends. The program never returns back to the module
to finish the rest of the code in that section.

Am I missing something obvious?


Are you closing the form? ShowDialog is "modal" which means that no more
code will run in the calling routine until the form is closed.

There are several ways to close the form, for example:

Me.Close()

or

Me.DialogResult = DialogResult.OK

Using DialogResult is nice, because you can read the result back in the
calling code - eg. did the user click OK or Cancel?

You can also give a button a DialogResult property, which has the same
effect.

Tim
Tech writing here:
http://www.itwriting.com
Nov 22 '05 #2
"Greg" <gr**@nospam.com> wrote in message
news:Op**************@TK2MSFTNGP12.phx.gbl...
I am teaching myself visual basic .net 2003. I bought a book and worked the examples, but I cannot figure out what I am doing wrong on my first
application. This works fine and the form opens. On the form, the user is asked to
select some options and then click "Continue". When the "Continue" button
is clicked, the program goes to the "End Sub" line of the Private Sub
Button1_Click and then ends. The program never returns back to the module
to finish the rest of the code in that section.

Am I missing something obvious?


Are you closing the form? ShowDialog is "modal" which means that no more
code will run in the calling routine until the form is closed.

There are several ways to close the form, for example:

Me.Close()

or

Me.DialogResult = DialogResult.OK

Using DialogResult is nice, because you can read the result back in the
calling code - eg. did the user click OK or Cancel?

You can also give a button a DialogResult property, which has the same
effect.

Tim
Tech writing here:
http://www.itwriting.com
Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Mark | last post by:
I have a working PHP/MySQL application used for data entry. The data entry screen includes a "Save" button. The PHP code for this button looks like this: if (isset($_POST)) { if ($_POST ==...
8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
3
by: Tom Asken | last post by:
Short version: IE 6.0 wrongly posts <button ..> value. Internet Explorer should only post the value of the clicked submit button - but IE 6 posts the value of several submit buttons if they have...
1
by: Greg | last post by:
I am teaching myself visual basic .net 2003. I bought a book and worked the examples, but I cannot figure out what I am doing wrong on my first application. I have a form that is called from a...
4
by: John | last post by:
Hi all, This really is quite an urgent matter. I have a page with multiple, dynamically-loaded user controls and when a user clicks on a button, the whole form is submitted. Now at this stage...
6
by: guoqi zheng | last post by:
In a regular html form, when user press "enter" key, the form will be submitted. However, in ASP.NET web form, a form will only be submitted (post back) when a special button is clicked. Many...
17
by: romixnews | last post by:
Hi, I'm facing the problem of analyzing a memory allocation dynamic and object creation dynamics of a very big C++ application with a goal of optimizing its performance and eventually also...
11
by: bill | last post by:
I dynamically create buttons and associate them with an event using AddHandler. I want all the button events to fire at one time, when the page is posted, instead of when each button is clicked....
5
by: Tony | last post by:
I am continuing to develop an Access 2007 application which was originally converted from Access 2003. In Access 2003 I was able to disable the Access Close button in the top righthand corner of...
1
by: ahilar12 | last post by:
Hi all, I am new to php,my question is that in this following code i am retrieving many rows from the database which is working good.i want to delete a particular row(s) which is checked(checkbox)...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.