Halloween party ideas 2015

General Declarations:
Option Explicit
Dim Activity As String


cmdExit Click Event:
Private Sub cmdExit_Click()
End
End Sub


cmdNew Click Event:
Private Sub cmdNew_Click()
'Blank out name and reset check boxes
Dim I As Integer
txtName.Text = ""
txtAge.Text = ""
For I = 0 To 5
chkAct(I).Value = vbUnchecked
Next I


End Sub
cmdShow Click Event:
Private Sub cmdShow_Click()
Dim NoAct As Integer, I As Integer
Dim Msg As String, Pronoun As String
'Check to make sure name entered
If txtName.Text = "" Then
Exploring the Visual Basic Toolbox 3-33
MsgBox "The profile requires a name.", vbOKOnly +
vbCritical, "No Name Entered"
Exit Sub
End If
'Check to make sure age entered
If txtAge.Text = "" Then
MsgBox "The profile requires an age.", vbOKOnly +
vbCritical, "No Age Entered"
Exit Sub
End If
'Put together customer profile message
Msg = txtName.Text + " is" + Str$(txtAge.Text) + " years
old." + vbCr
If optSex(0).Value = True Then Pronoun = "He " Else
Pronoun = "She "
Msg = Msg + Pronoun + "lives in " + cboCity.Text + "." +
vbCr
Msg = Msg + Pronoun + "is a"
If optLevel(3).Value = False Then Msg = Msg + "n " Else
Msg = Msg + " "
Msg = Msg + Activity + " level athlete." + vbCr
NoAct = 0
For I = 0 To 5
If chkAct(I).Value = vbChecked Then NoAct = NoAct + 1
Next I
If NoAct > 0 Then
Msg = Msg + "Activities include:" + vbCr
For I = 0 To 5
If chkAct(I).Value = vbChecked Then Msg = Msg +
String$(10, 32) + chkAct(I).Caption + vbCr
Next I
Else
Msg = Msg + vbCr
End If
MsgBox Msg, vbOKOnly, "Customer Profile"
End Sub


Form Load Event:
Private Sub Form_Load()
'Load combo box with potential city names
cboCity.AddItem "Seattle"
cboCity.Text = "Seattle"
cboCity.AddItem "Bellevue"
cboCity.AddItem "Kirkland"
cboCity.AddItem "Everett"
cboCity.AddItem "Mercer Island"
cboCity.AddItem "Renton"
cboCity.AddItem "Issaquah"
cboCity.AddItem "Kent"
cboCity.AddItem "Bothell"
cboCity.AddItem "Tukwila"
cboCity.AddItem "West Seattle"
cboCity.AddItem "Edmonds"
cboCity.AddItem "Tacoma"
cboCity.AddItem "Federal Way"
cboCity.AddItem "Burien"
cboCity.AddItem "SeaTac"
cboCity.AddItem "Woodinville"
Activity = "intermediate"
End Sub


optLevel Click Event:
Private Sub optLevel_Click(Index As Integer)

Select Case Index
Case 0
Activity = "extreme"
Case 1
Activity = "advanced"
Case 2
Activity = "intermediate"
Case 3
Activity = "beginner"
End Select
End Sub


txtAge KeyPress Event
Private Sub txtAge_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii
= vbKeyBack Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub

HOW TO USE JAVASCRIPT TO DISPLAY ERROR MESSAGE WHEN BUTTON IS CLICKED OR TRIGERED



<!DOCTYPE html>
<html>
<body>

<p>Enter a number and click OK:</p>

<input id="id1" type="number" min="1" max="10" required>
<button onclick="myFunction()">OK</button>

<p>If the number is less than 100 or greater than 300, an error message will be displayed.</p>

<p id="demo"></p>

<script>
function myFunction() {
    var inpObj = document.getElementById("id1");
    if (inpObj.checkValidity() == false) {
        document.getElementById("demo").innerHTML = inpObj.validationMessage;
    } else {
        document.getElementById("demo").innerHTML = "Input OK";
    }
}
</script>

