Presentation is loading. Please wait.

Presentation is loading. Please wait.

A window application ---to know Dialogs (Week 7) ~csdywang/ta.htm.

Similar presentations


Presentation on theme: "A window application ---to know Dialogs (Week 7) ~csdywang/ta.htm."— Presentation transcript:

1 A window application ---to know Dialogs (Week 7) http://www4.comp.polyu.edu.hk/ ~csdywang/ta.htm

2 Open a file in textbox using OpenFileDialog

3 Step1 New a VB window application. Remember: the location must be local disk. Drag a textbox from toolbox, set its multiline=true and change its size. Drag a button and change the text=Open Drag an OpenFileDialog. (Page down Windows Forms in toolbox and you will find it!)

4 Step2 Double click the button Add: –White italic: codes you need to add –Yellow italic: codes that already exist Imports System.IO Imports System.Drawing.Printing before Public Class Form1 Inherits System.Windows.Forms.Form Inherits System.Windows.Forms.Form

5 Step 2 contd Add Private FileName1 As String before Private Sub Button1_Click(…) Private Sub Button1_Click(…)

6 Step 3 The script for open a file is in s1. Please open it with WordPad. Copy the codes and run the program. Open a.txt file with it. Remove some codes between Try With and End With. Then, see the result again. If you have any questions about properties and methods of some classes, just use F1 to see the help.

7 Save a file Drag one more button and a SaveFileDialog Copy the codes that were written in s2. Run the program

8 ColorDialog Drag ColorDialog and one more button. The codes for button3 are in s3. Copy them. Run and change the color of shown texts.

9 Other Dialogs File all contains more codes for more dialogs, such as PrintPreviewDialog etc. If you interest, try to implement them in your application.


Download ppt "A window application ---to know Dialogs (Week 7) ~csdywang/ta.htm."

Similar presentations


Ads by Google