3 Replies - 9436 Views - Last Post: 20 May 2008 - 09:24 AM Rate Topic: -----

#1 Hanzie  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 128
  • Joined: 19-August 07

go to line of code in application

Post icon  Posted 19 May 2008 - 01:29 PM

Hello, i have some code that runs ok.
But now i have programmed a dialogbox to pop-up on the screen.

The dialogbox has 2 options -> ok and cancel.

When the user clicks cancel i wan't the application to stop and go back in code.

Is there a way to point the application to a line of code so it starts running from there again??

I can make an if-then procedure for the cancel-button:

if Windows.Forms.DialogResult.Cancel Then ????????



Any help please?!

Is This A Good Question/Topic? 0
  • +

Replies To: go to line of code in application

#2 bflosabre91  Icon User is offline

  • go sabres

Reputation: 105
  • View blog
  • Posts: 1,439
  • Joined: 22-February 08

Re: go to line of code in application

Posted 19 May 2008 - 02:04 PM

theres no way to just tell it to run all the code from line 26, if that is what u are asking. you would have to put the code u want to run in a Sub routine with all the code you want to execute if they hit cancel or OK. then in the If statement u started in ur post, just point to the correct Sub depending on what was clicked
Was This Post Helpful? 1
  • +
  • -

#3 thor78  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 1
  • View blog
  • Posts: 121
  • Joined: 06-May 08

Re: go to line of code in application

Posted 19 May 2008 - 05:15 PM

Use sub routines. Using GOTO (if you plan to use it anyway :D) is a very outdated and bad practice.

If Windows.Forms.DialogResult.Cancel Then
Call YourSubRoutineHere()
End If


This post has been edited by thor78: 19 May 2008 - 05:23 PM

Was This Post Helpful? 0
  • +
  • -

#4 Hanzie  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 128
  • Joined: 19-August 07

Re: go to line of code in application

Posted 20 May 2008 - 09:24 AM

thnx for the replies.

I now understand i can call a subroutine. But what i want is when the user clicks cancel the application breaks and goes back to the beginning of the form.

My code is now build in the exact right order, order of which routine in a form has to start first and what is the next routine.

How to break the application and then start the form again?!!

Please help, I believe there must be a very basic solution to this situation.

FORGET IT: I KNOW IT NOW, I HAVE TO SPLIT MY CODE INTO MORE SUBROUTINES SO I CAN CALL MY DESIRED DIFFERENT SUBROUTINE.

This post has been edited by Hanzie: 20 May 2008 - 09:52 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1