Mirage Source

Free ORPG making software.
It is currently Thu May 02, 2024 4:36 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Pro Tips
PostPosted: Sat Apr 11, 2009 12:08 am 
Offline
Persistant Poster
User avatar

Joined: Tue May 30, 2006 2:07 am
Posts: 836
Location: Nashville, Tennessee, USA
Google Talk: rs.ruggles@gmail.com
This is a thread intended to hopefully help people learn their ways around the VB6 IDE. I'll get the ball rolling with a shortcut I've known about in windows for years, but it was only 4 or 5 months ago that I realized you could do it within the VB6 IDE as well.

Tip #1
If you have several labels, say 10 or so, and they all have an opaque backstyle that you'd like to change to transparent. Click one label, and then control click the other nine. This selects them all at once. Then you can go to the properties box, and change the backstyle to transparent. The changes will apply to all ten labels.

_________________
I'm on Facebook! Google Plus My Youtube Channel My Steam Profile

Image


Top
 Profile  
 
 Post subject: Re: Pro Tips
PostPosted: Sat Apr 11, 2009 1:00 am 
Offline
Pro
User avatar

Joined: Tue Nov 13, 2007 2:42 pm
Posts: 509
F5: Compiles and runs the code.
CTRL+F5: Debug + Compile and runs the code. -> I always use this to catch a lot of small bugs. Usually mistyping.

I'm surprised how many people don't know about the debug compile.


Top
 Profile  
 
 Post subject: Re: Pro Tips
PostPosted: Sat Apr 11, 2009 1:18 am 
Offline
Persistant Poster
User avatar

Joined: Thu Mar 29, 2007 10:30 pm
Posts: 1510
Location: Virginia, USA
Google Talk: hpmccloud@gmail.com
I always run with full compile in the IDE...I don't think I've ever ran without it through the IDE.

_________________
Nean wrote:
Yes harold. Give it to me.

Image
Image


Top
 Profile  
 
 Post subject: Re: Pro Tips
PostPosted: Sat Apr 11, 2009 7:52 am 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Pressing Ctrl & H will allow you to replace certain text with new text. Very useful when re-naming variables or correcting spelling mistakes. eg. Changing all 'armor' to 'armour'.

Pressing F2 will bring up the Object Browser. In here, you can find out all the different data types, VB6 constants and things like that, and if you click on them you get a brief description and a simple syntax example. You can also find a specific description by right-clicking it in the code, and selecting 'Definition'.

F8 and Shift+F8 allow you to step into, and step over whilst debugging your code. Very useful when you need to go through some code step-by-step whilst it's running.

Click on the left margin next to your code, you can add a little red dot. If you run the program now, whenever this line of code is executed, the program will pause and highlight the line. Another good debug tool.

Have 'Option Explicit' at the top of every module/form/class you create. Most decent programming languages force you to explicitely declare variables before you use them. VB6 allows you to just ignore this. Some people see it as an advantage of VB6... but it's not! Not only does this make memory management a nightmare, as everything will be created as a variant (Which has it's uses, don't get me wrong), it creates a new variable every time it sees a new variable name in the code. If you misspell something, it'll just create another variable. This makes debugging incredibly hard.

ByRef and ByVal both have their uses. ByVal copies the memory across, making an entirely new value within the subroutine/function for you to use. ByRef simply acts as a referencer, and lets you edit the variable directly. Example. Imagine I'm calling the subroutine with my 'globalString' value for the sString.
Code:
Sub AddRobinToString(byval sString as string)
sString = sString & "Robin"

globalString = sString
end sub


Code:
Sub AddRobinToString(byref sString as string)
sString = sString & "Robin"
end sub


As you can see, the first subroutine is very limited. I can only hardcode it to have one string which adds 'Robin' to it. The second subroutine will handle any string sent to it, because all it did was reference the original variable.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: Pro Tips
PostPosted: Sat Apr 11, 2009 1:58 pm 
Offline
Pro
User avatar

Joined: Sun Aug 05, 2007 2:26 pm
Posts: 547
Highlighting a block of code and hitting shift+tab unindents it.

_________________
GIAKEN wrote:
I think what I see is this happening:

Labmonkey gets mod, everybody loves him, people find out his code sucks, he gets demoted, then banned, then he makes an engine called Chaos Engine.


Top
 Profile  
 
 Post subject: Re: Pro Tips
PostPosted: Sat Apr 11, 2009 5:36 pm 
Offline
Knowledgeable
User avatar

Joined: Sat Jun 09, 2007 3:16 am
Posts: 276
Labmonkey wrote:
Highlighting a block of code and hitting shift+tab unindents it.

I love you.

_________________
Image
Island of Lost Souls wrote:
Dr. Moreau: Mr. Parker, do you know what it means to feel like God?


Top
 Profile  
 
 Post subject: Re: Pro Tips
PostPosted: Sat Apr 11, 2009 5:39 pm 
Egon wrote:
Labmonkey wrote:
Highlighting a block of code and hitting shift+tab unindents it.

I love you.


That works outside of VB too. :P

I always thought it was common sense. Shift + tab will also tab backwards through text boxes and what not.


Top
  
 
 Post subject: Re: Pro Tips
PostPosted: Sat Apr 11, 2009 5:50 pm 
Offline
Pro
User avatar

Joined: Sun Aug 05, 2007 2:26 pm
Posts: 547
Egon wrote:
Labmonkey wrote:
Highlighting a block of code and hitting shift+tab unindents it.

I love you.


Oh no! The prophecy is coming true!

GIAKEN wrote:
I think what I see is this happening:

Labmonkey gets mod, everybody loves him, people find out his code sucks, he gets demoted, then banned, then he makes an engine called Chaos Engine.

_________________
GIAKEN wrote:
I think what I see is this happening:

Labmonkey gets mod, everybody loves him, people find out his code sucks, he gets demoted, then banned, then he makes an engine called Chaos Engine.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group