Aim - control statement, Visual Basic Programming

Aim:

To exhibit what is the day when the second command button is clicked and to clear the screen when the first command button is clicked. The functioning of this program is given in figure:

1) Handle the click event for the first command button.

2) Handle the click event for the second command button.

3) The Cls method clears the form.

4) Type the below coding in the first command button event handler.

Private Sub Command1_Click()

Form2.Cls

End Sub

5) Type the below coding in the second command button event handler.

Private Sub Command2_Click()

Select Case Weekday(Now)

Case vbSunday

Form2.Print "sunday"

Case vbMonday

Form2.Print "Monday"

Case vbTuesday

Form2.Print "Tuesday"

Case vbWednesday

Form2.Print "Wednesday"

Case vbThursday

Form2.Print "Thursday"

Case vbFriday

Form2.Print "Friday"

Case vbSaturday

Form2.Print "Saturday"

End Select

End Sub

1339_command buttons.png

Figure: The Resultant of clicking the command button and caption week day

The function Weekday returns the present day. If the day is Sunday vbSunday would be returned. And hence, the corresponding block would execute. Therefore the Sunday would be displayed on the screen. The Select Case and End Select denote the block.

Posted Date: 10/9/2012 8:23:12 AM | Location : United States







Related Discussions:- Aim - control statement, Assignment Help, Ask Question on Aim - control statement, Get Answer, Expert's Help, Aim - control statement Discussions

Write discussion on Aim - control statement
Your posts are moderated
Related Questions
Deleting Handlers With Class Wizard: The handler can be deleted by using the class wizard. The class wizard will delete the prototype and message map entry. The user should ma

MESSAGES The Windows-based applications do not make explicit function calls to acquire input. They wait for the system to pass the input to them. The system passes input to the

Benefits of Using DLLs: The dynamic linking has the following advantages which are as shown below: It saves memory and decreases the swapping. Many processes can use a s

i want to print number following pattern 1 12 123 1234

Executesql: The ExecuteSQL is used for executing the query on the database. The CRecordset uses the RFX mechanism to replace data between field data members of the record set

Associating Toolbars for the menu: 1. Insert the tool bar control to your form. 2. Now follow the steps to append the tool bar control to your form. 3. Then, Right Click

Assigning Values to Variables Values are assigned to variables creating an expression as follows: the variable is on the left side of the expression & the value you desire to a

The body of variable or procedure name must use mixed case and complete as essential to define its purpose. Additionally, procedure names must begin with a verb, such as CloseDialo

DEVICE CONTEXT The device context provides the essential drawing tools and the platform to draw. It helps to draw the text, shapes, lines etc. To create the device context, the

MODULE The Modules are the collection of VB statements. Modules are used to simplify the program development. To add a module to your project, choose the project tabpage, and t