Search In Site

Showing posts with label Programming Tutorial. Show all posts
Showing posts with label Programming Tutorial. Show all posts

04 July, 2013

Attributes In Html


Core Attributes:
The four core attributes that can be used on the majority of HTML elements (although not all) are:

  •  id
  •  title
  •  class
  •  style

The id Attribute:
The id attribute can be used to uniquely identify any element within a page ( or style sheet ). There are two primary reasons that you might want to use an id attribute on an element:

  • If an element carries an id attribute as a unique identifier it is possible to identify just that element and its content.
  • If you have two elements of the same name within a Web page (or style sheet), you can use the id attribute to distinguish between elements that have the same name.
  • We will discuss style sheet in separate tutorial. For now, the id attribute could be used to distinguish between two paragraph elements, like so: <p id="html">This para explains what is HTML</p> <p id="css">This para explains what is Casecading Style Sheet</p>
  • Note that there are some special rules for the value of the id attribute, it must:
  • Begin with a letter (A.Z or a.z) and can then be followed by any number of letters, digits (0.9), hyphens, underscores, colons, and periods.
  • Remain unique within that document; no two attributes may have the same value within that HTML document.

The title Attribute:
The title attribute gives a suggested title for the element. They syntax for the title attribute is similar as explained for id attribute:
The behavior of this attribute will depend upon the element that carries it, although it is often displayed as a tooltip or while the element is loading.
For example: <h4 title="Hello HTML!">Titled Heading Tag Example</h4>
Above code will generate following result: Titled Heading Tag Example
Now try to bring your cursor over "Titled Heading Tag Example" and see the result.

The class Attribute:
The class attribute is used to associate an element with a style sheet, and specifies the class of element. You learn more about the use of the class attribute when you will learn Casecading Style Sheet (CSS). So for now you can avoid it.
The value of the attribute may also be a space-separated list of class names. For example: class="className1 className2 className3"

The style Attribute:
The style attribute allows you to specify CSS rules within the element. For example: <p style="font-family:arial; color:#FF0000;">Some text...</p>

Internationalization Attributes:
There are three internationalization attributes, which are available to most (although not all) XHTML elements.

  1.  dir
  2.  lang
  3.  xml:lang

The dir Attribute:
The dir attribute allows you to indicate to the browser the direction in which the text should flow.The dir attribute can take one of two values, as you can see in the table that follows: Value Meaning ltr Left to right (the default value)
rtl Right to left (for languages such as Hebrew or Arabic that are read right to left)
Example: <html dir=rtl> <head> <title>Display Directions</title> </head> <body> This is how IE 5 renders right-to-left directed text. </body> </html>
When dir attribute is used within the <html> tag, it determines how text will be presented within the entire document. When used within another tag, it controls the text's direction for just the content of that tag.

The lang Attribute:
The lang attribute allows you to indicate the main language used in a document, but this attribute was kept in HTML only for backwards compatibility with earlier versions of HTML. This attribute has been replaced by the xml:lang attribute in new XHTML documents.
When included within the <html> tag, the lang attribute specifies the language you've generally used within the document. When used within other tags, the lang attribute specifies the language you used within that tag's content. Ideally, the browser will use lang to better render the text for the user.
The values of the lang attribute are ISO-639 standard two-character language codes.Check HTML Language Codes: ISO 639 for a complete list of language codes.
Example: <html lang=en> <head> <title>English Language Page</title> </head> <body> This page is using English Language </body> </html>

The xml:lang Attribute:
The xml:lang attribute is the XHTML replacement for the lang attribute. The value of the xml:lang attribute should be an ISO-639 country code as mentioned in previous section.


Generic Attributes:
Here's a table of some other attributes that are readily usable with many of HTML's tags.


Attributes
Option
Function
Align
Right, Left, Center
Horizontally Aligns Tags
Valign
Top, Middle, Bottom
Vertically Aligns Tags Within An Html Element.
Bgcolor
Numeric, Hexidecimal, Rgb Values
Places A Background Color Behind An Element
Background
Url
Places An Background Image Behind An Element
Id
User Defined
Names An Element For Use With Cascading Style Sheets.
Class
User Defined
Classifies An Element For Use With Cascading Style Sheets.
Width
Numeric Value
Specifies The Width Of Tables, Images, Or Table Cells.
Height
Numeric Value
Specifies The Height Of Tables, Images, Or Table Cells.
Title
User Defined
"Pop-Up" Title For Your Elements.

Working with Excel Files in VB

