상세 컨텐츠

본문 제목

Visual Basic 2010 Source Code Samples

카테고리 없음

by pulctaceni1972 2021. 1. 21. 01:46

본문



In the previous Lesson, you have learned that Visual Basic 2010 is an object oriented programming language. You have understood the meanings of class, object, encapsulation inheritance as well as polymorphism. You have also learned to write some simple programs without much understanding some underlying foundations and theories. In this Lesson, you will learn some basic theories about VB2010 programming but we will focus more on learning by doing, i.e. learning by writing programs .I will keep the theories short so that it would not be too difficult for beginners.

  1. Visual Basic 2010 Source Code Samples Pdf
  2. Visual Basic Source Code Download
  3. Visual Basic 2010 Source Code Samples Free
  4. Visual Basic Source Code
  5. Planet Source Code Visual Basic
  6. Visual Basic Sample Programs
Samples

Visual Basic Sample Codes Ebook. Visual Basic Sample Codes E-Book is written by our tutor, Dr.Liew. It comprises 258 pages of captivating contents and 48 fascinating Sample Codes.Perfect source of reference for your VB projects. Check it out by clicking the book picture. This tutorial will help you understand the Visual Basic TextBox control and its important properties, methods and events. Name property: A unique name given to the textbox control on a windows Form. Usually 'txt' is the prefix used for textbox. For example, if you use a textbox to get customer's name, txtCustomer is the naming convention. Many visual basic project source code with database.here latest and new project on vb with database. This project is useful for student to learn project development.and also share his knowledge with other student. Kashipara.com is useful for student.

5.1 The event Procedure

Visual Basic 2010 is also an event driven programming language. Event driven means the user will decide what to do with the program, whether he/she wants to click the command button, or he/she wants to enter text in a text box, or he/she might wants to close the application and etc. An event is related to an object, it is an incident that happens to the object due to the action of the user , such as a click or pressing a key on the keyboard.

Visual Basic 2010 Source Code Samples Pdf

A class has events as it creates an instant of a class or an object. When we start a windows application in VB2010 in previous chapters, we will see a default form with the Form1 appears in the IDE, it is actually the Form1 Class that inherits from the Form class System.Windows.Forms.Form, as shown in the Form1 properties window in Figure 5.1.

Visual Basic Source Code Download

When we click on any part of the form, we will see the code window as shown in Figure 5.2. The is the structure of an event procedure. In this case, the event procedure is to load Form1 and it starts with Private Sub and end with End Sub. This procedure includes the Form1 class and the Load event, and they are bind together with an underscore, i.e. Form_Load. It does nothing other than loading an empty form. You don't have to worry the rest of the stuff at the moment, they will be explained in later Lessons.

Visual basic source code examples

In addition, there are other events associated with the Form1 class. Control center brother download mac. These events are click, cursorChanged, DoubleClick, DragDrop, Enter and so on, as shown in Figure 5.2(It appears when you click on the upper right pane of the code window)

Visual Basic 2010 Source Code Samples Free

Figure 5.2 The Events

5.2 Writing the code

Planet source code visual basic

Now you are ready to write the code for the event procedure so that it will do something more than loading a blank form. The code must be entered between Private Sub....End Sub. Let's enter the following code :

The first line of the code will change the title of the form to My First VB2010 Program, the second line will change the foreground object to Forest Green( in this case, it is a label that you insert into the form and change its name to Foreground) and the last line changes the background to Csyan color. The equal in the code actually is used to assign something to the object, like assigning yellow color to the foreground of the Form1 object (or an instance of Form1). Me is the name given to the Form1 class. We can also call those lines as Statements. So, the actions of the program will depend on the statements entered by the porgrammer.

The output is shown in the Figure 5.3

Figure 5.3

Visual Basic Source Code

Here is another example: https://niesifiri.tistory.com/5.

Planet Source Code Visual Basic

In this example, you insert one command button into the form and rename its caption as Show Hidden Names. The keyword Dim is to declare variables name1, name2 and name3 as string, which means they can only handle text. The function MsgBox is to display the names in a message box that are joined together by the '&' signs. The output is as shown in Figure 5.4

Visual Basic Sample Programs

Figure 5.4