Easy One _Unfortunately Not For Me

Hi,
I Adopted a project and the code of someone who cannot help me, that appears to keep track of the contents of a textbox.
-----------------------
If (txtMentors.Text = "") Then
 MsgBox "The Mentors field is left blank"
 FieldTrack% = 1
End If
-----------------------

I cannot figure out this use of a % in a variable name. I tried declaring:
--------------------------
Dim FieldTrack% as Integer
--------------------------

, that is not working. What is the % all about. Thanks.

diek
 
diek_nfAsked:
Who is Participating?
 
prozakConnect With a Mentor Commented:
% is a way to tell VB that the variable is of type integer (you can do the same thing with a $ to be a string). This is a hold over from BASIC. You can remove the % sign and not worry about it.

Dim FieldTrack As Integer

FieldTrack = 1

That should work fine.
0
 
paulstampCommented:
The % is simply a declaration character stating the FieldTrack is an integer variable.

Personally I avoid using such symbols :

Dim FieldTrack as Integer

and remove the % from
FieldTrack% = 1
0
 
paulstampCommented:
Sorry prozak... your answer appeared as I was typing.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
mcriderCommented:
the % says that the variable is an integer... You use the % if you're not going to declare the variable using the "Dim" statement.

If you are going to use the "Dim" statement, don't use the %

For example:

   Dim FieldTrack as Integer

Then anywhere in the sub where you reference "FieldTrack%", change it to "FieldTrack"


Cheers!®©
0
 
prozakCommented:
That's OK paul, I see I was only 1 minute ahead of you :)
0
 
paulstampCommented:
paulstamp changed the proposed answer to a comment
0
 
diek_nfAuthor Commented:
prozak,
I feel like a bit of a dummy but what the hell. That works perfectly.
diek
0
 
diek_nfAuthor Commented:
Sorry,
I was a bit quick. Thank you to everyone who replied, and darn speedy to boot. Have a good day of programming.
diek
0
 
prozakCommented:
Nobody is a dummy here...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.