Wednesday, May 29, 2013

Visual basic 2008 and 2010 tutorial

First Chapter:

adding a visible Control to  a Form

Start by adding a button control to the Form. do this by double - Clicking the button item in the toolbox
Visual Basic Creating a new button and places it in the upper - left corner of the form
as Shown:


Using the Properties window, set the button's properties as shown in the following list. Remember, when you view the
properties alphabetically, the Name property is listed first, so don't go looking for it down in the list, or you'll be looking
a while.

Property                         Value
--------------------------------------
Name                             btnQuit
Location                         295,40
Text                                Quit
The last visible control you need to add to the form is a PictureBox control. A PictureBox has many capabilities, but its
primary purpose is to show pictures, which is precisely what you'll use it for in this example. Add a new PictureBox
control to the form by double-clicking the PictureBox item in the toolbox, and set its properties as follows:

Picture Box
Property                         value
---------------------------------
Name                      picshowPicture
Location                  8,8
Size                         282,275
After you've made these property changes, your form will look like the one shown in below Figure. Click the Save All
button on the toolbar to save your work.

*Sorry i can't upload Any picture please don't mind*
Adding an Invisible Control to a Form
All the controls you've used so far sit on a form and have a physical appearance when a user runs the application. Not
all controls have a physical appearance, however. Such controls, called nonvisual controls (or invisible-at-runtime
controls), aren't designed for direct user interactivity. Instead, they're designed to give you, the programmer,
functionality beyond the standard features of Visual Basic.
To enable users to select a picture to display, you need to give them the ability to locate a file on their hard drives. You
might have noticed that whenever you choose to open a file from within any Windows application, the dialog box
displayed is almost always the same. It doesn't make sense to force every developer to write the code necessary to
perform standard file operations, so Microsoft has exposed the functionality via a control that you can use in your
projects. This control is called OpenFileDialog.
Display the toolbox and scroll down using the down arrow in the lower part of the toolbox until you can see the
OpenFileDialog control (it's in the Dialogs category), and then double-click it to
                                                  *Picture do not show*
control isn't placed on the form; rather, it appears in a special area below the form.
This happens because the OpenFileDialog control has no form interface to display to the user. It does have an interface
(a dialog box) that you can display as necessary, but it has nothing to display directly on a form. Select the
OpenFileDialog control, and change its properties as follows:

Property                      value
-----------------------------
Name                 ofdSelectPicture
File Name           <make emtry>
Filter                   windows Bitmap|*.BMP|JPEG files|*.JPG
Title                      Select Picture

Don't actually enter the text <make empty> for the filename; I really mean delete the default value and make this
property value empty.
The Filter property is used to limit the types of files that will be displayed in the Open File dialog box. The format for a
filter is description|filter. The text that appears before the first pipe symbol is the descriptive text of the file type,
whereas the text after the pipe symbol is the pattern to use to filter files. You can specify more than one filter type by
separating each description|filter value with another pipe symbol. Text entered into the Title property appears in the
title bar of the Open File dialog box.
The graphical interface for your Picture Viewer program is now finished. If you pinned the toolbox open, click the
pushpin in the title bar of the toolbox now to close it.

Next day I will written Second adding control lesson 
Md. Xamil Hassan Toneyy



 

No comments: