مقدمه ای بر  Visual Basic6
Integrate Development Environment <ul><li>IDE   چیست؟ </li></ul><ul><ul><li>تمام امکانات مورد نیاز برای نوشتن، اجرا وتست ی...
اجرای  IDE <ul><li>می توان از طرق مخلف  IDE   را اجرا کرد : </li></ul><ul><ul><li>از طریق منوی  start </li></ul></ul><ul><...
انتخاب نوع پروژه <ul><li>نخستین بار که  VB IDE   را اجرا می کنید، از شما خواسته می شودکه نوع پروژه را انتخاب کنید </li></u...
پنجره های  IDE
ساخت یک برنامه ساده
<ul><li>Caption property  </li></ul><ul><ul><li>&width </li></ul></ul><ul><ul><ul><li>Label, Frame, CommandButton, OptionB...
Naming Controls  <ul><li>Name  property  </li></ul><ul><ul><li>All components have it </li></ul></ul><ul><ul><li>Very impo...
Standard naming <ul><li>use the same three-letter prefix for all the controls of a given class  </li></ul>frm  Form  fra  ...
<ul><li>Textbox names:txtWidth, txtHeight, txtPerimeter, and txtArea  </li></ul><ul><li>commandButton name:cmdEvaluate  </...
Moving and Resizing Controls <ul><li>Select one or more controls, and move them as a single entity using the mouse.  </li>...
Setting the Tab Order <ul><li>TabIndex  property  </li></ul><ul><ul><li>starting with 0  </li></ul></ul><ul><ul><li>0 to t...
Adding Code <ul><li>Click  event </li></ul><ul><ul><ul><li>Private Sub cmdEvaluate_Click()  </li></ul></ul></ul><ul><ul><u...
<ul><ul><li>Private Sub  cmdEvaluate_Click()  </li></ul></ul><ul><ul><li>' Declare two floating point variables.  </li></u...
Running and Debugging the Program  <ul><li>invoking the Start command from the Run menu  </li></ul><ul><li>clicking the co...
Breakpoint  <ul><li>invoking the Toggle Breakpoint command from the Debug menu  </li></ul><ul><li>pressing the F9 shortcut...
<ul><ul><li>You can view the values of all the local variables by selecting the Locals command from the View menu.  </li><...
Upcoming SlideShare
Loading in...5
×

Vb

