Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[TuT]Noob Guide to visual basic

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Gunbound1337
Grandmaster Cheater
Reputation: 0

Joined: 03 Jun 2007
Posts: 807

PostPosted: Fri Jun 29, 2007 8:13 am    Post subject: [TuT]Noob Guide to visual basic Reply with quote

Programming

Ultimate Noob’s Guide to Visual Basic

Introduction

BASIC is undoubtedly the easiest programming language to learn and therefore should be simple if you have never programmed before. Throughout this tutorial we will be using Microsoft’s compiler, Visual Basic. You can either get Microsoft Visual Basic, or you can get Microsoft Visual Studio; which includes Visual C++, Visual Basic, and many other useful tools. I use 6.0 but 7.1 and other versions will probably compile this simple code fine. As you get to more complicated code, not all 6.0 will compile in 7.1, and vice versa; the same goes for all the other VB versions.



This tutorial will not teach you how to write a hack in BASIC, but rather teach you the fundamentals of BASIC. After you have completed this tutorial you can read my other tutorial: “Building a Trainer - For VB Programmers”.



Exploring the Development Environment

When you first open Visual Basic the New Project window should appear. Select Standard EXE for now.



In the middle there is the Form window.

On the left there is the Controls toolbar.

Top right is the Project window.

Bottom right is the Properties window.



What are all these things?

Form – This is what your program will look like. You can add buttons, and other things to a Form.

Controls – A control is anything you add to a Form. Controls include buttons, menus, pictures, text boxes, and many other things.

Project – A project is a collection of all the files you will use in the development of a particular application. You will usually create a new project for each application you build.

Properties – Each Form and Control has its own properties. When you click an object on the Form window the properties for that object will appear in the properties window in the bottom right.



The Development Environment is customizable. You can move most of the stuff around however you want.



Building Your First Program

The first program we are going to make is a simple application that finds the volume of any sphere.



Step 1: Edit the Form

For this particular project we will need two textboxes. Use the Controls toolbar to make two textboxes on the Form. You can do this by clicking the textbox icon on the toolbar and then click and drag on the Form to the size you need. You can also double click the icon on the toolbar.



Step 2: Setting Properties

First we will set the name of the Form. Click the Form, and then go to properties. Find the Caption value, and set that to the name of your program. I suggest you use “Volume Finder” or something similar.



Then select the first textbox. Find the Name (not caption!) and call it txtRadius. Select the other textbox and name it txtVolume.



Step 3: Writing Code

When you double click a Control on a Form or the Form itself, a new window pops up where you can write code that executes when a particular procedure occurs.



Double click the textbox that you named txtVolume. You should see something like this:



Private Sub txtVolume_Click()



End Sub



The first line can be translated into English like this:

“When the text box Volume is clicked, this is what will happen”



The second line can be translated as follows:

“This is the end of the event”



In between the two lines, insert the following code:



R = Val(txtRadius.Text)

V = (R^3) * 3.14 * (4/3)

txtVolume.Text = Str$(V)



First line: The variable R will be defined as the value in the textbox named txtRadius.

Second line: The variable V will be defined as R cubed times pi times 4/3 (formula for calculating volume of sphere)

Third line: The textbox named txtVolume will display the value of the variable V as a String*.



*String just means it’s a value that has range from 1 to 65,400 characters. There are numerous places where you can look up all the different types of data. I suggest you use a search engine and look for “data types” if you are interested in learning about them.



Another Note: In the previous code we used R and V for our variables. There are restrictions to what you can put in variable names. You cannot use periods, spaces, it must not begin with a numeral, and must be less than 255 characters.



Step 4: Spicing Up Your Form

You can use the controls toolbar to add pictures and text to your Form. You can also play around with the properties for different things to create effects and change fonts and colors. Play around with the different settings and have fun.



Step 5: Running and Debugging

At the top of the Development Environment find the menu “Run”.

From this menu, select “Start”. Your application should run and you can test it out to see if everything is working okay. After you have tested it, from the Run menu select “Start With Full Compile”. This will check your code for any errors. If it finds errors, it will show them to you in yellow so you can fix them. If there are no errors you can build your project by going to the “File” menu and selecting “Make…”



Advanced Code

Remember when you double clicked a control and that screen came up where you can write code for different procedures? That’s not the only place where you can write code. There are more places that you will have to use later on to write advanced code. One of these places is called a Module. You can create a Module by going to Project and then selecting Add Module. If you go there, you will also notice something that says Add Class. A class is just an advanced Module. Learning how to write advanced code is far beyond the scope of this tutorial and is partially covered in my next one: “Building a Trainer - For VB Programmers”.



Conclusion

Congratulations, you just made your first program. For some extra practice go and create more features in your program to calculate the volume and area for other shapes. Now that you know how to create projects, customize forms, edit properties, and write basic code, you should be able to read other more advanced tutorials on Visual Basic and actually know what they are talking about.
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Fri Jun 29, 2007 9:52 am    Post subject: Reply with quote

Post Deleted: i dont remember making this post but ah well

vb sucks anyways

_________________


Last edited by HomerSexual on Sat Sep 22, 2007 2:06 pm; edited 1 time in total
Back to top
View user's profile Send private message
DURAN
Newbie cheater
Reputation: 14

Joined: 19 Apr 2007
Posts: 16
Location: The Netherlands

PostPosted: Sat Sep 22, 2007 1:04 pm    Post subject: Reply with quote

dude i cant name it to txtRadius. a error comes
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites