What is the purpose of private sub code in visual basic?
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.
How can you print prime numbers in basic from 1 to 100?
Two solutions immediately spring to mind:
What are the three different ways of executing a form in visual basic?
1.Click on Run menu->Start option.
2.Click on Start button>on the Toolbar.
3.The Output window appears.
What is the use of reusability in inheritance?
Inheritance in Java refers to the feature wherein the code/functionality of one class can be used in another class that extends this class. Example:
public class Parent {
...
..
}
public class Child extends Parent {
...
..
.
}
Here the class Child extends the class Parent and hence the methods of Parent are available for Child to use. This way we are re-using the code in the parent class in the child class instead of re-writing the whole thing again.
What are the basic elements of visual basic?
Tha Visual Basic IDE is made up of a number of Elements
What are 3 elements of computer system?
The elements of Artificial Intelligence are:
The 5 basic components of a computer are:
What does annotated visual display mean?
An annotated visual display is a combination of visuals and summaries of observations. This information is then used to answer a hypothesis, a question to test with the observation you have made. ... The annotated visual display is a large poster.
What cool things can you make using visual basic?
You program programs like notepad, paint and such. But for sure you can program/create any type of software/application that you want, as long as you know the code. There are many sample/example on the internet. You can search at Google by the keyword 'visual basic sample' or you can go to http://www.planet-source-code.com, the largest programming language/code sample database on the internet.
Draw the data flow diagram of hotel management?
Maybe it does not exist just for hotel management. However, you may want to take a look at the more widespread general DFD design tools such as the free Dia (http://live.gnome.org/Dia) or the commercial Visio (http://en.wikipedia.org/wiki/Microsoft_Visio).
What is the difference between Visual Basic and Visual Basic.NET?
Differences between .Net and Java include
Functionality wise, there is not a lot of difference between the two, at least not when used to develop web applications.
For desktop applications, .Net naturally has an edge in Windows integration.
note: Oracle bought Sun Microsystems (Sun).
Why visual basic is called ide?
It isn't. Visual Basic is a programming language. Visual Studio is the IDE (integrated development environment). The Visual Studio IDE can be used to write programs in other languages besides Visual Basic, including Visual C++, Visual C#, Visual F, JavaScript and Python. The IDE provides all the tools you need to write programs in any of these languages but can be customised to support others. The languages available depend upon which languages you have installed or added to the IDE.
What is object oriented programming and visual basic.net?
Yes, Visual basic uses Objects. I.E. buttons, options buttons, forms, text boxes, these are all objects in VB. VB also allows the creation and use of COM classes.
Visual basic is partially OOP as it does not support implementation inheritance, which is usually a feature of an object-oriented language.
What is a bug in visual basic?
A "bug" is another word for an error. This usually arises if their is a problem with the code or a code's result.
Code for scientific calculator in visual basic?
Prep work: add 3 textboxes and 4 buttons
Button1 = Add
Button2 = Subtract
Button3 = Multiply
Button4 = Divide
Make sure to keep a textbox for the answer (I'll use one called, "TextBox3")
For Button 1:
TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.text)
'This takes text1's value and adds text2's value to it
For Button 2:
TextBox3.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
'same as button one but subtract
For Button 3:
TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
For Button 4:
TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
What is an odd and even number program in visual basic?
I don't now visual basic, but to determine whether or not a number is even or odd, divide it by two twice, and round once. If the rounded result is equal to the non-rounded result, then the original number is even:
input n
if (n/2.0) == int(n/2.0)
print "the number is even"
How do you create an array in visual basic?
If you are referring to the searching and sorting of strings, there are 2 main methods that Visual Basic uses most. If you want to search for a phrase in a string, you would probably use the InStr method, which would give you an integer which would indicate the place where the phrase was found. It might look something like this:
Dim InputString as String
Dim StringToFind as String = "Whatever text you want to find"
Dim PositionInteger as Integer
PositionInteger = InStr(InputString, StringToFind)
If you wanted to sort the string, you could do it with the substring method using the split point you found with the previous code. To do that, you would make a variable that would contain the latter half of your string, and use the subtring method to extract it from the whold string. To do that, you must type "Substring" and in parenthasis, give it a starting position, and an ending position. If you want all the characters from the phrase to the end of the sting, you do not need to put in an end point. The starting point for this example will be the position of the start of the search phrase, plus thirty (since you want to start after the end of the phrase, which is thirty characters long). Your code might look like this:
Dim NewString as String
NewString = Substring(PositionInteger + 30)
This would make the variable "NewString" contain all the characters following the search phrase.
What are parts of visual basic in toolbox?
There are different parts of IDE- Entegrated development Environmene in visual basic. The important IDE elements are following-
How do you make binary to decimal converter in G W BASIC?
First of all we will talk about how binary number are converted back into decimal representation and later we will have program.
Here is the formula of this transformation:
Binary number: a3a2a1a0
Decimal number a x 23 + a x 22 + a x 21 + a x 20
Example:
Binary: 1101
Decimal: 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20 = 8 + 4 + 0 + 1 = 13
And here we have our program:
#include
#include
#include
int main() {
char str[100];
int ind;
int sum = 0;
printf("Please enter binary number: ");
scanf("%s", str);
for(ind = 0; ind < strlen(str); ind++) {
sum += (str[ind] - 0x30) * pow(2, strlen(str) - ind - 1);
}
printf("Number in decimal would be %d\n", sum);
return 0;
}
Testing:
Please enter binary number: 1101
Number in decimal would be 13
Please enter binary number: 10000001
Number in decimal would be 129
Please enter binary number: 11111111
Number in decimal would be 255
Please enter binary number: 0
Number in decimal would be 0
A message box is a predefined function which displays a box containing text, a title, a series of buttons and a small indicative picture to the user informing them of the basic nature of the message (E.g A Critical Exception would have a large red circle with a cross in it). It will return an integer value to its calling procedure to indicate which button the user clicked (e.g. Ok or Cancel).
The code for a message box is structured as follows:
MsgBox(