473,808 Members | 2,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Anyone know of an A97 utility to help solve If - EndIf mixups?

MLH
Would love to be able to click on any If-statement
and launch a utility that would find what A97 believes
to be its corresponding EndIf. Such a tool would save
me lots of time as I am forever botching them up and
having to go back 'n fix 'em.
Mar 24 '06 #1
7 1616
Perhaps someone else can suggest a tool, but hope this experience helps.

When I first started coding, I used to print out the code and draw lines to
match the block operations such as If...EndIf, or For...Next. Haven't done
that for years now. FWIW, here's my current approach.

1. Indent
You probably do this. Indenting every block operation is the simplest way to
help keep them matched.

2. Modularize
Break the code down into smaller procedures. Ideally, a procedure should be
no more than a couple of screenfuls. Helps avoid huge numbers of embedded
indents.

3. Outside in
Type the End If immediately after the If. Your code is therefore coming up
from the bottom as well as down from the top. If you are not doing this, it
will probably solve the issue for you.

For example, you type:
If x < 0 Then {Enter} End If {Up} {End} {Enter} {Tab}
and you are then ready to code the inner part of the If block.

4. Rotate your monitor
Why code on a landscape monitor, when it would be so much easier to stay on
top of the blocks with portrait orientation?

A couple of years ago I did move to dual monitor: application on the left
(normal landscape) and code on the right. It was then obvious that the right
monitor needed to be portrait, so I flipped the old 19" CRT on its side and
told the nVidia driver to rotate the image.

This suggestion won't suit everyone, but the flippin' code monitor is the
best hardware change I have made in the last few years. And the combination
of these 4 approaches means I never get lost any longer with block
operations.

HTH.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"MLH" <CR**@NorthStat e.net> wrote in message
news:n7******** *************** *********@4ax.c om...
Would love to be able to click on any If-statement
and launch a utility that would find what A97 believes
to be its corresponding EndIf. Such a tool would save
me lots of time as I am forever botching them up and
having to go back 'n fix 'em.

Mar 24 '06 #2
MLH
Thanks, Allen. They were all very helpful comments.
I am doing #1. I couldn't live without indenting.
I got the red pen out and have been drawing lines for hours.
Plead guilty to not being as modular as I could be.
I like #3. A few more instances like today and perhaps I'll remember
always to do it.
Would love to hear everyone's comments on experience w/ dual monitors
and particularly what brands/models have been found best. I'm only
familiar with architect/engineering firms using them in CAD apps. That
has been a long time ago though.

BTW - when I got to the bottom of my problem, it was that I'd
overlooked inserting 2 End With lines. Because the error msg
was blaming my If - EndIf coding, I spent all my time chasing that
down like a dumb!f&xxxWXX!! !
Mar 24 '06 #3
MLH wrote:
Would love to be able to click on any If-statement
and launch a utility that would find what A97 believes
to be its corresponding EndIf. Such a tool would save
me lots of time as I am forever botching them up and
having to go back 'n fix 'em.


I used to work with a code editor in a program similar to SourceSafe
(where you checkout/in the code) and it had lines that drew the
loop/endif lines. I think it would be a PITA to contantly be using two
editors to do your coding. You might want to check
http://www.tucows.com and see if they have any code editors that does
what you want.

Allen's suggestions were excellent. Here's another suggestion...it may
be a hard habit to correct your current coding style but in your case
it'd be best to change it. Every time you enter an IF/Do While/Select
Case immediately enter EndIf/Loop/EndSelect on the next line. Then
insert a blank line, tab, then start coding. You shouldn't worry about
your current style then.

Mar 24 '06 #4
MLH <CR**@NorthStat e.net> wrote in
news:s4******** *************** *********@4ax.c om:
Thanks, Allen. They were all very helpful comments.
I am doing #1. I couldn't live without indenting.
I got the red pen out and have been drawing lines for hours.
Plead guilty to not being as modular as I could be.
I like #3. A few more instances like today and perhaps I'll remember
always to do it.
Would love to hear everyone's comments on experience w/ dual monitors
and particularly what brands/models have been found best. I'm only
familiar with architect/engineering firms using them in CAD apps. That
has been a long time ago though.

BTW - when I got to the bottom of my problem, it was that I'd
overlooked inserting 2 End With lines. Because the error msg
was blaming my If - EndIf coding, I spent all my time chasing that
down like a dumb!f&xxxWXX!! !


Also, I sometimes do this:

if some-complex-boolean-expression then
....big nasty tree
end if 'some-complex-...

