6? 1 Know the names of common components in Windows operating system, such as buttons, text boxes, radio buttons, scroll bars, etc.
6? 1 master some programming ideas or mathematical ideas. Or have a certain ability of logical analysis.
6? 1 You can often practice on the computer. Of course, the best way to learn is to read while doing practical work.
Beginners are advised to read the National Computer Rank Examination published by Higher Education Press. 6? 1 intermediate Visual Basic language programming (with answers to exercises after class) and Visual Basic programming published by Tsinghua University Publishing House (edited by Tan Haoqiang). Other books are unclear on many issues. Reference is not recommended.
2. The main contents in 2.VB:
VB is also a computer language, and inevitably there will be various grammars, mainly variable types, selection program structures, loop program structures, arrays, sub-functions and sub-processes, and files. In addition, because VB is a visual programming tool, it has more "controls" than traditional QBASIC and C language. The specific requirements of these controls are introduced in the textbook.
3. Introduction to the key points and difficulties of each chapter:
The "chapter" here is not introduced according to the "chapter" in the textbook, but according to the "block" I just divided. And it is described according to the national computer secondary VB test standard.
1), variable type
Concepts of variables and constants. The main variable types are integer, string, long integer, Boolean, currency, floating point and double precision. Integers, strings and booleans are the most common.
2) Select the program structure
Several common selection structures. It's all in the book. Remember how to judge the "true" and "false" conditions in the learning process and choose different program directions. What if the condition is "true"? What if the condition is "false"? Finally, don't forget the ending if.
Pay attention to cultivate your own good coding style when learning to choose the program structure. Look at an example: private sub number _ click (index is an integer)
If lastinput & lt& gt "nums" then.
Disp = number (index). title
other
Disp = disp+Number (index). title
If ... it will be over.
lastinput = "nums "
Whether you can understand what this program is written or not, besides, this is not the main purpose of showing you this program. You should pay attention to the coding style of this program, which is the format. Almost every piece of code in VB is between a "Sub" and an "End Sub", so when you write a program, you'd better indent the first line of code by a Tab key to the right, press the Tab key on the keyboard, and then enter the code. If a statement such as "if" appears, the code on the line after "Then" should be indented by two Tab keys. I don't know if I understand. It doesn't matter if you don't understand. Just look at some excellent codes. 3) Ring structure
This part can be said to be a headache for beginners. Especially the determination of cycle conditions. When to execute the loop and when not to execute the loop. Which statements execute loops less (more) than those statements.
Circular sentences are explained in detail in the main textbooks. Try and practice more in this part. You can cross out the execution order of the statements in the source program. Actually, it won't take long to understand.
Give a typical example: "One hundred dollars for one hundred chickens" private command 1_Click ()
Dimensions x%, y%, z%, t are data and t 1 are data.
For x = 0 to 100
For y = 0 to 100
For z = 0 to 100
If x+y+z = 100 and 3 * x+2 * y+0.5 * z = 100, then
Print "You can buy hens"; x; "Only, rooster"; y; "only, chicken"; z; "only"
If ... it will be over.
Next z, y, x
End Sub is a classic algorithm for beginners. 100 yuan, buy three kinds of chickens, a hen 3 yuan, a rooster 2 yuan and a chicken 0.5 yuan. Ask how much you can buy. Don't forget to look at the format after learning the algorithm. In the next place where the order of z, y, x, y and x cannot be reversed, it can also be written in the following format: private subcommand1_ click ().
Dimensions x%, y%, z%, t are data and t 1 are data.
For x = 0 to 100
For y = 0 to 100
For z = 0 to 100
If x+y+z = 100 and 3 * x+2 * y+0.5 * z = 100, then
Print "You can buy hens"; x; "Only, rooster"; y; "only, chicken"; z; "only"
If ... it will be over.
The next z
next year
Next x
End Sub4) array
Array is an important data structure. Practice more. Among them, the most error-prone thing in VB is subscript! For example, if you define an array Arr(4), it has five variables: Arr(0) and Arr(4).
5) Sub-functions and Sub-processes
I use the name in QBASIC here. The most confusing concepts in the sub-function (procedure) part are "passing address" and "passing value", namely "ByRef" and "ByVal", and ByRef is the default. In other words, if the delivery method is not indicated in the parameter table of the function, the delivery address will be handled by default. Values in a function can be passed from the main function to the sub-function (procedure) or returned from the sub-function (procedure) to the main function. In fact, the "main melody function" I mentioned here is not exact, but should be called "main melody function". Another related concept is "formal parameter" and "real parameter", namely "real parameter" and "formal parameter". The actual parameters are the parameters in the sub-function (procedure), and the formal parameters are the parameters in the "main tone function".
I think the function parameter call in VB should be simpler than other computer languages, including C/C++ and so on. In C/C++, the default way of parameter passing is value passing. You just can't return the parameters of the sub-function (procedure) to the main function. If you want to do this, you must use pointer variables.
Look at an example of a simple subroutine (procedure) call: Public Sub Swap(x, y).
Mark t as an integer.
t=x
x=y
y=t
End child private subform _Click ()
Dim a as an integer.
Dim b is an integer
a= 10
b=20
Swap a, b
Print " a =a," b = "; b
End SubForm_Click is the main function and Swap is the subfunction (procedure). The penultimate line of the tone function calls the sub-function (procedure), and the output result is: "a=20, b= 10".
6) files
There are not many questions in this part of the single exam, and it is not used in practical application, but it always appears as the finale in some exams. More seriously, if this part is not clear, the whole problem will be at a loss. So it's better to have a good look at this part.
7) Common control
The three concepts of "attribute", "event" and "method" are the biggest headaches for beginners.
These three concepts are unique to object-oriented programming. Although VB6 is not a standard "object-oriented programming language", it has many object-oriented features, but it does not have the characteristics of "class inheritance". Considering that beginners don't have the foundation of object-oriented programming, they can't give the exact definition of the above three concepts. But we can understand these three concepts in this way: "property" is the inherent property of a control. Take the command control as an example. Its properties include Length, Width and Show Pictures. To put it simply, most of the control properties that beginners come into contact with can be found in the property bar in the VB6 development environment (if the property cannot be found, it is called "read-only property").
The "event" is easy to understand. For example, when we click a button with the mouse, the "button" control receives the mouse click, in other words, "a click event occurred on the button". So what will the program do after the click event? That is to run the program you wrote for this event. Now you open the interface of VB6, draw a button casually, and then double-click this button to enter the code view, and write the code between Private Sub Command_Click () and End Sub. Then the code you write is the code executed by the Click event of the button named Command.
The concept of "method" is the least easy to understand. According to the standard object-oriented programming description, a method is a function, which is encapsulated in a class. In fact, we can also think of a method as a "function", similar to the "subfunction (procedure)" described above. There are not many VB6 methods commonly used by beginners, and the most commonly used method is "printing". As you can imagine, I didn't find how special it was when I used it just now. In fact, we are already using the printing method. We just don't need to know who it belongs to.
I won't say much about the use of controls here, because the textbook is much more detailed than mine.
4. Conclusion:
Visual Basic6.0 can be regarded as the simplest computer language. You should pay more attention when you study. In fact, even if you can't remember the previous "variables" part, you will continue to strengthen your previous knowledge in the subsequent learning process. What's more, all exams now have MSDN, which is a help system of VB. If you can't remember any key words or usage, you can always consult the relevant literature of MSDN.
Finally, I wish everyone a happy VB! Attachment: Give some classical algorithms for finding the greatest common divisor and the least common multiple.
Private subcommand 3_Click ()
Dim m 1%,m%,n%,n 1%,r%,b%
M 1 = Val(InputBox ("Enter a number:"))
N 1 = Val(InputBox ("Please enter another number:"))
If m1> N 1 then m = m 1: n = n 1 otherwise m = n 1: n = m 1
do
r = m Mod n
If r = 0, Do is exited.
m = n
n = r
ring
Print m1; "harmony"; n 1; "The greatest common divisor of is:"; n
b = m 1 * n 1 / n
Print m1; "harmony"; n 1; The least common multiple of is: "; b
End joint
Find all prime numbers (prime numbers) between 100 and 200.
Private subcommand 2_Click ()
Fuzzy i%, m%
For step 2 of m = 10 1 to 199.
For i = 2 to Int(Sqr(m))
If (m Mod i) = 0, GoTo notnextM' once divisible by a number from 2 to sqr(m), goes to the next number.
Next, I
Print m
notnextM:
The next m
End the submarine, attention! GoTo statement is used in the program!