answersLogoWhite

0


Best Answer

Private is a keyword that tells visual basic what the access level of the variable or procedure it is declaring will be within your application, and as such what code has permission to read it and write to it (or call it).

You would use private on variables and procedures you wish to expose only to the class in which they are actually in, the ability to correctly define public, private and protected (etc.) access levels for code is a primary principle of object oriented programming.

When you declare a variable you can do any of the following, for this example, the following three variables are all declared on one form (Form1):

Dim intVariable1 As Integer

Public intVariable2 As Integer

Private intVariable3 As Integer

All three are integer variables, the difference comes in what can and cannot access them. Dim and Private are equivalent, one and the same, they can only be accessed and manipulated within the form itself.

However, intVariable2 is declared as public, which means that for example, if we created another form (Form2) with the following code behind it declaring a new copy of form 1:

Private oForm1 As New Form1

oForm1.intVariable2 = 87

We can change and access the second variable from another form, however since the other two variables are declared Dim and Private they cannot be accessed from any other location than within form1 itself.

Hope this clarifies it a bit for you.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

"Sub" stands for "Subroutine". It is used like the "void" keyword in java and c#.

This answer is:
User Avatar

User Avatar

Wiki User

8y ago

A subroutine is a procedure that does not return a value to its caller. Only functions can return values to their callers.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

sub procedure.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

I do not no

This answer is:
User Avatar

User Avatar

Anonymous

Lvl 1
4y ago

Study the VB 2010 code below and answer questions that follow

Private Sub BtnFOR_Click...

Dim i As Integer

For i = 1 To 25 Step 5

LstFOR.Items.Add(i & " " & i*10)

Next

End Sub

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the purpose of private sub code in visual basic?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the mening of basic in visual basic?

Basic in Visual Basic stands for Beginner's All-purpose Symbolic Instruction Code.


Abbreviation for the word 'basic' in visual basic?

Beginner's All-purpose Symbolic Instruction Code


What does BASIC stand for in Visual Basic?

Beginner's All-Purpose Symbollic Instruction Code


What is a visual basic code?

Visual Basic code is a program or library that has been written using the Microsoft Visual Basic programming language.


Who develop visual basic programming language and where?

BASIC (Beginners All-purpose Symbolic Instruction Code) was developed by John Kemeny and Thomas Kurtz. Microsoft took BASIC and deveoped it into QuickBASIC, which was further developed into Visual Basic.


What type of language is visual basic?

basic is a general purpose, high level programming language. and the same is with the visual basic. but the main difference is that, the earlier basic was the dos version language. whereas the visual basic programming language is the language which is not DOS based. but the simplicity in the language remains the same as in basic.


How do you codify in excel?

Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.


What is meant by BASIC in visual basic?

BASIC stands for Beginner's All-purpose Symbolic Instruction Code.


Can you check my Visual Basic code?

No. In order to check you code we must first see your code, but the answers website is not intended to be used for this purpose; it exists purely to answer questions, nothing more. Submit your code to a coding forum instead.


Code exsample in visual basic convertion in cm to inches?

Private Sub cmdcm_Click() txtin.Text = val(txtcm.Text) * 0.393700787 End Sub ________________________________________________________________ Private Sub cmdin_Click() txtcm.Text = val(txtin.Text) * 2.54 End Sub


What is a source code in Visual BASIC?

In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.


What are the versions of basic?

Basic is a programming language. Full Formof BASIC is Begineers All Purpose Symbolic Industrial Code. There are around 250 variation of BASIC. The most common ones are GW BASIC, QBASIC and Visual Basic.You can find more on: http://en.wikipedia.org/wiki/BASIC