A window application ---to know Dialogs - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

A window application ---to know Dialogs

Description:

Private Sub Button1_Click(...) Step 3. The script for open a file is in 's1' ... Other Dialogs ... more codes for more dialogs, such as PrintPreviewDialog etc. ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 10
Provided by: www4Comp
Category:

less

Transcript and Presenter's Notes

Title: A window application ---to know Dialogs


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

2
Open a file in textboxusing OpenFileDialog
3
Step1
  • New a VB window application. Remember the
    location must be local disk.
  • Drag a textbox from toolbox, set its
    multilinetrue and change its size.
  • Drag a button and change the textOpen
  • 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

5
Step 2 contd
  • Add
  • Private FileName1 As String
  • before
  • 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.
Write a Comment
User Comments (0)
About PowerShow.com