Jump to content

Recommended Posts

Posted

Hello Guys Today i find one guide on Google for Make Program in Visual BaSiC and i share here

 

Write your First Visual Basic Program

This Tutorial is for completely beginners with Visual Basic. It will teach you right from the very start, how to make your first program in Visual Basic.

Lesson 1 will give you introduction to Visual Basic and will teach you the basics.

Lesson 2 will teach you about variables.

In Lesson 3 you will learn more about Events and properties

 

  • Lesson 1

What Is Visual Basic and Why do I need it?

Visual Basic is Easy to learn Programming language.

With Visual Basic you can develop Windows based applications and games.

Visual Basic is much more easier to learn than other language (like Visual C++),

and yet it's powerful programming language.

 

Visual Basic suit more for application developing than for Games developing.

You can create sophisticated games using Visual Basic, But

If you want to make a really advanced professional game like Quake 2,

You may choose other language (like C++), that would be much more

harder to program with.

However,  Visual Basic will be probably powerful enough to suit all your application

and games programming needs.

 

The advantages of Visual Basic:

1) It's simple language. Things that may be difficult to program with other language,

    Can be done in Visual Basic very easily.

2) Because Visual Basic is so popular, There are many good resources (Books,

    Web sites, News groups and more) that can help you learn the language.

    You can find the answers to your programming problems much more easily

    than other programming languages.

3) You can find many tools (Sharewares and Freewares) on the internet that will

    Spare you some programming time.

    For example, if you want to ping a user over the internet in your program,

    Instead of writing the ping function yourself, you can download a control

    that does it, and use it in your program.

    Compare to other languages, Visual Basic have the widest variety of tools

    that you can download on the internet and use in your programs.

 

The disadvantages of Visual Basic:

1) Visual Basic is powerful language, but it's not suit for programming really

    sophisticated games.

2) It's much more slower than other langauges.

 

Click Forward to start writing now your first Visual Basic program!

 

  • Lesson 2

Learning about Variables

Using Variables is one of the most basic and important subjects

in programming, so this lesson is very important.

 

Variables are destined to save data.

You can save in variable Text or number.

For example, you can have one variable that holds the Text "Hello and Goodbye",

and have another variable that holds the number 623882

 

You can think about variables as a cabinet's drawers.

Every drawer has a sticker on it with its unique name.

You can put in each one of the drawers one number or one text String.

During your program, you can open the drawer with the sticker "TheUserName"

and get the text string that found inside the drawer.

You can also delete the text string that found inside the drawer

and put instead of it other text string.

 

 

Right now, we are going learn about 2 variable types.

The first type called Integer.

Integer variable can store an Integer number (round number without any fraction)

between -32,768 to 32,767.

 

You can store in Integer variable the number 0 or the number 375 or

the number -46, but you can't store the number 4.5 (Because of the .5)

