University of Technology Laser & Optoelectronics Engineering Department Visual basic Lab.

Similar documents
Visual Basic

Start Visual Basic. Session 1. The User Interface Form (I/II) The Visual Basic Programming Environment. The Tool Box (I/II)

Programming with visual Basic:

GETTING STARTED WITH VBA

The Control Properties

An InputBox( ) function will display an input Box window where the user can enter a value or a text. The format is

SEE5A/ Visual Basic Unit : I - V

Visual Basic ,

Chapter 1. Block Diagram. Text .. 1

Visual Basic , ,. Caption Hello, On Off. * + +, -. 1-Arrow, , 2- Cross. - project1.vbp, 4-form1.frm.

Function: function procedures and sub procedures share the same characteristics, with

University of Technology Laser & Optoelectronics Engineering Department Visual basic Lab. LostFocus Resize System event

Universitas Sumatera Utara

Answer: C. 7. In window we can write code A. Immediate window B. Locals window C. Code editor window D. None of these. Answer: C

UNIT 2 ADVANCED FEATURES OF VISUAL BASIC 6.0

Visual Basic ,

LAMPIRAN A : LISTING PROGRAM

Computer Science 110. NOTES: module 8

GUJARAT TECHNOLOGICAL UNIVERSITY DIPLOMA IN INFORMATION TECHNOLOGY Semester: 4

Visual Basic 6 Lecture 7. The List Box:

SAULT COLLEGE OF APPLIED ARTS & TECHNOLOGY SAULT STE MARIE, ON COURSE OUTLINE

Understanding the MsgBox command in Visual Basic

Chapter 14 Sequential Files

Visual Basic. The Integrated Development Environment. Menu Bar

Visual Basic 6 Interactive Course Object-Oriented Programming

UNIT 1 INTRODUCTION TO VISUAL BASICS 6.0

2Practicals Visual Basic 6.0

File Organization and Management

Excel & Visual Basic for Applications (VBA)

PROJECT ELECTRONIC CONTROL GAS INJECTION SYSTEM

6/14/2010. VBA program units: Subroutines and Functions. Functions: Examples: Examples:

NATIONAL DIPLOMA IN COMPUTER TECHNOLOGY

Lab Manual Visual Basic 6.0

Introduction to Computer Use II

Reading and Writing Files. Keeping Data

Lookup Project. frmlookup (Name: object is a combo box, style 2); use 4 labels: 2 for phone, 2 for mail. MsgBox Function:

Visual Programming 1. What is Visual Basic? 2. What are different Editions available in VB? 3. List the various features of VB

Text box. Command button. 1. Click the tool for the control you choose to draw in this case, the text box.

Contents Introduction Getting Started Visual Basic Form Configuration Entering the VB Code

Learn Visual Basic 6.0

Index. B base classes creating, , 389 inheriting, inheriting in new classes, 390

On Railway Reservation. U G D C A Semester VI. Roll No DA

University of Technology Laser & Optoelectronics Engineering Department Visual basic Lab. List of items

SAULT COLLEGE OF APPLIED ARTS & TECHNOLOGY SAULT STE MARIE, ON COURSE OUTLINE

Control Properties. Example: Program to change background color

CMPT 110 MIDTERM OCTOBER 18, 2001

GETTING STARTED WITH MAPOBJECTS LT USING VISUAL BASIC

Type Storage Range of Values

EMPLOYEE PAYROLL SYSTEM

Using Visual FoxPro s ActiveX Controls

SMART Recorder. Record. Pause. Stop

HELP - VB TIPS. ANIMATE AN IMAGE BOX Insert a module. In this module, create a global variable: Global x

LAMPIRAN FORM 1 Universitas Sumatera Universitas Utara

Dive Into Visual C# 2008 Express

M.C.A. (Sem.-II) Examination. Ma~' CCA-2003 : Building Client Server Application Using VB. Faculty Code: 003 Subject Code:

Respond to Data Entry Events

VISUAL BASIC For Engineers & Scientists. Shahab D. Mohaghegh, Ph.D. Professor Petroleum & Natural Gas Engineering West Virginia University

Create a custom tab using Visual Basic

Visual Basic 1

LAMPIRAN LIST PROGRAM

IS 320 Spring 96 Page 1 Exam 1. Please use your own paper to answer the following questions. Point values are shown in parentheses.

CST242 Windows Forms with C# Page 1

TMS Advanced Smooth Mega Menu


Skill Area 336 Explain Essential Programming Concept. Programming Language 2 (PL2)

Lecture 2 DOS & Windows file commands by: lecturer Raya N.Ismail

Control AutoCAD on Visual Basic

Visual Basic.NET. 1. Which language is not a true object-oriented programming language?

S600 Transferring Parameters

Universitas Sumatera Utara

Lab Sheet 4.doc. Visual Basic. Lab Sheet 4: Non Object-Oriented Programming Practice