</body>
</html>


adOpenForwardOnly - this is the default cursor if no other is specified. This cursor allows only forward movement through a recordset

adOpenKeyset - this cursor supports forwards as well as backwards navigation. It also allows you to update a recordset and all changes will be reflected in other users recordsets. The cursor also supports bookmarking

adOpenDynamic - this cursor supports forward and backward navigation but bookmarks may not be supported (ie Access). Any changes made to data are immediately visible with no need to resynchronise the cursor with the database

adOpenStatic - this cursor uses a static copy of data from the database and therefore no changes to the data are visible and supports forward and backward navigation

The locktype parameter specifies which type of locking should be used on the cursor when editing data in a recordset

adLockReadOnly - default type used when no locktype is specified
adLockPessimistic - forces the database to lock the entire record when editing first starts
adLockOptimistic - locks records only after you call the UPDATE method of the recordset object
adLockBatchOptimistic - allows batch updating instead of updating each record individually


The Code

Private Sub Form_Load()
Dim a, b, c, det As Integer
Dim root1, root2 As Single
Dim numroot As Integer
End Sub

Private Sub new_Click()
' To set all values to zero
Coeff_a.Text = ""
Coeff_b.Text = ""
Coeff_c.Text = ""
Answers.Caption = ""
txt_root1.Visible = False
txt_root2.Visible = False
txt_root1.Text = ""
txt_root2.Text = ""
Lbl_and.Visible = False
Lbl_numroot.Caption = ""
End Sub

Private Sub Solve_Click()
a = Val(Coeff_a.Text)
b = Val(Coeff_b.Text)
c = Val(Coeff_c.Text)
'To compute the value of the determinant

det = (b ^ 2) - (4 * a * c)
If det > 0 Then
Lbl_numroot.Caption = 2
root1 = (-b + Sqr(det)) / (2 * a)
root2 = (-b - Sqr(det)) / (2 * a)
Answers.Caption = "The roots are "
Lbl_and.Visible = True
txt_root1.Visible = True
txt_root2.Visible = True
txt_root1.Text = Round(root1, 4)
txt_root2.Text = Round(root2, 4)

ElseIf det = 0 Then
root1 = (-b) / 2 * a
Lbl_numroot.Caption = 1
Answers.Caption = "The root is "
txt_root1.Visible = True
txt_root1.Text = root1
Else
Lbl_numroot.Caption = 0
Answers.Caption = "There is no root "
End If
End Sub


Visual Basic offers a rich assortment of built-in functions. The on-line help utility
will give you information on any or all of these functions and their use. Some
examples are:


Function                      Value Returned
Abs                              Absolute value of a number
Asc                              ASCII or ANSI code of a character
Chr                              Character corresponding to a given ASCII or ANSI code
Cos                              Cosine of an angle
Date                             Current date as a text string
Format                         Date or number converted to a text string
Left                              Selected left side of a text string
Len                              Number of characters in a text string
Mid                             Selected portion of a text string
Now                           Current time and date
Right                           Selected right end of a text string
Rnd                            Random number
Sin                             Sine of an angle
Sqr                            Square root of a number
Str                            Number converted to a text string
Time                         Current time as a text string
Timer                        Number of seconds elapsed since midnight
Val                            Numeric value of a given text string

ARITHETIC OPERATORS
 
Operator     Operation
^                   Exponentiation
* /                 Multiplication and division
\                    Integer division (truncates)
 %                 Mod Modulus
+ -                Addition and subutraction



CONCERTINATION

To concatentate two strings, use the & symbol or the + symbol: e.g
lblTime.Caption = "The current time is" & Format(Now, “hh:mm”)
txtSample.Text = "Hook this “ + “to this”


 COMPARISON OPERATORS

Operator        Comparison
>                     Greater than
<                     Less than
>=                   Greater than or equal to
<=                   Less than or equal to
=                     Equal to
<>                   Not equal to


LOGICAL OPERATORS