or the number 100,000 (Because It's bigger than 32767) or the

number -50,042 (Because it's smaller than -32,768)

 

 

The second type called String.

You can store in String variable any text that you want.

For example "Hello" or "abcDDefGhIjk123456 blah blah %$#@!???        Blah!"

  • Lesson 3

The Command Button's KeyPress, KeyDown and KeyUp Events

The events that will be mentioned in the following pages

are commonly used, and without learning about them

you really can't go anywhere in Visual Basic programming.

 

To try these examples, start a new project (as being

taught in Lesson 1).

 

Add 1 Command Button to your form. The Command

Button is called by default Command1.

 

Copy the following code to the code window (you

can copy and paste it using Ctrl + C for copying

and Ctrl + V for pasting):

 

 

Private Sub Command1_KeyDown(KeyCode As Integer, Shift As Integer)

    Print "KeyDown"

End Sub

 

Private Sub Command1_KeyPress(KeyAscii As Integer)

    Print "KeyPress"

End Sub

 

Private Sub Command1_KeyUp(KeyCode As Integer, Shift As Integer)

    Print "KeyUp"

End Sub

 

 

When the Command Button's KeyDown event will be executed,

"KeyDown" will be printed on the form,

When the Command Button's KeyPress event will be executed,

"KeyPress" will be printed on the form, and when

the Command Button's KeyUp event will be executed,

"KeyUp" will be printed on the form.

 

 

Run the program, and click the button with the mouse.

Nothing has happened.

It's because the KeyDown, Key_Press, and KeyUp events are

being executed Only when you press a key on the keyboard.

 

Now press any key on the keyboard, hold it down for few seconds,

and then release it.

Your form will look like this:

 

Figure 1

first-37.gif

Lets see:

The first event that been executed is the KeyDown event,

because "KeyDown" was the first text that been printed on the form.

 

The second event was KeyPress, and then again KeyDown.

After every KeyDown event that been executed, a KeyPress

event had been executed.

 

We learnt that when a key is being holded down, the

KeyDown and the KeyPress events are being executed in

this order over and over again, until the key is up again.

 

When you release the key, the KeyUp event is being executed once.

Conditional Statements Tutorial

Learn what are conditional statements (If ... Then, Select Case ...) and how to use them in your programs.

 

  • Lesson 1

 

What Are Conditional Statements?

Suppose you want to protect your program with password.

You ask from the user to enter the password.

If the password is correct - you want to let the user in, if not - you want to end the program.

 

To do this, you have to use conditional statement because

the code you will execute (let the user in or end the program) is

depend on what is the password that the user has entered.

 

One of the basics of Conditional statement are Boolean variables.

Boolean variables are commonly used in programming,

and you have to understand them before continuing with conditional statements.

 

Boolean Variables

As we learnt, String variables store text, and

Integer Variables Store numbers.

Boolean variable stores one of the following constant values:

"True", or "False".

 

For example:

 

Dim Kuku As Boolean

Kuku = True

Dim YoYo As Boolean

YoYo = False

 

What are the True and False stand for?

They are the result of every "Boolean expression".

 

Boolean Expressions

Boolean expression is like a question that

the answer to it is "True" or "False"

 

For example:

Is 4 Plus 6 is 10? True

Is 2 bigger than 4? False

 

But the question

How much is 4 Plus 6?

Is not a boolean expression, because its answer

is 10 (and not True or False)

 

Examples of Boolean expressions in the next page.

 

Make your First ActiveX Control

Learn how to make your First ActiveX Control in Visual Basic, and compile it to OCX file.

 

  • Lesson1

 

First of all, what is ActiveX Control?

ActiveX control is control like all visual basic

common controls: Command Button, Label, etc.

You can make your own ActiveX control, for example

hover button control, and use it in every VB program

you make without addition of code.

Instead of writing the same code every time you want

to use the hover button, make once hover button

ActiveX control, and drag it to your form every time you

want to use it, like it was the usual Command Button.

 

How can you make your own ActiveX control?

In this tutorial we will make a button control, that will pop

a message box when the user will click on it.

I know that it's not very useful, and for this purpose you

don't have to make an ActiveX control, but this example

will teach you how to make an ActiveX control.

 

  • Lesson 2

 

Adding more properties to the control

Now we want that the control will have all the Command Button properties.

lets add the BackColor property. Enter the following code to your form:

 

Public Property Get BackColor() As OLE_COLOR

    BackColor = Command1.BackColor

End Property

 

Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR)

    Command1.BackColor() = New_BackColor

    PropertyChanged "BackColor"

End Property

 

Enter the following line to the UserControl_ReadProperties function:

Command1.BackColor = PropBag.ReadProperty("BackColor", &H8000000F)

 

Enter the following line to the UserControl_WriteProperties function:

Call PropBag.WriteProperty("BackColor", Command1.BackColor, &H8000000F)

 

The OLE_COLOR is the type of the BackColor property variable,

the same as the Boolean is the type of the Enabled property variable,

and the Integer is the type of the Height property variable.

 

 

What we did now is almost the same as we did with the Text property.

The difference is that in the text property we used

a variable (TextVariable) to store the property information.

Here we not using a variable, we read and write the information

directly to the Command1.BackColor property.

 

The Command1.BackColor property is here our variable that store

the information. Why is that?

Because when the user set the Control BackColor property,

we actually want to set the Command1 BackColor property.

Suppose the user set the Control BackColor to Black.

In that case, We want to set the Command1 BackColor to Black.

So actually, the Control BackColor property is the

Command1 BackColor property.

So instead of reading and writing to variable,

we read and write directly to the Command1 BackColor property.

 

It's exactly the same thing with all of the other properties.

 

Working with Resource File

Learn how to put mulitple Image files, Sound files, Text files and other files in one single Resource File, And how to access all these files from your program.

 

  • Lesson 1

 

What is Resource File?

Resource file is file that can contains multiple image files (BMP, GIF, JPG, ICO and more), Cursors (CUR), Sound files and other files.

All these files can be in single Resource file, and you can access them from your program. For example, you can load an icon from resource file to your Command Button.

Resource file has RES extension.

 

Why should I use Resource File?

Resource file is very useful when you use the same image several times in your code.

For example, you have two Command Buttons with the same icon or two Picture Boxes with the same BMP picture.

If you won't use resource file, but simply add the same icon to both Command Buttons Picture property, the icon will be embedded in each of the Command Buttons. so actually, your icon will be saved twice, and your application file will be bigger.

If you'll use resource file, you will have only 1 icon saved in your application.

 

 

  • Lesson 2

 

Accessing GIF and JPG files from your Program

There is no Built-In option to load GIF and JPG files, There is no vbResGIF or vbResJPG.

So to load these files you'll have to use the following Function:

 

Public Sub LoadDataIntoFile(DataName As Integer, FileName As String)

    Dim myArray() As Byte

    Dim myFile As Long

    If Dir(FileName) = "" Then

        myArray = LoadResData(DataName, "CUSTOM")

        myFile = FreeFile

        Open FileName For Binary Access Write As #myFile

        Put #myFile, , myArray

        Close #myFile

    End If

End Sub

 

 

What does this function do?

The function gets two parameters: DataName and FileName.

It simply copy the File that found in the resource file, under the CUSTOM "Folder" With the Id that found in DataName variable.

The new file name will be the String that found in the FileName variable.

 

For example,  assume I have a resource file, with EXE file that found under the CUSTOM "Folder". The EXE file ID is 101.

Calling to: LoadDataIntoFile 101, "c:\MyDir\myFile.ddd"

Will copy the EXE file to c:\MyDir\myFile.ddd

It doesn't matter if the file is EXE, GIF, JPG, TXT or WAV.

Because of that, this function can extract any file from resource file, and can be used to extract Sound files, Text files, and other files.

 

 

Credits:cuinl tripod

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • New implementations   Autofarm complete system with time limit fully configurable   Tournament 1vs1 ( not instanced ) With queue fully configurable ( possibility to run all day or 2 different hours for example Latin/Europe   Fortress vs Fortress event automated with top killer reward , protections and fully configurable with seperated .ini   And more
    • Anybody has these monsters ripped from the latest chronicle lineagemonsters14.volcanic_archer_m00 lineagemonsters14.volcanic_ice_m00 lineagemonsters14.volcanic_magic_m00 lineagemonsters14.volcanic_warrior_m00 lineagemonsters14.volcanic_boss_m00  
    • this is literally like such bad advice? i dont thikn you understand the question..   node_begin name=[Ability] type=5 sub_node_begin paramType=100 unk=0 nodeName=[Type] int_params={1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3} sub_node_end sub_node_begin paramType=100 unk=0 nodeName=[SkillID] int_params={19233;19234;19235;19236;19237;19238;19239;19240;19241;19242;19243;19244;19245;19246;19247;19248;19249;19250;19251;19252;19253;19254;19255;19256;19257;19258;19259;19260;19261;19262;19263;19264;19265;19266;19267;19268;19269;19270;19271;19272;19273;19274;19275;19276;19277;19278;19279;19280;19281;19282;19283;19284;19285;19286;19287;19288;19289} sub_node_end sub_node_begin paramType=100 unk=0 nodeName=[SkillLev] int_params={3;3;3;3;2;2;2;2;4;1;4;1;2;2;2;2;2;1;1;2;1;2;4;4;3;2;3;1;3;2;3;1;2;2;1;2;2;2;2;1;2;3;3;3;3;1;3;2;1;2;2;2;2;2;2;2;1} sub_node_end sub_node_begin paramType=100 unk=0 nodeName=[Depth] int_params={1;1;1;1;2;2;2;2;3;3;3;3;4;4;4;4;5;5;5;5;6;1;1;1;2;2;2;2;3;3;3;3;4;4;4;4;5;5;5;6;1;1;1;2;2;2;3;3;3;4;4;4;4;5;5;5;6} sub_node_end sub_node_begin paramType=100 unk=0 nodeName=[Column] int_params={1;2;3;4;1;2;3;4;1;2;3;4;1;2;3;4;1;2;3;4;2;1;2;4;1;2;3;4;1;2;3;4;1;2;3;4;1;2;4;2;1;2;4;1;3;4;1;2;4;1;2;3;4;1;2;4;2} sub_node_end sub_node_begin paramType=100 unk=0 nodeName=[RequireLev] int_params={85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85;85} sub_node_end sub_node_begin paramType=100 unk=0 nodeName=[RequireSkillID] int_params={0;0;0;0;0;0;0;19236;19237;0;19239;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;19257;0;19259;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;19276;0;0;0;0;0;0;0;0;0;0} sub_node_end sub_node_begin paramType=100 unk=0 nodeName=[RequireSkillLev] int_params={0;0;0;0;0;0;0;3;2;0;2;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;3;0;3;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;3;0;0;0;0;0;0;0;0;0;0} sub_node_end sub_node_begin paramType=100 unk=0 nodeName=[RequireCount] int_params={0;0;0;0;5;5;5;5;10;10;10;10;15;15;15;15;20;20;20;20;25;0;0;0;5;5;5;5;10;10;10;10;15;15;15;15;20;20;20;25;0;0;0;5;5;5;10;10;10;15;15;15;15;20;20;20;25} sub_node_end sub_node_begin paramType=115 unk=0 nodeName=[Name] string_params={[Guardian's Shield];[Guardian's Magic Barrier];[Guardian's Body];[Guardian's Elemental Cover];[Guardian's Armor Defense];[Guardian's Leather Defense];[Guardian's Tunic Defense];[Guardian's Resistance];[Guardian's Life];[Guardian's Block];[Guardian's Armor];[Guardian's Guidance];[Guardian's Death Shield];[Guardian's Focus Shield];[Guardian's Mind Control];[Guardian's Blessing];[Guardian's Binding Cover];[Guardian's Spirit];[Guardian's Potential];[Guardian's Expert Potion];[Guardian's Defense Master];[Berserker's Haste];[Berserker's Might];[Berserker's Elemental Attack];[Berserker's Craft Focus];[Berserker's Backfire];[Berserker's Focus];[Berserker's Cost];[Berserker's Craft Death];[Berserker's Mortal];[Berserker's Death Whisper];[Berserker's Eagle];[Berserker's Battle];[Berserker's Fire];[Berserker's Skill Reduction];[Berserker's Blessing];[Berserker's Binding Attack];[Berserker's Divine Attack];[Berserker's Expert Potion];[Berserker's Combat Master];[Magician's Acumen];[Magician's Empower];[Magician's Elemental Shot];[Magician's Wild Magic];[Magician's Condition];[Magician's Eva];[Magician's Mystic];[Magician's Prominence];[Magician's Sight];[Magician's Protection];[Magician's Water];[Magician's Magic Reduction];[Magician's Blessing];[Magician's Binding Shot];[Magician's Divine Shot];[Magician's Expert Potion];[Magician's Spell Master]} sub_node_end sub_node_begin paramType=115 unk=0 nodeName=[Icon] string_params={[icon.skill19120];[icon.skill19121];[icon.skill1045];[icon.skill1352];[icon.skill0231];[icon.skill0233];[icon.skill0234];[icon.skill1354];[icon.skill1229];[icon.skill1304];[icon.skill19165];[icon.skill19127];[icon.skill1542];[icon.skill0986];[icon.skill19132];[icon.skill_exp_sp_up];[icon.skill0335];[icon.skill10044];[icon.skill1532];[icon.skill_potion_up];[icon.skill0528];[icon.skill1086];[icon.skill19139];[icon.skill19130];[icon.skill0193];[icon.skill0030];[icon.skill1077];[icon.skill19140];[icon.skill10655];[icon.skill0330];[icon.skill4278];[icon.skill19127];[icon.skill1388];[icon.skill1356];[icon.skill0758];[icon.skill_exp_sp_up];[icon.skill0983];[icon.skill11011];[icon.skill_potion_up];[icon.skill1499];[icon.skill1085];[icon.skill1059];[icon.skill19130];[icon.skill1303];[icon.skill1501];[icon.skill0214];[icon.skill19160];[icon.skill0330];[icon.skill19127];[icon.skill0046];[icon.skill1355];[icon.skill0945];[icon.skill_exp_sp_up];[icon.skill0983];[icon.skill11011];[icon.skill_potion_up];[icon.skill1500]} sub_node_end sub_node_begin paramType=115 unk=0 nodeName=[IconPanel] string_params={[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_blessed];[icon.pannel_pupple];[icon.pannel_pupple];[icon.pannel_pupple];[icon.pannel_pupple];[icon.pannel_pupple];[icon.pannel_pupple];[icon.pannel_pupple];[icon.pannel_pupple];[icon.pannel_pupple];[icon.pannel_pupple];[icon.pannel_pupple];[icon.pannel_pupple];[icon.pannel_pupple];[icon.pannel_pupple];[icon.pannel_pupple];[icon.pannel_pupple];[icon.pannel_pupple];[icon.pannel_pupple];[icon.pannel_pupple];[icon.panel_2];[icon.panel_2];[icon.panel_2];[icon.panel_2];[icon.panel_2];[icon.panel_2];[icon.panel_2];[icon.panel_2];[icon.panel_2];[icon.panel_2];[icon.panel_2];[icon.panel_2];[icon.panel_2];[icon.panel_2];[icon.panel_2];[icon.panel_2];[icon.panel_2]} sub_node_end sub_node_begin paramType=109 unk=0 nodeName=[LevelDesc] array_params={{[P. Def. + 2%];[P. Def. + 4%];[P. Def. + 7%]};{[M. Def. + 2%];[M. Def. + 4%];[M. Def. + 7%]};{[Max HP + 3%];[Max HP + 6%];[Max HP + 9%]};{[All Attribute Defense + 15];[All Attribute Defense + 25];[All Attribute Defense + 40]};{[When equipping Heavy Armor <br>P./M. Def. + 3%];[When equipping Heavy Armor <br>P./M. Def. + 6%]};{[When equipping Light Armor <br>P./M. Def. + 3%];[When equipping Light Armor <br>P./M. Def. + 6%]};{[When equipping Robe <br>P./M. Def. + 3%];[When equipping Robe <br>P./M. Def. + 6%]};{[Debuff Resistance + 5%];[Debuff Resistance + 10%]};{[Max HP + 3%];[Max HP + 6%];[Max HP + 10%];[Max HP + 15%]};{[Shield Defense + 100%]};{[P. Def. + 2%];[P. Def. + 4%];[P. Def. + 8%];[P. Def. + 12%]};{[P. Accuracy, M. Accuracy,<br>servitor's P. Accuracy + 12.<br>Enchants Revelation skill]};{[Received P. Critical Damage - 10%];[Received P. Critical Damage - 20%]};{[Chance of receiving P. Critical Damage - 15%];[Chance of receiving P. Critical Damage - 30%]};{[Skill Cooldown - 3%];[Skill Cooldown - 5%]};{[EXP, SP + 5%];[EXP, SP + 10%]};{[Received damage when immobilized - 7%];[Received damage when immobilized - 15%]};{[All Attribute Defense + 50]};{[Skill Critical Rate + 10%]};{[Recovery Potion, Elixir Effect + 500];[Recovery Potion, Elixir Effect + 1000]};{[Received Damage - 10%]};{[Atk. Spd. + 1%];[Atk. Spd. + 3%]};{[P. Atk. + 1%];[P. Atk. + 2%];[P. Atk. + 3%];[P. Atk. + 4%]};{[Attack Attribute + 10];[Attack Attribute + 20];[Attack Attribute + 30];[Attack Attribute + 40]};{[P. Skill Critical Rate + 3%];[P. Skill Critical Rate + 6%];[P. Skill Critical Rate + 10%]};{[Rear Damage + 2%];[Rear Damage + 5%]};{[P. Critical Rate + 10];[P. Critical Rate + 20];[P. Critical Rate + 40]};{[Skill MP Consumption - 5%]};{[P. Skill Critical Damage + 2%];[P. Skill Critical Damage + 4%];[P. Skill Critical Damage + 7%]};{[Skill Mastery Rate + 30%];[Skill Mastery Rate + 60%]};{[P. Critical Damage + 2%];[P. Critical Damage + 4%];[P. Critical Damage + 7%]};{[P. Accuracy, M. Accuracy,<br>servitor's P. Accuracy + 12.<br>Enchants Revelation skill]};{[P. Atk. + 3%];[P. Atk. + 6%]};{[P. Skill Power + 2%];[P. Skill Power + 5%]};{[Skill Cooldown - 3%]};{[EXP, SP + 5%];[EXP, SP + 10%]};{[Damage to immobilized<br>targets + 5%];[Damage to immobilized<br>targets + 10%]};{[Attack Attribute + 25];[Attack Attribute + 50]};{[Recovery Potion, Elixir Effect + 500];[Recovery Potion, Elixir Effect + 1000]};{[Damage + 10%]};{[Casting Spd. + 2%];[Casting Spd. + 4%]};{[M. Atk. + 2%];[M. Atk. + 5%];[M. Atk. + 8%]};{[Attack Attribute + 10];[Attack Attribute + 20];[Attack Attribute + 40]};{[M. Critical Rate + 10];[M. Critical Rate + 20];[M. Critical Rate + 40]};{[Max HP, MP + 3%];[Max HP, MP + 6%];[Max HP, MP + 9%]};{[Skill MP Consumption - 5%]};{[M. Critical Damage + 3%];[M. Critical Damage + 6%];[M. Critical Damage + 10%]};{[Skill Mastery Rate + 30%];[Skill Mastery Rate + 60%]};{[P. Accuracy, M. Accuracy,<br>servitor's P. Accuracy + 12.<br>Enchants Revelation skill]};{[Mental, Stun, Aerial Yoke<br>Success Rate + 5%];[Mental, Stun, Aerial Yoke<br>Success Rate + 10%]};{[M. Skill Power + 2%];[M. Skill Power + 5%]};{[Skill Cooldown - 3%];[Skill Cooldown - 5%]};{[EXP, SP + 5%];[EXP, SP + 10%]};{[Damage to Immobile<br>Opponents + 5%];[Damage to Immobile<br>Opponents + 10%]};{[Attack Attribute + 25];[Attack Attribute + 50]};{[Recovery Potion, Elixir Effect + 500];[Recovery Potion, Elixir Effect + 1000]};{[Damage + 10%]}} sub_node_end node_end @babyjason in regards to your post ><
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..