Darshan Institute of Engineering & Technology for Diploma Studies

GUI Design and Event- Driven Programming

Image Loader Program (ILP) for High Performance Controllers. Book E33 - version 1.03

Appendix E SLAMM Source Code

Using the printer with Windows 3.1

Windows Application Development Tutorial for ASNA Visual RPG 8.0 for Microsoft Visual Studio.NET 2005

variables programming statements

EEE-425 Programming Languages (2013) 1

LAMPIRAN. Universitas Sumatera Utara

SmartMail for Lotus Notes Lotus Notes Server Setup User Guide

Océ Scan Router. Océ Scan Router Administrators Guide. Scan Distribution System

Programming Concepts and Skills. Arrays continued and Functions

Rooftop Industries Pvt. Ltd.

( ) 1.,, Visual Basic,

COPYRIGHTED MATERIAL. Visual Basic: The Language. Part 1

Introduction VBA for AutoCAD (Mini Guide)

4D View. Language Reference Windows / Mac OS. 4D View D SA / 4D, Inc. All rights reserved.

Learn Visual Basic 6.0

Agenda. First Example 24/09/2009 INTRODUCTION TO VBA PROGRAMMING. First Example. The world s simplest calculator...

Contents. Some Basics Simple VBA Procedure (Macro) To Execute The Procedure Recording A Macro About Macro Recorder VBA Objects Reference

An Introduction to Visual Basic for Visual FoxPro Developers

IFA/QFN VBA Tutorial Notes prepared by Keith Wong

C:\MasterPageWeb\HAPR\docu\HAPR_VB6_version15sept06.rtf 19/10/08. HARP_VB projet en VB6

MICROSOFT EXCEL 2000 LEVEL 5 VBA PROGRAMMING INTRODUCTION

Contents. More Controls 51. Visual Basic 1. Introduction to. xiii. Modify the Project 30. Print the Project Documentation 35

Tech-Talk Using the PATROL Agent COM Server August 1999 Authored By: Eric Anderson

AVM Networks - FTP Site Statistics. Top 20 Directories Sorted by Disk Space

PROGRAMMING LANGUAGE 2 (SPM3112) NOOR AZEAN ATAN MULTIMEDIA EDUCATIONAL DEPARTMENT UNIVERSITI TEKNOLOGI MALAYSIA

ENGG1811 Computing for Engineers Week 9 Dialogues and Forms Numerical Integration

Transcription:

DriveListBox Control, DirListBox Control, and FileListBox Control CommonDialog Control 1 2 DriveListBox Control disk drive Important Properties object.drive [= drive] Drive Floppy disks "a:" or "b:", and so on Fixed media "c: [volume id]" Network connections "x: \\server\share" Change DirListBox Control Important Properties object.path [= pathname] Path Change 1

FileListBox Control object.path [= pathname] Path Important Properties Path object.file [= pathname] object.pattern [= value] File1.Pattern="*.txt" File1.Pattern="*.com;*.bat" File Pattern Form_Load : Archive, Hidden, Normal, System object.archive [= boolean] object.hidden [= boolean] object.normal [= boolean] object.system [= boolean] Form_Load File1.Hidden= Click 2

Project properties Object Property Setting Form1 Form1 Label1 AutoSize BackStyle DriveListBox1 Drive1 DirListBox1 Dir1 FileListBox1 File1 Image1 CommandButton1 Poject code Stretch Private Sub Command1_Click() Image1.Picture = LoadPicture() Label1. = "" Label1 فزاغ يصبح الشزيط بحجم الكلمت شفاف يعكس لىن الخلفيت ورائه 0 Image1 لتأخذ الصىرة حجم االطار الذي يحىيها Command1 Delete Picture Private Sub Dir1_Change() File1.Path = Dir1.Path set file path Private Sub Drive1_Change() Dir1.Path = Drive1.Drive set directory path 3

Private Sub File1_Click() Path = File1.Path If Right$(Path, 1) <> "\" Then Path = Path + "\" Label1. = Path + File1.filename Image1.Picture = LoadPicture(Label1.) A=Path + File1.filename Image1.Picture = LoadPicture(A) Private Sub Form_Load() File1.Pattern = "*.bmp" CommonDialog Components Microsoft common dialog 5.0 Ctrl+T Components Project ToolBox ShowSave ShowPrinter ShowOpen ShowFont CommonDialog Control ShowHelp ShowColor Method ShowOpen ShowSave ShowColor ShowFont ShowPrinter ShowHelp Dialog Displayed Show Open Dialog Box Show Save As Dialog Box Show Color Dialog Box Show Font Dialog Box Show Print or Print Options Dialog Box Invokes the Windows Help Engine 4

Important Properties object.cancelerror [= boolean] The settings for boolean are: False Setting Description An error is generated. (Default) No error is generated. CancelError DialogTitle object.filter [= description1 filter1 description2 filter2...] CommonDialog1.Filter="Text (*.txt) *.txt Pictures (*.bmp;*.ico) *.bmp;*.ico" Filter Filter FilterIndex object.filterindex [= number] CommonDialog1.FilterIndex=0 256 32 1 MaxFileSize File FileTitle ShowColor Color ShowPrinter FromPage, ToPage object.frompage [= number] object.topage [= number] ShowPrinter Copy ShowFont ShowPrinter Max, Min object.min [= points] object.max [= points] object.min [= number ] object.max [= number ] 5

CommonDialog ShowColor ShowOpen Project properties Object Property Setting Form1 Form1 Label1 Label1 فزاغ AutoSize يصبح الشزيط بحجم الكلمت BackStyle شفاف يعكس لىن الخلفيت ورائه 0 CommonDialog1 CancelError cmd1 CommandButton1 Command1 Open CommandButton2 Command2 Image1 Stretch 6 Color Image1 لتأخذ الصىرة حجم االطار الذي يحىيها

Poject code Private Sub command1_click() On Error GoTo errorf2 cmd1.filename = "" cmd1.filter = "BMP Files (*.bmp) *.bmp" cmd1.filterindex = 0 cmd1.showopen On Error GoTo 0 dir Filter If Dir(cmd1.filename) = "" Then disable the error MsgBox "File not Exist", vbcritical + vbmsgboxright, "Error" Exit Sub End If Label1. = cmd1.filename Image1.Picture=LoadPicture(cmd1.filename) errorf2: Private Sub command2_click() On Error GoTo aa cmd1.showcolor On Error GoTo 0 Form1.BackColor = cmd1.color aa: 7

Sequential File Binary File Random File 1 2 3 Sequential File Project properties Object Property Setting Form1 Form1 Sequential File Text Box1 Text MultiLine Text1 فزاغ ScrollBars 3 Both Text Box2 Text MultiLine ScrollBars CommandButton1 CommandButton2 Poject code Private Sub Command1_Click() filenum = FreeFile Open "example.txt" For Output As filenum Print #filenum, Text1.Text Close filenum Private Sub Command2_Click() filenum = FreeFile Open "example.txt" For Input As filenum Text2.Text = Input$(LOF(filenum) - 2, filenum) 8 Text2 فزاغ 3 Both Command1 Save Command2 Load "example.txt" "example.txt"

Close filenum CommonDialog Project properties Object Property Setting Form1 Form1 CommonDialog1 CancelError Cmd1 Image1 CommandButton1 CommandButton2 Poject code Stretch Picture Private Sub Command1_Click() On Error GoTo errof2 cmd1.filename = "" cmd1.filter = "Bmp Files (*.bmp) *.bmp" cmd1.filterindex = 0 cmd1.showopen On Error GoTo 0 If Dir(cmd1.filename) = "" Then MsgBox "File not exist", vbcritical, "Error" Exit Sub End If Image1.Picture = LoadPicture(cmd1.filename) errof2: Image1 Command1 Load Picture Command2 Delete Picture 9

Private Sub Command2_Click() Image1.Picture = LoadPicture() CommonDialog CommonDialog Project properties Object Property Setting Form1 Form1 CommonDialog1 CancelError Cmd1 TextBox1 Text MultiLine ScrollBars Text1 3 Both TextBox2 Text MultiLine ScrollBars Text2 3 Both CommandButton1 Command1 Save CommandButton2 Command2 Load Label1 Autosize Label1 Label2 Autosize Label2 Poject code Private Sub Command1_Click() On Error GoTo errof1 cmd1.filename = "" cmd1.filter = "Text Files (*.txt) *.txt" cmd1.filterindex = 0 cmd1.showsave On Error GoTo 0 If Dir(cmd1.filename) <> "" Then قا "Overwrite") y = MsgBox("Overwrite File", vbquestion + vbyesno, If y = vbno Then Exit Sub End If ف ي حال ة وجوده ساب save file Label1. = "Saved file name:" + cmd1.filename filenum = FreeFile Open cmd1.filename For Output As filenum Print #filenum, Text1.Text Close filenum 0

errof1: Private Sub Command2_Click() On Error GoTo errof2 cmd1.filename = "" cmd1.filter = "Text Files (*.txt) *.txt" cmd1.filterindex = 0 cmd1.showopen On Error GoTo 0 If Dir(cmd1.filename) = "" Then ف ي حال ة عدم وجوده "error" MsgBox "File not exist", vbcritical, Exit Sub End If Load file Label2. = "Loaded file name:" + cmd1.filename filenum = FreeFile Open cmd1.filename For Input As filenum Text2.Text = Input$(LOF(filenum) - 2, filenum) Close filenum Text2.Text = Text2.Text + "good bye" errof2: 1

2