Halloween party ideas 2015


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> 
Powered by Blogger.