473,473 Members | 1,833 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

need to jump to the start of my forms code...

I need to be able to jump to the start of my code if a particular radio button is not pressed. How do I this??? The goto line1 does not work?

Any ideas?

Scott

If Not RadBut4.Checked Or RadBut5.Checked Then

MsgBox("Please choose Annual or Single Trip")

'GoTo Line1 goto start needed...

Nov 21 '05 #1
15 1211
"Scott" <ho*******@virgin.net> schrieb:
I need to be able to jump to the start of my code if a particular radio
button is not pressed. >How do I this??? The goto line1 does not work?
\\\
Line1:
///
If Not RadBut4.Checked Or RadBut5.Checked Then

MsgBox("Please choose Annual or Single Trip")

'GoTo Line1 goto start needed...


You will have to create a label in order to jump to a certain position.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
OK I will do that, how will I code it?
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
"Scott" <ho*******@virgin.net> schrieb:
I need to be able to jump to the start of my code if a particular radio
button is not pressed. >How do I this??? The goto line1 does not work?


\\\
Line1:
///
If Not RadBut4.Checked Or RadBut5.Checked Then

MsgBox("Please choose Annual or Single Trip")

'GoTo Line1 goto start needed...


You will have to create a label in order to jump to a certain position.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
"Scott" <ho*******@virgin.net> schrieb:
OK I will do that, how will I code it?


As I said, prefix the first line with 'Line1:' and call 'GoTo Line1' to jump
to the "label" 'Line1'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #4
Scott,

First you have give the user change to check it, this will only get a loop
and a crazy user. Probably you have seen those AVI's from a user jumping on
his srcreen and other like that.

So you set this in a windows.forms.timer (you can drag that from the
toolbox).
Start from the toolbox the event from that and set it to enabled when needed
and than an timer where you set the interval to 10 or something so it fires
direct.

http://msdn.microsoft.com/library/de...ClassTopic.asp

Than in that event something as

mytimer.enabled = false
If Not RadBut4.Checked Or RadBut5.Checked Then
MsgBox("Please choose Annual or Single Trip")
mytimer.interval = 4000
'dont set it to low a user has to be able to do something, he has to click
this button and to set the button
mytimer.enabled = true 'when you dont do it like this it goes on
firing.
end if

I hope this helps?

Cor


..
Nov 21 '05 #5
How about this:

If Not RadBut4.Checked or RadBut5.Checked Then
MsgBox("Please choose Annual or Single Trip")
Exit Sub
Else
' whatever you are doing if they do the above
End If
(or you can just leave out the Else statement and just use, End If and afte that point the rest of your code in the sub.)

That will put your user back to the beginning. Not like GoTo Line 1 in Quick Basic etc. but, it will EXIT the Sub you are in
(after your user Clicks OK in the MessageBox) and then they can start over at the point they entered the wrong
data........(unless you have had them entering a lot of stuff prior to this.....depends on the rest of your code)
james

"Scott" <ho*******@virgin.net> wrote in message news:gp***************@newsfe5-gui.ntli.net...
I need to be able to jump to the start of my code if a particular radio button is not pressed. How do I this??? The goto line1
does not work?

Any ideas?

Scott

If Not RadBut4.Checked Or RadBut5.Checked Then

MsgBox("Please choose Annual or Single Trip")

'GoTo Line1 goto start needed...
Nov 21 '05 #6
Hi Scott

Despite all the previous answers, please consider the following construct:

Do
Test for Success

If AllIsWell Then
Exit Do
Endif
Loop

This would the structured answer to your question.

HTH

Charles
"Scott" <ho*******@virgin.net> wrote in message
news:gp***************@newsfe5-gui.ntli.net...
I need to be able to jump to the start of my code if a particular radio
button is not pressed. How do I this??? The goto line1 does not work?
Any ideas?
Scott
If Not RadBut4.Checked Or RadBut5.Checked Then
MsgBox("Please choose Annual or Single Trip")
'GoTo Line1 goto start needed...
Nov 21 '05 #7
Charles,

You this was of course my first thought and answer and than I looked at the
code.

I tried to find that video from that guy who was first hitting and than
broke his screen.

This will in my opinion give and endless popup screen.

:-)

Cor
Nov 21 '05 #8
You this

You would know this
Nov 21 '05 #9
Hi Cor

I'm not sure that I follow you. The intention is that if AllIsWell then the
code will exit the loop, and no more pop-up screen. If the test involves
looking at a radio button, then isn't this effectively what the OP asked
for?

Charles
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Charles,

You this was of course my first thought and answer and than I looked at
the code.

I tried to find that video from that guy who was first hitting and than
broke his screen.

This will in my opinion give and endless popup screen.

