Guest 2.1 Creating Your First Application - elite411 - 2.1 Creating Your First Application - elite411
Main
Registration
Login
Main | signup | loginsend free smsPhotoshopGalleryGallery
Our Link Exchange Code:
Now translate our website in any language
[ New messages · Members · Forum rules · Search · RSS ]
Page 1 of 11
elite411 » Programming » Visual Basic » 2.1 Creating Your First Application
2.1 Creating Your First Application


farhan411Date: Tuesday, 2010-07-06, 5:51 PM | Message # 1
Website Owner
Group: Administrators
Messages: 930
Awards: 23 Load ...
Reputation: 62
Status: Offline
2.1 Creating Your First Application

 In this section, we will not go into
the technical aspects of Visual Basic programming yet, what you need to do is just try out the examples below
to see how does in VB program look like:


Example 2.1.1 is a simple
program. First of all, you have to launch Microsoft Visual Basic 6. Normally, a
default form with the name Form1 will be available for you to start your new project. Now,
double click on Form1, the source code window for Form1 as shown in figure 2.1
will appear. The top of the source code window consists of a list of objects and
their associated events or procedures. In figure 2.1, the object displayed is
Form and the associated procedure is Load.





 



Figure 2.1 Source Code Window



When you click on the object box,
the drop-down list will display a list of objects you have inserted into your
form as shown in figure 2.2. Here, you can see a form with the name Form1, a command button with the
name Command1, a Label with the name Label1 and a Picture Box with the name
Picture1. Similarly, when you click on the procedure box, a list of procedures
associated with the object will be displayed as shown in figure 2.3. Some of the
procedures associated with the object Form1 are Activate, Click, DblClick (which
means Double-Click) , DragDrop, keyPress and more. Each object has its own set of
procedures. You can always select an object and write codes for any of its
procedure in order to perform certain tasks.







  





You do not have to worry about
the beginning and the end statements (i.e. Private Sub Form_Load.......End
Sub
.); Just key in the lines in between the above two statements exactly as are
shown here. When you press F5 to run the program, you will be surprise that nothing shown up
.In order to display the output of the program, you have to add the Form1.show

statement like in Example 2.1.1  or you can just use Form_Activate ( )  event
procedure as shown in example 2.1.2. The command Print does not mean printing
using a printer but it means displaying the output on the computer screen. Now,
press F5 or click on the run button to run the program and you will get the
output as shown in figure 2.4.




 You
can also perform
arithmetic calculations as shown in example 2.1.2. VB uses * to denote the
multiplication operator and / to denote the division operator. The output is
shown in figure 2.3, where the results are arranged vertically.

 



 

 











 

 


 




 







Figure 2.2: List of Objects




 


 






 


Figure 2.3:
List of Procedures



 





 











Example 2.1.1



Private Sub
Form_Load ( )



Form1.show



Print
“Welcome to Visual Basic tutorial”


End Sub


 



Figure 2.4 :
The output of example 2.1.1




 



Example 2.1.2



Private Sub
Form_Activate ( )



Print 20 +
10

Print 20 - 10

Print 20 * 10

Print 20 / 10


End Sub


 


 



Figure 2.5: The
output of example 2.1.2




 


 



You can also use the
+
or the & operator to join two or more texts (string) together like
in example 2.1.4 (a) and (b)







Example 2.1.4(a)



Private Sub



A = Tom

B = “likes"


C = “to"

D = “eat"

E = “burger"

Print A + B + C + D + E





End Sub





Example 2.1.4(b)

Private Sub



A = Tom

B = “likes"

C = “to"

D = “eat"

E = “burger"

Print A & B & C & D & E


End Sub






The
Output of Example 2.1.4(a) &(b) is as shown in Figure 2.7.










 



2.2 Steps in Building a Visual Basic Application


 



Step 1 : Design the interface



Step 2 : Set properties of the controls (Objects)


Step 3 : Write the event procedures



Click here to Visit us


elite411
www.farhan411.do.am
HTML code to this post
BB-code to this post
Direct link to this post

 
elite411 » Programming » Visual Basic » 2.1 Creating Your First Application
Page 1 of 11
Search:
User's Color: [Administrator] [Checked] [SuperModerator] [Vip] [G.Mod] [user]
++++++++++Get cash from your website. Sign up as affiliate.+ +Earn Rs. 9,000 Click here:Join now! Your Adds here.
Statistics Forum
Recent Posts Readable topic Top Users New User Last user Login
  • selling cc cvv2 fulls tracks 1 and 2 dumps (1)
  • selling cc cvv2 fulls... (0)
  • selling cc cvv2 fulls tracks 1 and 2 dumps (0)
  • selling cc cvv2 fulls tracks 1 and 2 dumps (0)
  • Admin Contact: (0)
  • Windows 7 Gamer Edition | 64-bit | UNDEADCROWS-ISO (0)
  • new title bar (7)
  • Hide IP Easy 4.1.6.6 (13)
  • User Ranks (4)
  • My heart will go on-'Titanic' (5)
  • selling cc cvv2 fulls tracks 1 and 2 dumps (1)
  • selling cc cvv2 fulls... (0)
  • selling cc cvv2 fulls tracks 1 and 2 dumps (0)
  • selling cc cvv2 fulls tracks 1 and 2 dumps (0)
  • Admin Contact: (0)
  • Windows 7 Gamer Edition | 64-bit | UNDEADCROWS-ISO (0)
  • new title bar (7)
  • Hide IP Easy 4.1.6.6 (13)
  • User Ranks (4)
  • My heart will go on-'Titanic' (5)
  • farhan411
  • Hacking_skills
  • zeeleey
  • Hacker4Life
  • Fantasy
  • Deep_Thinking_4u
  • ELIA
  • Admin
  • Ilia_ano1
  • NiKoLa
  • stormseller
  • ayukodok
  • dafaggotry
  • mas
  • Ghaniz
  • maxwell99
  • cms_star
  • ahmet28051
  • Fiat
  • love
  • Copyrights farhan411 © 2011
    Hosted by Farhan Khalid