Fun

Fun
Want to Play!

Monday, January 31, 2011

If Statements

An if statement that makes one decision
 Dim a As Integer
  
 Dim b As Integer
  
 a = 3
  
 b = 4
  
 If a > b Then
  
   MsgBox ("a is greater then b")
  
 Else
  
   MsgBox ("b is greater then a")
  
 End If  
if statement where it's either or
 num = Int(Text1.Text) 'Input
  
 If (num > 0) Then
  
   strReply = "You have a car!"
  
 Else
  
   strReply = "You don't have a car!"
  
 End If  

An if statement where many decisions are made
 intInput = Val(System.Console.ReadLine())
  
     If intInput = 1 Then
  
       System.Console.WriteLine("Thank you.")
  
     ElseIf intInput = 2 Then
  
       System.Console.WriteLine("That's fine.")
  
     ElseIf intInput = 3 Then
  
       System.Console.WriteLine("Too big.")
  
     Else
  
       System.Console.WriteLine("Not a number I know.")
  
     End If
  

A case statement
 Dim grade As String 
  
 Private Sub Compute_Click( ) 
  
   grade=txtgrade.Text 
  
   Select Case grade 
  
    Case "A" 
  
       result.Caption="High Distinction" 
  
    Case "A-" 
  
      result.Caption="Distinction" 
  
    Case "B" 
  
       result.Caption="Credit" 
  
    Case "C" 
  
       result.Caption="Pass" 
  
    Case Else 
  
       result.Caption="Fail" 
  
    End Select 
  
 End Sub  

Wednesday, January 26, 2011

Terms

CBool - use this function to convert to Bool data type
CByte - use this function to convert to Byte data type
CChar - use this function to convert to Char data type
CDate - use this function to convert to Date type
CDbl - use this function to convert to Double data type
CDec - use this function to convert to Decimal data type
CInt - use this function to convert to Integer data type
CLng - use this function to convert to Long data type
CObj - use this function to convert to Object type
CShort - use this function to convert to Short data type
CSng - use this function to convert to Single data type
CString - use this function to convert to String data type

.vbproj->A Visual Basic project
Form1.vb->A form's code
AssemblyInfo.VB->Information about an assembly, includes version information
.vbproj.user->Stores project user options
.sln->Solution file which stores solution's configuration
.suo-> Stores Solution user options
Form1.resx.NET->XML based resource template
bin directory->Directory for binary executables
obj directory->Directory for debugging binaries

Module: Used to hold code
Variable: A named memory location of a specific data type used to hold some value
Procedure: A callable series of statements which may or may not return a value
Sub-Procedure: A procedure with no return value
Function: A procedure with return value
Methods: A procedure built into the class
Constructor: Special method used to initialize and customize the object. It has the same name as the class
Class: An OOP class which contains data and code
Object: An instance of a class
Arrays: Programming constructs that lets us access data by numeric index
Attributes: They are the items that specify information about other items being used in VB. NET

Monday, January 24, 2011

Visual Basic

  Dim FirstName As String
  
     Dim LastName As String
  
     Dim FullName As String
  
     FirstName = "Michael "
  
     LastName = "Voller"
  
     FullName = FirstName & LastName
  
     MessageBox.Show(FullName)  


















to convert a number to a string
  Dim hi As Integer
  
     hi = 54
  
     Dim bye As String
  
     bye = hi.ToString
  
     MessageBox.Show(bye)  
I'm alive!!!