Click to See Complete Forum and Search --> : General VB question
casparas
Jan 8th, 2000, 06:15 AM
i have noticed that some people use somekind "option explict" in the start of their code
Questions:
1 What is that(option explict)?
2 What's the meaning of life
3 Is there any good API tutorial around here?
------------------
-casparas
novice programer
casparas@metacrawler.com
1.)option explicit(which should ALWAYS be used) forces you to declare every variable you use in your program. Use a variable that's not dimensioned and you will get an error.
2.)Visual Basic without runtime files.
3.)Try the API section of VB-World or VBSQuare
Well, I may be able to help you with the first question. Option Explicit put at the top of your code in the general section forces you to Dim your variables. Your program will run fine without it, but may use up more memory since VB will Dimension it for you. To do this, it will use the largest variable type to accomodate any type that you may use your variable for. I find it a good practice to Dim all of the variables yourself. The choice is yours....
Clunietp
Jan 8th, 2000, 02:56 PM
Another point to Option Explicit:
If you don't use option explicit in your code and you mistype a variable name, VB automatically creates a variant variable on-the-fly (of course, without warning) and you will have a heck of a time debugging your code because the value of the variable that you thought you were using was not matching up with the result you wanted.
You can turn this option on by default by going to TOOLS --> OPTIONS and putting a check next to Require variable declaration. Every time you create a new form/module/class etc the Option Explicit will appear at the top.
Tom
ChrisJackson
Jan 8th, 2000, 09:04 PM
3) API Tutorial: http://skyscraper.fortunecity.com/transmission/45/api/index.html
HTH.
Chris
casparas
Jan 8th, 2000, 09:33 PM
Thanx everyone
------------------
-casparas
novice programer
casparas@metacrawler.com
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.