The code is totally self explanatory, In the load event we're going to open the new instance of the excel library and our excel file “book1.xls” will be accessible from our code. Then we'll use Command1 to retrieve data from book1, please note that you must have some data in the excel file. Similarly Command2 is used to put/replace the data in the excel sheet cells.
'do declare these variables you need to add a reference 
'to the microsoft excel 'xx' object library. 

 'you need two text boxes and two command buttons 
'on the form, an excel file in c:\book1.xls 
 Dim xl As New Excel.Application 
Dim xlsheet As Excel.Worksheet 
Dim xlwbook As Excel.Workbook 
 Private Sub Command1_Click() 
'the benifit of placing numbers in (row, col) is that you 
'can loop through different directions if required. I could 
'have used column names like "A1" 'etc. 
    Text1.Text = xlsheet.Cells(2, 1) ' row 2 col 1 
    Text2.Text = xlsheet.Cells(2, 2) ' row 2 col 2 
'don't forget to do this or you'll not be able to open 
'book1.xls again, untill you restart you pc. 
    xl.ActiveWorkbook.Close False, "c:\book1.xls" 
    xl.Quit 
End Sub 
Private Sub Command2_Click()
   xlsheet.Cells(2, 1) = Text1.Text
   xlsheet.Cells(2, 2) = Text2.Text
   xlwbook.Save 
'don't forget to do this or you'll not be able to open 
'book1.xls again, untill you restart you pc.
   xl.ActiveWorkbook.Close False, "c:\book1.xls"
   xl.Quit
End Sub
Private Sub Form_Load()
   Set xlwbook = xl.Workbooks.Open("c:\book1.xls")
   Set xlsheet = xlwbook.Sheets.Item(1)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set xlwbook = Nothing
Set xl = Nothing
End Sub

How to Add Disappearing Effect To Forms in Visual Basic

This code demonstrates the use of SetLayeredWindowAttributes, GetWindowLong& SetWindowLong API calls. You need a timer on the form called "Timer1". Timer1 is enabled by default, so with the Load Event of the form it'll start ticking....
It'll make the form more transparent with each tick. 255 means no transparency, 0 means 100% transparent. When the form is 100% transparent Timer1 will unload it and load the "Main" form (I assume frmMain is the Main Form or any form you want to show after unloading it).
The only problem with this code is that Windows98 & ME does not support SetLayeredWindowAttributes API, so it won't work on these Operating Systems. You can use GetVersionEx API to determine the OS Version....
Copy the code below in the form you want to add the effect to.


Option Explicit
Dim Trans As Integer
Private Const LWA_COLORKEY = 1
Private Const LWA_ALPHA = 2
Private Const LWA_BOTH = 3
Private Const WS_EX_LAYERED = &H80000
Private Const GWL_EXSTYLE = -20
Private Declare Function SetLayeredWindowAttributes Lib "user32" _
(ByVal hwnd As Long, ByVal color As Long, ByVal x As Byte, _
ByVal alpha As Long) As Boolean
Private Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Sub SetTrans(hwnd As Long, Trans As Integer)
Dim Tcall As Long
Tcall = GetWindowLong(hwnd, GWL_EXSTYLE)
SetWindowLong hwnd, GWL_EXSTYLE, Tcall Or WS_EX_LAYERED
SetLayeredWindowAttributes hwnd, RGB(255, 255, 0), Trans, LWA_ALPHA
Exit Sub
End Sub
Private Sub Form_Load()
frmMain.Show
frmMain.Enabled = False
Timer1.Interval = 1
Trans = 255
SetTrans Me.hwnd, Trans
End Sub
Private Sub Timer1_Timer()
If Trans <> 0 Then
Trans = Trans - 1
End If
SetTrans Me.hwnd, Trans
If Trans = 0 Then
frmMain.Enabled = True
Unload Me
End If
End Sub

03 July, 2013

HTML Meta Tags And Attributes


HTML Meta Tags
HTML lets you specify metadata - information about a document rather than document content -in a variety of ways. The META element can be used to include name/value pairs describing properties of the HTML document, such as author, Expiry Date, a list of key words, author etc. The <meta> tag is an empty element and so does not have a closing tag, rather, <meta> tags carry information within attributes, so you need a forward slash character at the end of the element. Metadata provided by using meta tag is a very important part of the web. It can assist search engines in finding the best match when a user performs a search. Search engines will often look at any metadata attached to a page - especially keywords - and rank it higher than another page with less relevant metadata, or with no metadata at all.

Adding Meta Tags to Your Documents:

You can add metadata to your web pages by placing <meta> tags between the <head> and </head> tags. The can include the following attributes:
Name:-Name for the property. Can be anything. Examples include, keywords, description, author, revised, generator etc.
content:- Specifies the property's value.
scheme:- Specifies a scheme to use to interpret the property's value (as declared in the content attribute).
Http-equiv:- Used for http response message headers. For example http-equiv can be used to refresh the page or to set a cookie. Values include content-type, expires, refresh and set-cookie.
Let's see few important usage of Meta Tags.
Specifying Keywords:
We specify keywords which will be used by the search engine to search a web page. So using following tag you can specify important keywords related to your page. <head> <meta name="keywords" content="HTML, meta tags, metadata" /> </head>
Document Description:
This is again important information and many search engine use this information as well while searching a web page. So you should give an appropriate description of the page.
<head> <meta name="description" content="Learn about Meta Tags." /> </head>
Document Revision date:
This information tells about last time the document was updated.
<head> <meta name="revised" content="Tutorialspoint, 6/12/2006" /> </head>
Document Refreshing:
You can specify a duration after which your web page will keep refreshing. If you want your page keep refreshing after every 10 seconds then use the following syntax.
<head> <meta http-equiv="refresh" content="10" /> </head>
Page Redirection:
You can specify a page redirection using Meta Tag. Following is an example of redirecting current page to another page. You can specify a duration after which page will be redirected.
<head> <meta http-equiv="refresh" content="10; url=http://www.tutorialspoint.com" /> </head>
If you don't provide a duration then page will be redirected immediately.
Setting Cookies:
You can use Meta Tag to store cookies on client side later information can be used by then Web Server to track a site visitor.
<head> <meta http-equiv="cookie" content="userid=xyz; expires=Wednesday, 08-Aug-00 23:59:59 GMT; /> </head>
If you do not include the expiration date and time, the cookie is considered a session cookie and will be deleted when the user exits the browser.
Check PHP and Cookies tutorial for a complete detail on Cookies.
Setting Author Name:
You can set an author name in a web page using Meta Tag. See an example below:
<head> <meta name="author" content="Mahnaz Mohtashim" /> </head>
If you do not include the expiration date and time, the cookie is considered a session cookie and will be deleted when the user exits the browser.

HTML Attributes
Attributes are another important part of HTML markup. An attribute is used to define the characteristics of an element and is placed inside the element's opening tag. All attributes are made up of two parts: a name and a value:

  •  The name is the property you want to set. For example, the <font> element in the example carries an attribute whose name is face, which you can use to indicate which typeface you want the text to appear in.
  •  The value is what you want the value of the property to be. The first example was supposed to use the Arial typeface, so the value of the face attribute is Arial.

The value of the attribute should be put in double quotation marks, and is separated from the name by the equals sign. You can see that a color for the text has been specified as well as the typeface in this <font> element:
<font face="arial" color="#CC0000">
Many HTML tags have a unique set of their own attributes. These will be discussed as each tag is introduced throughout the tutorial. Right now we want to focus on a set of generic attributes that can be used with just about every HTML Tag in existence.

HTML Document: Basic Tags And Elements


Creating an HTML document is easy. To begin coding HTML you need only two things: a simple-text editor and a web browser. Notepad is the most basic of simple-text editors and you will probably code a fair amount of HTML with it. You can use our HTML Online Editor to learn HTML. Here are the simple steps to create a baisc HTML document:

  •  Open Notepad or another text editor.
  •  At the top of the page type <html>.
  •  On the next line, indent five spaces and now add the opening header tag: <head>.
  •  On the next line, indent ten spaces and type <title> </title>.
  •  Go to the next line, indent five spaces from the margin and insert the closing header tag: </head>.
  •  Five spaces in from the margin on the next line, type<body>.
  •  Now drop down another line and type the closing tag right below its mate: </body>.
  •  Finally, go to the next line and type </html>.
  •  In the File menu, choose Save As.
  •  In the Save as Type option box, choose All Files.
  •  Name the file template.htm.
  •  Click Save.

You have basic HTML document now, to see some result put the following code in title and body tags. 
<html>
<head>
<title>This is document title</title> 
</head> 
<body> <h1>This is a heading</h1> <p>Document description goes here.....</p> </body> 
</html>
Now you have created one HTML page and you can use a Web Browser to open this HTML file to see the result. Hope you understood that Web Pages are nothing but they are simple HTML files with some content which can be rendered using Web Browsers. 

HTML Document Structure:
An HTML document starts and ends with <html> and >/html> tags. These tags tell the browser that the entire document is composed in HTML. Inside these two tags, the document is split into two sections:
 The <head>...</head> elements, which contain information about the document such as title of the document, author of the document etc. Information inside this tag does not display outside.
 The <body>...</body> elements, which contain the real content of the document that you see on your screen.

HTML Tags and Elements:
HTML language is a markup language and we use many tags to markup text. In the above example you have seen <html>, <body> etc. are called HTML tags or HTML elements. Every tag consists of a tag name, sometimes followed by an optional list of tag attributes , all placed between opening and closing brackets (< and >). The simplest tag is nothing more than a name  appropriately enclosed in brackets, such as <head> and <i>. More complicated tags contain one or more attributes , which specify or modify the behaviour of the tag. According to the HTML standard, tag and attribute names are not case-sensitive. There's no difference in effect between <head>, <Head>, <HEAD>, or even <HeaD>; they are all equivalent. But with XHTML, case is important: all current standard tag and attribute names are in lowercase.

HTML is Forgiving?
A very good quality associated with all the browsers is that they would not give any error if you have not put any HTML tag or attribute properly. They will just ignore that tag or attribute and will apply only correct tags and attributes before displaying the result. We can not say, HTML is forgiving because this is just a markup language and required to format documents.

HTML Basic Tags
The basic structure for all HTML documents is simple and should include the following minimum elements or tags:
 <html> - The main container for HTML pages
 <head> - The container for page header information
 <title> - The title of the page
 <body> - The main body of the page
Remember that before an opening <html> tag, an XHTML document can contain the optional XML declaration, and it should always contain a DOCTYPE declaration indicating which version of XHTML it uses. Now we will explain each of these tags one by one. In this tutorial you will find the terms element and tag are used interchangeably.

The <html> Element:
The <html> element is the containing element for the whole HTML document. Each HTML document should have one <html> and each document should end with a closing </html> tag.
Following two elements appear as direct children of an <html> element:
 <head>
 <body>
As such, start and end HTML tags enclose all the other HTML tags you use to describe the Web page.

The <head> Element:
The <head> element is just a container for all other header elements. It should be the first thing to appear after the opening <html> tag.
Each <head> element should contain a <title> element indicating the title of the document, although it may also contain any combination of the following elements, in any order:

  •  The <base> tag is used to areate a "base" url for all links on the page. Check HTML Base tag.
  •  The <object> tag is designed to include images, JavaScript objects, Flash animations, MP3 files, QuickTime movies and other components of a page. Check HTML Object tag.
  •  The <link> tag is used to link to an external file, such as a style sheet or JavaScript file. Check HTML Link tag.
  •  The <style> tag is used to include CSS rules inside the document. Check HTML Style tag.
  •  The <script> tag is used to include JAVAScript or VBScript inside the document. Check HTML Script tag.
  •  The <meta> tag includes information about the document such as keywords and a description, which are particularly helpful for search applications. Check HTML Meta tag.

Example:
Following is the example of head tag.
 <head>
 <title>HTML Basic tags</title> <meta name="Keywords" content="HTML, Web Pages" /> <meta name="description" content="HTML Basic Tags" /> <base href="http://www.tutorialspoint.com" /> <link rel="stylesheet" type="text/css" href="tp.css" /> <script type="text/javascript"> _uacct = "UA-232293"; urchinTracker(); </script>
 </head>

The <title> Element:
You should specify a title for every page that you write inside the <title> element. This element is a child of the <head> element). It is used in several ways:
 It displays at the very top of a browser window.
 It is used as the default name for a bookmark in browsers such as IE and Netscape.  Its is used by search engines that use its content to help index pages. Therefore it is important to use a title that really describes the content of your site. The <title> element should contain only the text for the title and it may not contain any other elements. Here is the example of using title tag.
<head>
<title>HTML Basic tags</title>
</head>

The <body> Element:
The <body> element appears after the <head> element and contains the part of the Web page that you actually see in the main browser window, which is sometimes referred to as body content. A <body> element may contain anything from a couple of paragraphs under a heading to more complicated layouts containing forms and tables. Most of what you will be learning in this and the following five chapters will be written between the opening <body> tag and closing </body> tag. Here is the example of using body tag.
<body> <p>This is a paragraph tag.</p> </body>

