Author Topic: Visual Basic (4)  (Read 1742 times)

Offline JokeBOx

  • Advanced Member
  • *
  • Topic Author
  • Posts: 206
  • Karma: +8/-27
  • HELLO!!!!!!!!!!!!!!!
  • Awards Winner of 1 Photoshop Challenge Contest [COMMON]
    • View Profile
    • Awards
Visual Basic (4)
« on: February 04, 2012, 17:55 »
What are the basic things to make a program. When starting Visual Basic must first have an open project which will form the program or the appearance of the program. In this program you put objects on which each of them will assign a specific function. Can the tools in the left part to put various objects in which they are assigned different codes for displaying text or other data. If the program can be completed it will be found in a circle and will be blocked for that purpose, use ctrl + Pause Break. Double click on any of the facilities are open part of the code of that object. Now surely interest you and how you write code, and whether they have logic. Sure you have slowly and logic must explain the whole system functioning to explain the codes which achieve our requirements of a program.

So in the left part we have facilities like Label object to paste text without the possibility of change after program start. Text box in this facility is free to write in the program. CommandButton this will not be the most widely used facility whom will perform on some orders.

So now we go with a simple program where the shape of the program will draw two objects and two TextBox objects underneath CommandButton. The first object in itself would have already written text and Text1 and Text2 so in the right part of Visual Basic find where writes Caption, and Text1 to it and delete it to remain empty, do the same with the second object. In CommandButton objects change the Caption of Command1 to CHANGE Exit first object and second object. Once we created the look of the program will now go to the programming of the program for this purpose will first double-click the form to the program, just beware not to click on an object and write the following code

Text1. Text = 66
Text2. Text = 99


between those already out words.

Private Sub Form_Load()

End Sub


So in the end should look like this.

Private Sub Form_Load()
Text1.Caption = 66
Text2.Caption = 99
End Sub


With this we have assigned value of those items in startup. Click twice on the object which is named after CHANGE us out

Private Sub Command1_Click()

End Sub


You need it to write the following

temporaryvariable = Text1.Text
Text1. Text = Text2. Text
Text2. Text = temporaryvariable


This will change the values ​​of first and second text object by clicking CHANGE in the program when we have spawning.
The object on which written Exit, write the following:

Private Sub Command2_Click()
End
End Sub


Here's how it should look like the program and code. Program step by step can be viewed by pressing F8 or immediately run the F5.

Offline ek0

  • Honored member
  • HolyShit Member
  • *
  • Posts: 5029
  • Karma: +347/-260
    • View Profile
    • Awards
Re: Visual Basic (4)
« Reply #1 on: February 04, 2012, 20:23 »
Okay, continue posting the guides. I'm glad you like programming.

PS: I'll delete the spam.