I put enough in the comment after the END IF of the expression to be
evaluated so I can see what it's referring to.

Or, paste the code into an editor that lets you do code folding once it
knows it's working on VB/VBA code...

Mar 30 '06 #5
I use the WriteSimpleShor tCode Utility found at
http://www.abovetheshoulders.com.

Mar 30 '06 #6
Allen Browne wrote:
3. Outside in
Type the End If immediately after the If. Your code is therefore coming up
from the bottom as well as down from the top. If you are not doing this, it
will probably solve the issue for you.

For example, you type:
If x < 0 Then {Enter} End If {Up} {End} {Enter} {Tab}
and you are then ready to code the inner part of the If block.


I sometimes find it useful to take this a step further by sticking an
Else in there also. It forces me to make sure the Else part, if any,
gets accounted for.

James A. Fortune
CD********@Fort uneJames.com

Mar 30 '06 #7
MLH
I know, I know. It is a better way. No doubt.
Find myself kicking my own arse time 'n time again
for not following the advice.
I use the WriteSimpleShor tCode Utility found at
http://www.abovetheshoulders.com.


Apr 1 '06 #8

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

Similar topics

1
3193
by: Hafeez | last post by:
I am having real trouble compiling this code http://www.cs.wisc.edu/~vganti/birchcode/codeHier/AttrProj.tgz The attachment shows errors when compiled using the current version of g++ in a i386-pc-solaris2.9. Seeing reference to gcc-2.7.2 in the Makefile of the code, I downloaded it and compiled in my home directory. Then changed the referenes of LIBDIR and INCLUDES to this installation .and ran with g++ for 2.7.2 then there are still...
1
574
by: wukexin | last post by:
I write my own class Cfile, I want to know what about implement ctime().Who help me? My use function ctime, I sign it with $$$. my class Cfile: #------------------------ file.h #--------------------------- #include <io.h> #include <ctime> #include <string>
2
10553
by: Mike Metzger | last post by:
I've been running an Access2000 database for a couple years on a Win2k machine fine. We tried to copy the database over to another machine that already had Access2000 installed. When we tried to run it, we got an error on the following piece of VBA code embedded in a form: ------------------------ With Me .AgeMax = DateDiff("yyyy", Me.dteDateOfBirthMin, Date) .AgeMin = DateDiff("yyyy", Me.dteDateOfBirthMax, Date) End With...
5
2800
by: John Baker | last post by:
Hi: I have PSD995 installed, and find it a good program. I have been told that using Access you can set up the PDF file name and location using scripting with this application so that PDF files can be created automatically. Has anyone done this, and if so what are the commands that one uses for (a) the Location; (b) the file name, and (c) the triggering of action. Help with this would be appreciated either in the form of answers to...
7
1968
by: hierro | last post by:
I have a list of functions (all with suffix T). For each one, I need to implement the following: FunctionT() { if (some_condition) { // do some conversion first FunctionW(); // then do some processing
11
3364
by: Chris Croughton | last post by:
I have a requirement to partially preprocess C code. By 'partially' I mean that I need to define some macros (to the utility) and have it preprocess only those macros, leaving everything else intact. A compiler's preprocessor won't do this, since it will also process macros defined in the code (and in standard header files) and strip out everything. For instance, given source like: #include <stdio.h> #if defined(AAA) void...
1
1311
by: Dhanak | last post by:
I have around 1000 aspx files that contains standard lines intended for debugging purpose.Now before we put these to production we need to remove these lines from all files. Instead of doing it manually, we would like to develop a small utility that can do this. In a prototype of that utility, We r currently using StreamReader and Regex Classes of .Net to do this. Can somebody suggest any other solution/Logics which can improve...
8
2374
by: Zach | last post by:
I am looking for a good ADO.NET book to read. I know nothing about ADO as yet. If anyone has read the book - would it be ok for starters? What did you think of the book? If you didn't like the book, what would be your advice as to which book to read on the ADO .NET for a ADDO.NET- newB? Many thanks, Zach.
0
2691
jeffbroodwar
by: jeffbroodwar | last post by:
Hi, I'm tying to develop a program that uses a radio button wherein if this radio button is clicked, it'll do a loop at screen block to display the select option controls that i have. i used : SELECT-OPTIONS: s_SO FOR vbak-vkorg MODIF ID ONE, s_DC FOR vbak-vtweg MODIF ID ONE. now, when i execute this program. I'm encountering a problem with the output of the select-options. the two text boxes outputed...
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10628
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...
0
10373
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10113
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...
1
7651
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
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.