Putting all together:
Now if we will put all these tags together, it will constitute a complete HTML document as follows:
<html>
<head>
<title>HTML Basic tags</title> <meta name="Keywords" content="HTML, Web Pages" /> <meta name="description" content="HTML Basic Tags" /> <base href="http://www.tutorialspoint.com" /> <link rel="stylesheet" type="text/css" href="tp.css" /> <script type="text/javascript"> _uacct = "UA-232293"; urchinTracker(); </script> </head> <body> <p>This is a paragraph tag.</p>
</body>
</html>

Visual Basic Statements and Expressions


Visual Basic Statements and Expressions
·  The simplest statement is the assignment statement. It consists of a variable name, followed by the assignment operator (=), followed by some
sort of expression.
Examples:
StartTime = Now
Explorer.Caption = "Captain Spaulding"
BitCount = ByteCount * 8
Energy = Mass * LIGHTSPEED ^ 2
NetWorth = Assets - Liabilities
The assignment statement stores information.
· Statements normally take up a single line with no termi nator. Statements can be stacked by using a colon (:) to separate them. Example:
StartTime = Now : EndTime = StartTime + 10
(Be careful stacking statements, especially with If/End If structures. You may not get the response you desire.)
· If a statement is very long, it may be continued to the next line using the
continuation character, an underscore (_). Example:
Months = Log(Final * IntRate / Deposit + 1) _
/ Log(1 + IntRate)
·  Comment statements begin with the keyword Rem or a single quote ('). For
example:
Rem This is a remark
' This is also a remark
x = 2 * y ' another way to write a remark or comment
You, as a programmer, should decide how much to comment your code.
Consider such factors as reuse, your audience, and the legacy of your code.

How to create PDF file from Visual Basic


How to create PDF file from Visual Basic
: example "Hello, PDF!"
This page contatins step-by-step tutorial aimed to teach you how to createPDFfile from Visual Basic application using PDF Creator Pilot library.
1)InstallPDF Creator Pilotlibrary on your computer and runVisual Basic.
You will see New Project Wizard:
2)SelectStandard EXEproject type and clickOpento create new project.
Visual Basic will generate new projectProject1and will automatically open the main form of the generated project:
3)Now we should place a button that will launchl PDF generation function. To place the button just clickCommandButtonon the controls toolbar on the left:
Now press your right mouse button and then drag the mouse so you will set the rectangle for a new control and release the mouse button to create the control. It will look like this:
4)Visual Basic will create new button control on theForm1. Double-click on the control to letVisual Basiccreate the click handler function in the project code: Visual Basicwill create new function which will be launched every time when user clicks the button:
5)Now you have to write the code that will generate PDF file using PDF Creator Pilot . 
To generate PDF document you have to do the following:
1.connect to the PDF Creator Pilot library;
2.set the filename for PDF document;
3.draw "Hello, PDF!" message on the PDF page;
4.disconnect from the library.
Here is the source code:
Private Sub Command1_Click()
’ connect to library
SetPDF = CreateObject("PDFCreatorPilot.piPDFDocument")
’ initialize PDF Engine
PDF.StartEngine "demo@demo", "demo"
’ set PDF ouput filename
PDF.FileName = "HelloPDF_VB.pdf"
PDF.AutoLaunch = True’ auto-open generated pdf document
’ start document generation
PDF.BeginDoc
’ draw "HELLO, PDF" message on the current PDF page
PDF.PDFPAGE_BeginText
PDF.PDFPAGE_SetActiveFont "Verdana", True, False, False, False, 14, 0
PDF.PDFPAGE_TextOut 10, 20, 0, "HELLO, PDF!"
PDF.PDFPAGE_EndText
’ finalize document generation
PDF.EndDoc
’ disconnect from library
SetPDF = Nothing
End Sub
This function will generate PDF document and save it as "HelloPDF_VB.PDF"file in the application’s folder.
Hint:
You can simply copy the source code from the snippet above and then paste it in theVisual Basiccode editor as it’s shown on the
screenshot below:
6)PressF5to run the application (you can also use "Run" | "Start" menu command).
Visual Basic will run the application and you will see its main form:
7)Click "Command1" button and application will generate"HelloPDF_VB.PDF"file.
If you have any PDF viewer (for example,Adobe Acrobat Reader) installed on your computer then the library will launch it to open
the generated PDF document:
You can find the source code of this example in the"\Examples\VB\"sub-folder.

01 July, 2013

Organise your first project In Visual Basic


