Today we completed the chapter 8 test.
An Array
If you have
Dim My Array(5) As DataType
this means that there is 6 elements.from 0 - 5
Dim strNames(2) As String... has 3 elements.
we assign a value to each value in the index - egs..
strNames(0) = "Rach"
strNames(1) = "Pam"
strNames(2) = "David"
Declare and populate an array
This way you can have as many or as little as you like this way.
Dim chMenuOptions() As Char = {"a", "A", "b"}
loops
Dim strNames(2) As String
Loop to populate
Another array
Dim intDinnerBookings(2) As integer
(in memory) there will be the 3 strings (strnames)
and the 3 integers (intDinnerBookings)
you can match things up via the index
Dim ItemArray (3) As String = {"x", "y", "3"}
Dim intCount As Integer - - we have declared a count integer
For intCount= 0 To ItemArray.Length - 1
lstBoxItems.Add(ItemArray(intCount))ine of code is always going to return.
Next
intCount = 0 -- x
intCount = 1 -- y
inCount = 2 -- z
length returns the number of elements, not the upperbound
sorting an array
the data in an array often is sorted for an organised display.
So could be alphebetical etc
egs. Array.Sort(strNames)
Searching an array
Sequential - is searching for each element in an array
BinarySearch - method searches a sorted array for a value using a binary search algorithm. The binary search algorithm searcehd an array by repeating dividing the search interval in half.
Sunday, August 9, 2009
Monday, August 3, 2009
Chapter 8 - exception handling
exception handling - handling errors
Try
intNumber = txtTextBox.Text
Catch ex As Exception
End Try
Try
intNumber = txtTextBox.Text
Catch ThisException As Exception<---> exception is a class
End Try
pg 592 - different exception types
Now to attempt the chapter.
Try
intNumber = txtTextBox.Text
Catch ex As Exception
End Try
Try
intNumber = txtTextBox.Text
Catch ThisException As Exception<---> exception is a class
End Try
pg 592 - different exception types
Now to attempt the chapter.
Sunday, August 2, 2009
3/8/09 - test and Chapter 8
First part of the morning we completed our test and I handed in my radar and mystic assignments.
Now we are going through chapter 8
Procedures
Public Sub MyProcedure()<--- its a method that we require furthur information for further tasks -->
'Do something
End Sub
Function
Public Function DoesItEqualTen (intNumberOne As Integer,intNumberTwo As Integer? As Boolean <-- depends on info you want to return -->
Dim blnTrueOrFalse As Boolean = False
If intNumberOne + intNumberTwo = 10
blnTrueOrFalse = True
Else
blnTrueOrFalse = False
End Function
If IsNumeric(txtTextBox.text) Then
---
End If
ublic FUnction IsNumeric(stringToLookAt) As Boolean
End FUnction
By Val - object is duplicated and passed to the function
By Ref - WHen you type in an argument, you will get a byref, pass the reference to the function
Now we are going through chapter 8
Procedures
Public Sub MyProcedure()<--- its a method that we require furthur information for further tasks -->
'Do something
End Sub
Function
Public Function DoesItEqualTen (intNumberOne As Integer,intNumberTwo As Integer? As Boolean <-- depends on info you want to return -->
Dim blnTrueOrFalse As Boolean = False
If intNumberOne + intNumberTwo = 10
blnTrueOrFalse = True
Else
blnTrueOrFalse = False
End Function
If IsNumeric(txtTextBox.text) Then
---
End If
ublic FUnction IsNumeric(stringToLookAt) As Boolean
End FUnction
By Val - object is duplicated and passed to the function
By Ref - WHen you type in an argument, you will get a byref, pass the reference to the function
Monday, July 27, 2009
Chapter 7 Assignment
Today we are working on the chapter 7 assignment.
We will be using string functions
egs. intCharacters = txtText.Length
.ToLower
.ToUpper
validation functions.
RequiredFieldValidator
IftxtFirstName.Text<>""Then
continue
End If
Now we are doing an example. this example changed the lower and upper case of the text when hitting each button and put the correct text in the label.
Now we are doing chapter 7 - Mystic Reservations.
Test on MOnday.
We will be using string functions
egs. intCharacters = txtText.Length
.ToLower
.ToUpper
validation functions.
RequiredFieldValidator
IftxtFirstName.Text<>""Then
continue
End If
Now we are doing an example. this example changed the lower and upper case of the text when hitting each button and put the correct text in the label.
Now we are doing chapter 7 - Mystic Reservations.
Test on MOnday.
Sunday, July 26, 2009
Creating web applications
Today we are looking at creating web applications.
It is much like using css, with Html codes.
Added a button.
Wrote Ronsponse.Write().. this is a method. Where ever we see a parenthsies, after a method, needs properties (further info) put info into parenthsies (brackets)
Debugging is not enabled when hitting play - hit default and then enter.
You need to leaver the server before you can continue working on the file.
We then opened a new account called twitter, my name is deannem75
Using visual studio, we were able to update our twitter page with our comments.. how exciting!
Imports Twitterizer.Framework
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnClickMe.Click
Response.Write("Here is my message to print to screen")
End Sub
Protected Sub btnButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnButton.Click
Dim TwitterUserName As String = ("Deannem75")
Dim TwitterPassword As String = ("yuiop1")
Dim MyTwitter As Twitter = New Twitter(TwitterUserName, TwitterPassword)
MyTwitter.Status.Update("learning how to create a web page via visual studio")
End Sub
End Class
These are the methods, arguaments and properties we used.
It is much like using css, with Html codes.
Added a button.
Wrote Ronsponse.Write().. this is a method. Where ever we see a parenthsies, after a method, needs properties (further info) put info into parenthsies (brackets)
Debugging is not enabled when hitting play - hit default and then enter.
You need to leaver the server before you can continue working on the file.
We then opened a new account called twitter, my name is deannem75
Using visual studio, we were able to update our twitter page with our comments.. how exciting!
Imports Twitterizer.Framework
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnClickMe.Click
Response.Write("Here is my message to print to screen")
End Sub
Protected Sub btnButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnButton.Click
Dim TwitterUserName As String = ("Deannem75")
Dim TwitterPassword As String = ("yuiop1")
Dim MyTwitter As Twitter = New Twitter(TwitterUserName, TwitterPassword)
MyTwitter.Status.Update("learning how to create a web page via visual studio")
End Sub
End Class
These are the methods, arguaments and properties we used.
Monday, July 20, 2009
week 1 - 21/07 - chapt 6 project
Do until and Do while loops
Loops can be controlled at the top or bottom
eg.
Do until 1 To 10
or
Loop Until x=10
Chapter 6 project, due next week!
Loops can be controlled at the top or bottom
eg.
Do until 1 To 10
or
Loop Until x=10
Chapter 6 project, due next week!
Subscribe to:
Posts (Atom)