473,786 Members | 2,571 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

rerun code

Hi,

how can I get my forms program to perform a particular action again if
the incorrect format is entered,

I have tried

GOTO line xxx
but this did not work, Is there something like GOTO beginning?

thanks

Portroe

Nov 20 '05 #1
5 2699
GoTo Statement
See Also
Do...Loop Statements | For...Next Statements | If...Then...Els e Statements |
Select...Case Statements | Try...Catch...F inally Statements
Branches unconditionally to a specified line within a procedure.
GoTo line
Part
line
Required. Any line label.
Remarks
GoTo can branch only to lines within the procedure where it appears.
You cannot use a GoTo to branch from outside a For...Next, For Each...Next,
SyncLock...End SyncLock, Try...Catch...F inally, or With...End With block to
a label inside.
Within a Try...Catch...F inally construction, you cannot use GoTo to branch
out of a Try block, into a Catch block, or into or out of a Finally block.
You can branch from a Catch block into the Try block associated with that
Catch. For example, if one Try...Catch...F inally construction is nested
within another, a Catch block can branch into the Try block at its own
nesting level, but not into any other Try block.
Note GoTo statements can make code difficult to read and maintain.
Whenever possible, use Do...Loop, For...Next, If...Then...Els e, Select Case,
Try...Catch...F inally, While, and With...End With structures instead.
Example
This example uses the GoTo statement to branch to line labels within a
procedure.
Sub GotoStatementDe mo()
Dim Number As Integer
dim MyString As String
Number = 1 ' Initialize variable.
' Evaluate Number and branch to appropriate label.
If Number = 1 Then GoTo Line1 Else GoTo Line2

Line1:
MyString = "Number equals 1"
GoTo LastLine ' Go to LastLine.
Line2:
' The following statement never gets executed because Number = 1.
MyString = "Number equals 2"
LastLine:
' Print "Number equals 1" in the Output window.
Debug.WriteLine (MyString)
End Sub
Nov 20 '05 #2
"portroe" <bo*@sleigh.com > schrieb

how can I get my forms program to perform a particular action again
if the incorrect format is entered,

I have tried

GOTO line xxx
but this did not work,
Why?
Is there something like GOTO beginning?


Yes, there is still GOTO but you should consider reading the following
topic:
http://msdn.microsoft.com/library/en...Structures.asp
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
* portroe <bo*@sleigh.com > scripsit:
how can I get my forms program to perform a particular action again if
the incorrect format is entered,

I have tried

GOTO line xxx


Call the procedure again and exit it:

\\\
Public Sub FooBar()
If ... Then
FooBar()
Exit Sub
End If
End Sub
///

Alternatively, you may want to use a loop, but this depends on the case.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
Cor
Hi Herfried,

This is the same as the ones I love with a new instance of the class itself.
I hope he has enough memory you write always when I do this with a class.
:-))
Cor
\\\
Public Sub FooBar()
If ... Then
FooBar()
Exit Sub
End If
End Sub
///

Nov 20 '05 #5
* "Cor" <no*@non.com> scripsit:
This is the same as the ones I love with a new instance of the class itself.
I hope he has enough memory you write always when I do this with a class.
:-))


ACK... That's the problem of recursive function calls. But sometimes
it's useful...

;->

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6

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

Similar topics

51
5292
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
9
3868
by: bigoxygen | last post by:
Hi. I'm using a 3 tier FrontController Design for my web application right now. The problem is that I'm finding to have to duplicate a lot of code for similar functions; for example, listing users, and listing assignments use similar type commands. Is there a "better" way I can organize my code?
5
1634
by: Stuart Dee | last post by:
Hi, I have created a com+ component with vb dot net using jit activation and transactions If i call it like this x=createobject("mycomp") x.dispose
1
1635
by: Feng | last post by:
Hi, I am currently experiencing a wired issue. Every time I start my my dev server machine to run my ASP.Net app, the IIS server is not functioning - I get page can not be displayed error and I have to rerun the aspnet_regiis -i to make it work. I also found that, when this happens, all the .html pages are served fine, but all the .aspx pages, AND all .asp pages, are not served. What is going on here?
4
21353
by: Bill Nicholson - Cincinnati, OH | last post by:
This Access app is in Access 2000 format. It is a mature app that is running on machines all over the LAN. Today when I tried to put it on a new PC with a fresh copy of Win XP and Access 2003. XP has all patches installed and is SP 2. I got this error: Can't be started. Was unable to initialize the Windows Registry. Rerun Microsoft Access or Microsoft Office Setup to reinstall I ran the app as domain admin and local admin, no change.
63
5404
by: socondc22 | last post by:
So i have a question on how i should start doing this... pretty new at c++ i have to ask the user for an integer, an operator, and then another integer to give an answer. But i also have to show the whole equation. I want to try to use loops to do this.
3
5048
by: socondc22 | last post by:
just wondering how to rerun my program after printing out the answer...
3
1838
by: Saxx | last post by:
i have created a program that counts change for school but i am also wanting to add the ability fot the program to rerun on request and display an error message for negatitve numers, 0 or letters. can anyone help? thanks #include <iostream> using std::cout; using std::cin; using std::endl;
7
4456
by: luciquar | last post by:
I am a PhD student in demography and I am working with a Microsoft Access database in which I have to use several update queries. Amongst these there are some in which I have to update the value of a field in a row to the value of the same field from the previous row (according to some parameters). For example: UPDATE INNER JOIN AS ON .ID = .ID SET .Variable = . WHERE (((.Variable) Is Null) AND ((.Order)=.+1) AND ((.Variable) Is Not...
0
9497
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
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...
1
10110
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
9962
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
8992
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7515
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6748
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
5398
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...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.