464

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
464
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Vb

  1. 2. مقدمه ای بر Visual Basic6
  2. 3. Integrate Development Environment <ul><li>IDE چیست؟ </li></ul><ul><ul><li>تمام امکانات مورد نیاز برای نوشتن، اجرا وتست یک application خوب را به شما می دهد . </li></ul></ul><ul><ul><li>امکان ایجاد فایلهای executable را می دهد </li></ul></ul><ul><ul><ul><li>فایل های مستقل از محیط برنامه نویسی </li></ul></ul></ul><ul><ul><ul><li>قابل اجرا بر روی هر ماشین حتی اگر بر روی آن ماشین visual Basic نصب نباشد . </li></ul></ul></ul>
  3. 4. اجرای IDE <ul><li>می توان از طرق مخلف IDE را اجرا کرد : </li></ul><ul><ul><li>از طریق منوی start </li></ul></ul><ul><ul><li>می توان یک shortcut برای آن بر روی Desktop بسازید و با double-click بر روی آن اجرا کنید . </li></ul></ul><ul><ul><li>با double-click کردن بر روی هر فایل VB </li></ul></ul>
  4. 5. انتخاب نوع پروژه <ul><li>نخستین بار که VB IDE را اجرا می کنید، از شما خواسته می شودکه نوع پروژه را انتخاب کنید </li></ul>یک application مستقل EXE ایجاد می شود
  5. 6. پنجره های IDE
  6. 7. ساخت یک برنامه ساده
  7. 8. <ul><li>Caption property </li></ul><ul><ul><li>&width </li></ul></ul><ul><ul><ul><li>Label, Frame, CommandButton, OptionButton, and CheckBox. </li></ul></ul></ul><ul><li>Font </li></ul><ul><li>Group change </li></ul><ul><li>Text property: for textbox </li></ul><ul><ul><li>Not be grouped! </li></ul></ul>
  8. 9. Naming Controls <ul><li>Name property </li></ul><ul><ul><li>All components have it </li></ul></ul><ul><ul><li>Very important </li></ul></ul><ul><ul><li>the string of characters that identifies the control in code </li></ul></ul><ul><ul><li>can't be an empty string </li></ul></ul><ul><ul><ul><li>a default name </li></ul></ul></ul><ul><ul><li>Unique </li></ul></ul><ul><ul><li>(Name) first property </li></ul></ul><ul><ul><li>independent of caption and test properties </li></ul></ul>
  9. 10. Standard naming <ul><li>use the same three-letter prefix for all the controls of a given class </li></ul>frm Form fra Frame ole OLE tmr Timer shp Shape lst ListBox lin Line cbo ComboBox fil FileListBox chk CheckBox dir DirListBox opt OptionButton drv DriveListBox pic PictureBox vsb VScrollBar lbl Label hsb HScrollBar txt TextBox dat Data cmd CommandButton Prefix Control Class Prefix Control Class
  10. 11. <ul><li>Textbox names:txtWidth, txtHeight, txtPerimeter, and txtArea </li></ul><ul><li>commandButton name:cmdEvaluate </li></ul><ul><li>Label names: lblWidth, lblHeight, lblPerimeter, and lblArea. </li></ul>
  11. 12. Moving and Resizing Controls <ul><li>Select one or more controls, and move them as a single entity using the mouse. </li></ul><ul><li>Move one or more controls with arrow keys while you press the Ctrl key. </li></ul><ul><li>Resize: by using the arrow keys while you press the Shift key. Or by dragging one of the blue handles surrounding it when it is selected. </li></ul><ul><li>Center In Form submenu of the Format menu. </li></ul><ul><li>Align submenu of the Format menu </li></ul><ul><li>Make Same Size submenu of the Format menu </li></ul><ul><li>manually modifying the Left , Top , Width , or Height properties </li></ul>
  12. 13. Setting the Tab Order <ul><li>TabIndex property </li></ul><ul><ul><li>starting with 0 </li></ul></ul><ul><ul><li>0 to the txtWidth control's TabIndex property, 1 to the txtHeight control's TabIndex property, and so on. </li></ul></ul>
  13. 14. Adding Code <ul><li>Click event </li></ul><ul><ul><ul><li>Private Sub cmdEvaluate_Click() </li></ul></ul></ul><ul><ul><ul><li>End Sub </li></ul></ul></ul>
  14. 15. <ul><ul><li>Private Sub cmdEvaluate_Click() </li></ul></ul><ul><ul><li>' Declare two floating point variables. </li></ul></ul><ul><ul><li>Dim reWidth As Double , reHeight As Double </li></ul></ul><ul><ul><li>' Extract values from input TextBox controls. reWidth = CDbl(txtWidth.Text) </li></ul></ul><ul><ul><li>reHeight =CDbl(txtHeight.Text) </li></ul></ul><ul><ul><li>' Evaluate results and assign to output text boxes. </li></ul></ul><ul><ul><li>txtPerimeter.Text = CStr((reWidth + reHeight) * 2) txtArea.Text = CStr(reWidth * reHeight) </li></ul></ul><ul><ul><li>End Sub </li></ul></ul>
  15. 16. Running and Debugging the Program <ul><li>invoking the Start command from the Run menu </li></ul><ul><li>clicking the corresponding icon on the toolbar </li></ul><ul><li>pressing the F5 key </li></ul>
  16. 17. Breakpoint <ul><li>invoking the Toggle Breakpoint command from the Debug menu </li></ul><ul><li>pressing the F9 shortcut key </li></ul><ul><li>left-clicking on the gray vertical strip that runs near the left border of the code editor window </li></ul><ul><li>highlighted in red. </li></ul><ul><ul><li>Press F8 to execute the program one statement at a time ( yellow ) </li></ul></ul><ul><ul><li>Show the value of an expression by </li></ul></ul><ul><ul><ul><li>Watch window </li></ul></ul></ul><ul><ul><ul><li>move the mouse cursor over </li></ul></ul></ul><ul><ul><li>Evaluate any expression by clicking on the Immediate window and typing ? or Print followed by the expression </li></ul></ul>
  17. 18. <ul><ul><li>You can view the values of all the local variables by selecting the Locals command from the View menu. </li></ul></ul><ul><ul><li>placing the text cursor on the statement that you want to execute next and then selecting the Set Next Statement command from the Debug menu. Or you can press the Ctrl+F9 key combination. </li></ul></ul><ul><ul><ul><li>You need this technique to skip over a piece of code that you don't want to execute or to re execute a given block of lines without restarting the program. </li></ul></ul></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×