Professional Documents
Culture Documents
Visual Basic Notes
Visual Basic Notes
2/3/2008
1
VisualBasic
,
, ,
.
.
.
.
(object tools),
(form),
(Projectstructure,projectfiles),
().
VisualBasic(objectoriented)
C++. ,
.
|2
(Array of objects).
:
(Picture
(Button,
(TextBox,
), (Label,
),(Timer,
),
),
).
.,
Picture,,Timer.
.
,
.
.
.
,.
, Label objects , .
.
events()
.
|3
..
, ,
.
.
.,.
.
,
..
|4
, .
Type ... End Type .
.
,
modules.module.module
.
,module
().
|5
. ()
().
.
().
.()
()(pixels).
/(),
Scale.
|6
/
.,TextBox
.
Move.
/
.
..
|7
,
().
Timer .
.
.
.
:
.
, ,
,.,
.
.
,.
.
. ,
.
.
|8
.Plot
, plotWaves. .
Exit,,
(event) .
(, )
Label.
|9
.Picture1
. PSet
. Line . ,
.
RGB(Red,Blue,Green)Red,Green
Blue0255.0,,255
. 255, . ,
(Helpfiles).
|10
.
.
Timer
CLOSE
ALARMS . Frame
CheckBox
,.
Module .
.
|11
. .
Index Check1_Click,
,
array
copypaste. ,
.
Index05.
Timer.
.
|12
events Timer , ,
.
.
.,,.
,Visualbasic.
|13
Visual
Basic. , FindFirst FindNext
SQL,
SeekIndex.
project,StandardEXE,
Windows().
VisualBasic.
,(objects)
(
project.
|14
(labels,
boxes,
), (Data,
(Commandbuttons,
),(text
)..
:Data
myDBObject Data
Visual Basic
(RecordSet)(Database).
,,:
,
.
Access
.
, . ,
Text1,..txtTitle.
, (c:/myBooksDB)
(myBooksTable), ,
Access Title.
|15
myDBObject
Access.
DataSource(myDBObject)
,DataField.
,.VisualBasic
pulldown,
.
txtTitle,..
.
MultiLine True
ScrollBars2Vertical.
.
.CommandButtonName
, .. cmdAddNewRecord, Caption
,...
!Name,Caption.
|16
.
..
PrivateSubEndSub,
.
.:
myDBObject.Recordset.AddNew
,
.AddNewRecordset,
ClickcmdAddNewRecord.
:
Click,
...
.
. .
, ( )
().
|17
,.
.
(),,VisualBasic.
( ). Access,
.
Visual Basic !
myDBObject .
..
,:
myDBObject.RecordSet.FindFirst SQL_String
(Record RecordSet)
SQL_String.
(Loop),WhileWend.
|18
myDBObject.RecordSet.FindNext SQL_String
(RecordRecordSet)
SQL_String
.
(Loop),WhileWend.
,
extBox,.:
.
.,SQL_String.
SQL
SQL_String :
<_><><><><>
:
<_>:
(..Access).
<>:,
=
>
<
<>
>=
<=
Like
<>:,:
|19
,
,,
1:
SQL_String = Author = John
myDBObject.RecordSet.FindNext SQL_String
Author = John,Author
(Author) .. . =
( ) John / ,
John.
2:
SQL_String = Year >= 2002
myDBObject.RecordSet.FindNext SQL_String
Year = 2005,Year
(Year).>=
2002..
3:
SQL_String = Title Like *Visual Basic*
myDBObject.RecordSet.FindNext SQL_String
Title Like *Visual Basic*,Title
(Title).Like
VisualBasic,VisualBasic.,
*Visual Basic*.VisualBasic.
*Visual Basic Visual Basic , Visual
Basic*VisualBasic.
AND,OR,XOR.
:
SQL_String=TitleLike*VisualBasic*ANDYear>=2002
myDBObject.RecordSet.FindNextSQL_String
VisualBasic
2002.
,.
IFTHENELSEENDIFOptionButtonCheckBox.
.
, lstResults.
|20
IFTHENELSEENDIFNoMatchFALSE
TRUE.
Nobookfound!.
F. Writer
;.
|21
WhileWendFindNext
SQL.
Wend
.
ListCount.
.
,
, SQL
Like. (*)
.
SQL_String..
Visual Basic.
.
.
:
SQL
FindFirstFindNext.
:
MoveFirst
MoveLast
MoveNext
MovePrevious
NoMatch
,WhileWend,
.
AddNew,
, . , ,
|22
, ,
.
,
(Click)Delete,..frmBooks.myDBObject.Recordset.Delete
HELPVisualBasic
.
!!!
.
.
|23
Windows
.Copy/Cut&Paste
/&.
.
Clipboard.
Clipboard
,
.
CopyText.
Clear
. SetText , ..
txtTextfrmClipboard.
,SetData.
|24
GetTextGetData.
txtText
:frmClipboard.txtText.Text=Clipboard.GetText.
|25
4
EXCELVisualBasic
VisualBasicWindows
. ,
.. EXCEL, .
.
EXCEL.
VisualBasicOLE
.
OLE.
. Cancel
OLE..
.
OLE, Paste (
).
OLE.
.
.
VisualBasic;OLE
Paste.
Paste Special
.
|26
PasteLink,OK.
..
,.
Visual Basic . OLE
.
OLE Paste Link
.
EXCEL
.
.(EXCEL)
. ,
Update.OLE..myOLE
.
|27
VisualBasic
Visual Basic.
,,,
,EXCEL.
OutlookVisualBasic.
email
.
(SEND).
email
.:
|28
,SEND
SubjectMessage.
.HELP
.F1
.,
.
.
,
. .
VisualBasic
.
|29