-
I have started out reading books on vb,and i have got a good basic idea how vb works....but! in all my books..it doesnt explain this simple question i have..
When you create a function,can you "name" it whatever you want? So if i wanted to create a function named
Formatharddrive() all i would have to do is input the code and will it work?Or is there a predetermined set of functions that we all have to live by.(for vb)
Thank you in advance for any help.
-
You can name your functions/Subs/Properties whatever you want
Code:
Function Formatharddrive()
'Your code of the formatting harddrive goes here
End function
Sub DeleteWindows()
'Your code goes here
End sub
Property Get Whatisthisallabout()
'Your explanations here
End property
Feel free to ask more, this site is for you, those books probably don't worth the money you spent on them
-
Pretty much. You have two groups of subs or functions. You have those that execute as a result of an event firing, and those you create, that you call from another sub or function. Those that you create, you can name anything you want except for the names reserved for the event firing ones.
There is also a difference between functions and subs (sub routines). Functions return an object, subs don't.
-
yep. you can call functions and subs pretty much what you want. Obviously there are some illegal characters and it would be silly to try and name a function the same as one that already exists. but
Code:
Private Function Format_Hard_Drive() as Boolean
End Function
'or
Private Sub I_Hate_Windows()
End Sub
Would be fine.
-
I forgot to tell if you you will experience problems if you name your methods with the same name as other vb's methods. That's a big problem for newbies
-
I hope that VB7 will have an option for VB Code Editor to reconize your functions and highlight it in blue. C++ has the ability to do this, I'm sure they can put it in VB.
-
that would be nice, but another color, blue is already used
-
meg how do you get C++ to do that.
-
There is a file that when you add to it, it will highlight whatever word is in it. I forgot the name of the file though :(.