473,776 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pausing WHILE loop until button clicked

1 New Member
Hi there,

As part of my Software course, i have to create a game. Since I originally started out with python, I was used to it being really easy to create a main loop to control the game with a simple while statement, pausing where input is needed from the user.

Now that I have moved on to VB, I can seem to find a way to pause the while statements until the user does something (e.g. clicks a button). When i start my app, if just throws itself into an infinite loop. I was wondering if there was way stop the while from running temporarily, waiting until a user clicks a button, and then continues? I am familiar with pausing, but I haven't yet found a way that only pauses the one loop, but instead pauses the whole application.

Example:

Expand|Select|Wrap|Line Numbers
  1. While Play = 0
  2.         // Do Stuff
  3.         // Wait for user to click either up down left or right buttons
  4.         // do stuff based on what user clicked
  5. Wend
Thanks in Advance.
May 31 '07 #1
0 2174

Sign in to post your reply or Sign up for a free account.

Similar topics

6
3055
by: HP | last post by:
Hi, Does anyone know if it is possible to force the code to pause during every iteration of a FOR ... NEXT loop, and wait for the user to click a command button for the next iteration. I need to let the user step through the looping at his/her own pace. Any help would be greatly appreciated. h.
2
1318
by: Deborah V. Gardner | last post by:
I am using Access 97. I would like to be able to pause between forms. For example, I have 2 reminders I would like displayed separately, one at a time. Here is part of the code I am using. If Not rstReminders.EOF Then rstReminders.MoveFirst While Not rstReminders.EOF strReminder = rstReminders!Reminder strEventCaption = rstReminders!EventCaption
1
3678
by: kaiser | last post by:
Hello. I am trying to write a program that continues to read the last line of a txt file until a stop button is clicked. while (ContinueLoop == true ) { while ((LastLine = file.ReadLine()) != null) { LastLine = file.ReadLine(); }//while readline
2
1803
by: Dave Harris | last post by:
I am having a bit of trouble with form manipulation. I am working on a program where the user opens one form and when all the processes are done, he/she clicks on "Continue" which opens the next form in the program's sequence where more data processing takes place. Here is a snippet of code from the form I am currently working on. I need the application to pause after the "objReader.Close()" statement until the user clicks a button on the...
7
2695
by: Charles Law | last post by:
My first thought was to call WorkerThread.Suspend but the help cautions against this (for good reason) because the caller has no control over where the thread actually stops, and it might have a lock pending, for example. I want to be able to stop a thread temporarily, and then optionally resume it or stop it for good.
4
1350
by: RSH | last post by:
I am writing a VB .Net App (Not ASP .Net) where I'm having an issue creating a cancel button... I have a situation where I have a loop that is initiated when the user clicks on a Run button. I would like to have a Cancel button that when the user clicks it a message button a messagebox will be displayed asking if they would like to cancel or not...if they select yes I would like to break out of the loop but not quit the application.
12
3330
by: greg | last post by:
Hi, Can anyone help me with the following issue: How can I pause the execution of a program until a given file is created (by another process) in a specified directory? Any ideas would be highly appreciated. Thanks!
4
1176
by: Jason Molt | last post by:
Do until bStop = False 'there's some code here 'etc, etc Loop 'some more code here And then, I have a button that sets bStop = False when clicked: the program blows up, fatal exception. What the...? // fark0
3
2513
by: bmerlover | last post by:
I believe my problem lies inside the while loop. When I click the play button on the gui app, it goes inside the while loop, reads the file and calls the necessary function to do what it needs to do. I have it set in a way whenever I click the PLAY button, the PLAY button is suppose to hide and the PAUSE button is suppose to appear. This does not happen until the complete while iteration has finished. My goal is to Play and Pause at any time I...
0
9628
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10289
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10120
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10061
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9923
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6722
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5367
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3622
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2860
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.