Operator          Operation
Not                   Logical not
And                  Logical and
Or                    Logical or
 

THIS IS THE CHECKBOX 
 
<input type="checkbox" id="checkboxA"> click to disable<br>
<input type="text" id="textbox_A"> 
<input type="text" id="textbox_B">
 
 
THIS IS THE JAVASCRIPT
 
<script type="text/javascript"> 
function disablefields(){ 
if (document.getElementById('checkboxA').checked == 1){ 
document.getElementById('textbox_A').disabled='disabled'; 
document.getElementById('textbox_A').value='disabled';
document.getElementById('textbox_B').disabled='disabled'; 
document.getElementById('textbox_B').value='disabled';
}else{ 
document.getElementById('textbox_A').disabled=''; 
document.getElementById('textbox_A').value='Allowed'; 
document.getElementById('textbox_B').disabled=''; 
document.getElementById('textbox_B').value='Allowed'; 
} 
} 
</script> 







THIS IS THE PROPERTY SETTINGS FOR CONTROLS
Form1:
BorderStyle 1-Fixed Single
Caption Savings Account
Name frmSavings
Label1:
Caption Monthly Deposit
Label2:
Caption Yearly Interest
Label3:
Caption Number of Months
Label4:
Caption Final Balance
Text1:
Text [Blank]
Name txtDeposit
Text2:
Text [Blank]
Name txtInterest
Text3:
Text [Blank]
Name txtMonths
Text4:
Text [Blank]
Name txtFinal
Command1:
Caption &Calculate
Name cmdCalculate
Command2:
Caption E&xit
Name cmdExit


BELOW IS THE CODE

Dim Deposit As Single
Dim Interest As Single
Dim Months As Single
Dim Final As Single

Private Sub cmdCalculate_Click ()
Dim IntRate As Single

Deposit = Val(txtDeposit.Text)
Interest = Val(txtInterest.Text)
IntRate = Interest / 1200
Months = Val(txtMonths.Text)

Final = Deposit * ((1 + IntRate) ^ Months - 1) / IntRate
txtFinal.Text = Format(Final, "#####0.00")
End Sub

Some Features of Visual Basic

  • Full set of objects - you 'draw' the application
  •  Lots of icons and pictures for your use
  • Response to mouse and keyboard actions
  •  Clipboard and printer access
  •  Full array of mathematical, string handling, and graphics functions
  • Can handle fixed and dynamic variable and control arrays
  •  Sequential and random access file support
  • Useful debugger and error-handling facilities
  •  Powerful database access tools
  • ActiveX support
  • Package & Deployment Wizard makes distributing your applications

What is Visual Basic?

Visual Basic is a tool that allows you to develop Windows (GUI - Graphic User
Interface) applications. The applications have a familiar appearance to the
user.


Visual Basic is event-driven, meaning code remains idle until called upon to
respond to some event (button pressing, menu selection, ...). Visual Basic is
governed by an event processor. Nothing happens until an event is detected.
Once an event is detected, the code corresponding to that event (event
procedure) is executed. Program control is then returned to the event processor.

WHAT IS PHP

PHP stands for Hypertext Preprocesor. PHP is a server side scripting language that is embedded in HTML.

USES OF PHP
  • PHP can handle forms, i.e. gather data from files, save data to a file, thru email you can send data, return data to the user.
  • You add, delete, modify elements within your database thru PHP.
  • Access cookies variables and set cookies.
  • Using PHP, you can restrict users to access some pages of your website.
  • It can encrypt data.

 OPTION BOX 

you can only make one selection with option box eg gender it will be either male or female.
follow the following code to learn how to use option box


  1. Select optionbox from the toolbox and draw it.
  2. Give your two option box box the same name.
  3. The compiler will ask to create an array, just click on  yes i will explain on array later on this blog.
  4. Double-click on the one of the option box.
  5. Type in this code. option1.(index). Caption
Where option is the name of your option box; in id the location of the array.

BELOW IS THE INTERFACE:



BELOW IS THE CODE FOR THE STOPWATCH:

Dim elapsed As Variant
Dim startTime As Variant
Dim today As Variant


Private Sub cmdend_Click()
Timer1.Enabled = False
today = Now
txtend.Text = Format(today, "hh:mm:ss")
elapsed = today - startTime
txtelapse.Text = Format(elapsed, "hh:mm:ss")

End Sub

Private Sub cmdstart_Click()
startTime = Now
txtstart.Text = Format(startTime, "hh:mm:ss")
Timer1.Enabled = True
End Sub

Private Sub Exit_Click()
End
End Sub


Private Sub Timer1_Timer()
today = Now
txtstart.Text = Format(today, "h:mm:ss")
End Sub


SIMPLE INTEREST CALCULATOR

Below is the interface of the calculator:




TOOL
CAPTION
NAME
Label1
Enter principal
Label1
Label2
Enter rate
Label2
Label3
Enter time
Label3
Label4

lblResult
Textbox1

txtPrincipal
Textbox2

txtRate
Textbox3

txtTime
Command1
Compute
cmdCompute
Command2
Reset
cmdReset

Below are the code:

Dim principal As Double
Dim rate As Double
Dim time As Double
Dim interest As Double

Private Sub cmdcompute_Click()
principal = Val(txtprincipal.Text)
rate = Val(txtrate.Text) / 100
time = Val(txttime.Text)

interest = (p * r * t) / 100
lblresult.Caption = interest
End Sub

Private Sub cmdreset_Click()
txtprincipal.Text = " "
txtrate.Text = " "
txttime.Text = " "
lblresult.Caption = " "
End Sub
at the first step, we declare our variable using dim and give it a data type double. double has decimal point.
In the second step, we assign our variable to text box and calculate them and also display the result in lblresult (label4)

caption is the name that appear on the form.



<doctype html>
<html>
<head>
            <title>my first web page</title>
</head>
<body>
<h1> this is my first web page</p>
                        <p>the function of this tag is paragraph</p>
                        <marquee>I love this page</marquee>
</body>
</html>

where h1 is the our heading and p is our paragraph.
copy this code to any text editor either notepad, sublime, or notepad++.
save the file name with html extension e.g web.html.
marquee in a moving text or image. once you add marquee your text will start moving.

tag is the opening and closing angle bracket < >.
element is every i.e the tag and what is between it e.g <h1>my first web</p>\

TYPE OF TAG
  1. container tag 
  2. self closing tag
container tag are tag that have opening and closing tag e.g <p> and</p >.
self closing tag are tag that stand on their own e.g <meta/>

note: every tag that is open must be close.

Some basic html tags
  1.  <h1> to <h6> headings
  2. <p> paragrah
  3. <br> break: used to break to another line
  4. <b> bold
  5. <u> under line
  6. <i> italics
  7. <em> emphasis: make text italics inline
  8. <strong> bold: used to bold  character inline
  9. <hr> horizontal: draw horizontal line
  10. <a> anchor: used when you want link to page
  11.  <sup> superscript
  12. <sub> subscript
  13. <abbr> abbreviation: used when you want abbreviate word
  14. <ul> unorder list
  15. <ol> ordered list
  16. <li> list
  17. <q> used for block quotation
  18. <blockquote> used for inline quotation
  19. <cite> indicate site
  20. <dfn> used when new word is introduced
  21. <address> used when you want to put your email address
  22. <ins> underline selected word
  23. <del> cancel unwanted text
  24. <s> cancel text that are block
  25. <dl> definition list
  26. <dt> definition terms
  27. <dd>

Basic HTML Template

<doctype html>
<html>
<head>
            <title>my first web page</title>
</head>
<body>
</body>
</html>

Doctype: tell the browser the type of document you used; in this case we you used html document
html: hyper markup language.
head: title is a child of head. there are some certain element element that only function on the head tag  e.g <script> tag,<meta> tag etc.
title: is the title of the page. the name that appear on your browser tag.
body: every other thing will be done within the body tag.
Powered by Blogger.