473,400 Members | 2,163 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,400 software developers and data experts.

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 2681
GoTo Statement
See Also
Do...Loop Statements | For...Next Statements | If...Then...Else Statements |
Select...Case Statements | Try...Catch...Finally 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...Finally, or With...End With block to
a label inside.
Within a Try...Catch...Finally 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...Finally 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...Else, Select Case,
Try...Catch...Finally, While, and With...End With structures instead.
Example
This example uses the GoTo statement to branch to line labels within a
procedure.
Sub GotoStatementDemo()
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
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
9
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...
5
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
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...
4
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...
63
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...
3
by: socondc22 | last post by:
just wondering how to rerun my program after printing out the answer...
3
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. ...
7
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...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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.