:-)

Cor

Nov 21 '05 #10
Charles,

Or do we misunderstand each other.

What is the effect from this code

Do
If Not RadBut4.Checked Or RadBut5.Checked Then
MsgBox("Please choose Annual or Single Trip")
Exit Do
Endif
Loop

Cor
Nov 21 '05 #11
But that is not what I wrote. I was illustrating a construct. What you have
written is the equivalent of

Do
If Not AllIsWell Then
Exit Do
Endif
Loop

?

Charles
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Charles,

Or do we misunderstand each other.

What is the effect from this code

Do
If Not RadBut4.Checked Or RadBut5.Checked Then
MsgBox("Please choose Annual or Single Trip")
Exit Do
Endif
Loop

Cor

Nov 21 '05 #12
Charles,

This is what you wrote
Do
Test for Success
If AllIsWell Then
Exit Do
Endif
Loop

What triggers that test, that is a user screen action, however he has no
time to change that because that loop will surely be quicker than his typing
action. It stays in that loop, therefore I made that sample with the timer
in it. (And than that loop is not needed anymore)

However I can be wrong of course, just how I see this.

Cor


Nov 21 '05 #13
Cor

Clearly the construct I am illustrating, in this particular case, requires
something to prompt the user when all is not well, but that does not change
the logic.

Would you prefer

Do
Test for Success

If AllIsWell Then
Exit Do
Endif

MessageBox.Show("All is not well!")
Loop

Charles
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Charles,

This is what you wrote
Do
Test for Success
If AllIsWell Then
Exit Do
Endif
Loop

What triggers that test, that is a user screen action, however he has no
time to change that because that loop will surely be quicker than his
typing action. It stays in that loop, therefore I made that sample with
the timer in it. (And than that loop is not needed anymore)

However I can be wrong of course, just how I see this.

Cor

Nov 21 '05 #14
Charles,

I started to tell you that this code you show is the one I was direct typing
when I saw those goto's we probalby both don't like.

However I saw that it was failing in this case (as well with the goto's),
when the user had not the possibility to change the evaluated variables
while there is no external process that does.

That was all

(How can I make this clear, will I sent you a sample program?)

:-)

Cor
Nov 21 '05 #15
Cor
(How can I make this clear, will I sent you a sample program?)
I don't think that will be necessary ;-)

I know what you are getting at, but I am still only trying to illustrate the
logical construct. The operations that the user includes within that
construct are a detail of their specific problem. The logic remains good.

In the OP's scenario, TestForSuccess translates to 'Get user input and
validate'.

I think that we do actually understand each other :-)

Charles
"Cor Ligthert" <no************@planet.nl> wrote in message
news:e3**************@TK2MSFTNGP15.phx.gbl... Charles,

I started to tell you that this code you show is the one I was direct
typing when I saw those goto's we probalby both don't like.

However I saw that it was failing in this case (as well with the goto's),
when the user had not the possibility to change the evaluated variables
while there is no external process that does.

That was all

(How can I make this clear, will I sent you a sample program?)

:-)

Cor

Nov 21 '05 #16

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

Similar topics

19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
5
by: taylorjonl | last post by:
I am completely baffled. I am writting a daemon application for my work to save me some time. The application works fine at my home but won't work right here at work. Basically I have a...
2
by: P2P | last post by:
Hi I am wondering if someone know of a free cross-browsers vertical scrolling script that - is cross cross-browsers - will call the scrolling content from an external html page or from a...
2
by: Leo | last post by:
I set HasMorePages to true, but it doesn't let me jump to next page. (Of course, if I remove the HasMorePages = false in my if statement, it will create hundreds of pages). Any suggestion? Thanks...
6
by: Todd A. Anderson | last post by:
I have a function foo of which I need to get the address. The problem is that when you say "&foo" (or just foo for that matter), you get the address of this function's entry in a jump table and...
1
by: jianxin9 | last post by:
Hi, I have an ajax powered tabs box that has a javascript drop-down search menu in the first tab. When I click on another tab, and go back to the first tab I have to refresh the page to get the...
9
by: pic078 via AccessMonster.com | last post by:
I need serious help - I have a frontend/backend Access database (2 MDE Files) that remains stuck in task manager after exiting the application - you can't reopen database after exiting as a result...
11
by: Peted | last post by:
Im using c# 2005 express edition Ive pretty much finished an winforms application and i need to significantly improve the visual appeal of the interface. Im totaly stuck on this and cant seem...
5
by: iapx86 | last post by:
My parser project calls for a computed goto (see code below). The C preprocessor delivers the desired result, but is ugly. Template metaprogramming delivers results I do not understand. Can...
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
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,...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.