Organising your first project
The first step is to create a project template within VB, to organise and store your work. This will consist of a menu structure with headings that will let you access the many exercises and examples you complete.
Activity 1
·  Open VisualBasic 6.0
·  Use the file menu to open a new project with a blank form.
·  Use the properties window to set
– Main.frm as the form name.
– My programs as the caption.
– BackColor to White.
– BorderStyle to Fixed Single.
– WindowState to Maximised.
·  Find the Menu icon and click on it to select it. Enter the following menu headings:
Quit
Introduction with indented subheadings of Example1 , Example2
Click OK after each menu caption and name are typed.
·  Click on Quit menu heading and enter the following code. This procedure is used to exit from running the project display and return to the design screens.
Private Sub Quit_Click()
Unload me
End
End Sub
·  Use the <F5> function key to run the application to verify that the Menu structure is correct and that the Quit procedure is free from error.
·  Use the File menu to save your work as Main.frm and (your intitials)Project1.vbp
·  Use the file menu to open a new blank form (or the properties window)
·  Set the following form properties:
form name as Welcome caption to Example1 BackColor to White BorderStyle to Fixed Single

WindowState to Maximised
·  Click on the Example 1 main menu heading and enter the following code:
Private Sub Example1_Click()
Welcome.Show
End Sub
·  Save your work and run <F5> to ensure that it is free of errors.
·  Add two labels, an image and a command button to create a welcome screen. To do this Select label icon from the toolbox. Click towards the centre-top of your form and position and resize your label as required. With the label selected, use the properties window to Change the caption to WELCOME TO VISUAL BASIC

Choose a bright back colour
Set the font (Arial, underline, alignment centred, size 24 point, forecolour blue) 
Repeat to add the Enjoy label.
Use the image icon on your toolbox to add the image to your form. Use the
properties window of the image to select a picture. Use the command Button icon to add the button. Change its caption to RETURN. Then double-click the button and add the following line of code after the Command1_Click() procedure.
– Unload Welcome
·  Use the file menu to save your work and use <F5> to run the application.
·  DON’T FORGET TO SAVE (AND BACK UP TO FLOPPY) ALL YOUR WORK.
Event handlers and scroll bars Some definitions to learn
·  An object is a thing  anything that appears on the screen. An object has a set of properties. Each property of the object has a value.
e.g. Label.Caption = “Welcome to Visual Basic” where
Label is an object

Caption is a property of label
“Welcome to Visual Basic” is a value of the Caption property.
·  Events are things that happen on the screen. Event handlers transfer data to procedures that complete the task. The results of these procedures are returned back to other screen objects, e.g. onChange onClick 
·  A procedure is a group of statements designed to perform a specific task. A
procedure attached to an object, such as a button, is a command used to make something happen, e.g.
Public Sub Command2_Click()
Text1.Text = “This is a procedure.”
End Sub

Add new form to menu
As each new example and exercise solution is to be added to your project you will need to:
·  add a new form
·  set the form properties using the properties window
·  click on the main menu icon with the main form displayed to show the menu
designer
·  add a new menu heading
·  click on the menu heading to show the procedure code
·  to the procedure code, add the statement
FormXX.Show
where FormXX is the new form name.
Activity 2
1. Open a new form and change its name to ColourChanger. Place the following objects on this form.
 A heading label2 (Caption = Colour Changer)
 3 horizontal scroll bars (Set the max value property of all three to 255)
 3 other labels (2red, 3Green, 4Blue)  a command button to quit the form (Caption = Return)  another small label5 under the button with its visible property set to false.
2. Double click each scroll bar and add the following code to its _onChange() event. Use cut and paste to make the task easier.
Label1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
Label5.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
Label1.ForeColor = RGB(255 - HScroll1.Value, 255 - HScroll2.Value, 255 -
HScroll3.Value)
Label5.ForeColor = RGB(255 - HScroll1.Value, 255 - HScroll2.Value, 255 -
HScroll3.Value)
Label5.Visible = True
Label5.Caption = “WOW!”
Label2.BackColor = RGB(HScroll1.Value, 0, 0)
Label3.BackColor = RGB(0, HScroll2.Value, 0)
Label4.BackColor = RGB)0, 0, HScroll3.Value)
3. Double click the return button and add the following code to its _onClick() event
Unload Me
4. Use the Project Explorer window to return to your main form and double click
example 2 in your menu to add the appropriate code.
5. Use <F5> function key to test your project. Save and backup.

 
Twitter Bird Gadget