Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Code Samples & Tips
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Code Samples & Tips Share your recent discoveries and ideas with other users.

avoid using goto

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-11-2007, 12:56 PM
Junior Member
 
Join Date: Aug 2007
Location: The netherland, Geldrop
Posts: 23
Default avoid using goto

As a reaction on some code I see. As in the help-example the goto can give unpredictable results. The code will be verry difficult to debug. Tip: don't use labels other then an errorlabel. Let the sub do just one single task, so you can call the entire sub in recursive.

example
Sub btnDCRecSave_Click
' pre het keyfield is uniek
' post waardes worden weggescheven in de geheugentabel

If KeyFieldUnique(date) = true Then
RecordSave(...........)
Else
lvYesNo =Msgbox("date already exists. Delete existing record??")," ",cmsgboxYesNo,cMsgBoxQuestion)
If lvYesNo =cYes Then
smnuDCRecDelete_Click 'RecordDelete(aTable) <-- delete the record that has the same keyfield
gv_tbl_mutaties = true
gv_rec_Mutaties = false
btnDCRecSave_Click 'recursieve call <--- checks again the keyfield if it is unique
End If
End If

Last edited by paul j : 11-11-2007 at 01:03 PM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Avoid starting a program after a given time Arrie Questions (Windows Mobile) 2 05-31-2008 10:06 AM
Probleme bei device.exe wegen goto-Befehl urgott German Forum 13 01-24-2008 10:01 AM
Goto problem klaus Questions (Windows Mobile) 2 11-15-2007 02:28 PM
Error when loading table how to avoid tvrman Questions (Windows Mobile) 2 08-04-2007 09:32 PM
Quick question to avoid going down a long dead end route LineCutter Questions (Windows Mobile) 2 05-22-2007 08:29 AM


All times are GMT. The time now is 10:06 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0