1 / 28

المحاضرة الثالثة

المحاضرة الثالثة. كيانات برمجة البيزك المرئي Visual Basic Programming Objects By Hitham M. Abo Bakr. In the Previous Lectures. Events in Programming VB . For Every VB Control a number of events, A programmer can implement some event by writing a code for these events

sabina
Download Presentation

المحاضرة الثالثة

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. المحاضرة الثالثة كيانات برمجة البيزك المرئي Visual Basic Programming Objects By Hitham M. Abo Bakr

  2. In the Previous Lectures

  3. Events in Programming VB • For Every VB Control a number of events, A programmer can implement some event by writing a code for these events • To Write event code, we need to open Code Window : • From View -> Code • Or double click on any control in the selected form

  4. Code Window Select Control Select events

  5. Event Procedure • Example: Label1.Caption = "Mouse coordinates are x= " & X & "y= " & Y Call event from another Event Private Sub Command1_Click() Label2.Caption = "The time now is" & Now End Sub Private Sub Form_Click() Command1_Click End Sub

  6. Menus and Toolbars Menu Toolbar Is a simple tool to access the program functionality

  7. Creating Menus To Create Menus in Visual Basic, We use Menu Editor tool “tool ->Menu Editor or Ctrl-E

  8. Build Simple Menu • We need to know what is the : • Caption • Name • Visible • Enable • Shortcut • Insert • Multilevel Menu

  9. Writing Code • The only available event for menu items is the click event • Example

  10. ToolBars To Create a toolbar we have to follow the following steps

  11. Creating Toolbar Steps

  12. Creating Toolbar Steps

  13. Creating Toolbar Steps

  14. Creating Toolbar Steps

  15. Creating Toolbar Steps

  16. Creating Toolbar Steps

  17. Creating Toolbar Steps

  18. Creating Toolbar Steps

  19. Creating Toolbar Steps Example Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) If Button.Index = 1 Then MsgBox "Button 1 clicked" ElseIfButton.Index = 2 Then MsgBox "Button 2 clicked" ElseIfButton.Index = 3 Then MsgBox "Button 3 clicked“ End If

  20. Dialog Boxes Dialog Boxes is a window for Display information for the user and receive data from him.

  21. Message Box

  22. MsgBox function return values • The MsgBox function has the following return values:

  23. Input Box Dim Response As String ' Run the Input Box. Response = InputBox("Number Entry" & vbCrLf & "from 1 and not greater than 100)", "Enter a number.") If ((Val(Response) <= 0) Or (Val(Response) > 100)) Then MsgBox ("invalid number") Else MsgBox ("Valid number") End If

  24. Built-in Dialog Boxes To deal with Built-in Dialog Boxes you have to add a new component

  25. File Dialog Boxes

  26. Printer Dialog Boxes

  27. Thanks

More Related