Grasshopper, you will need to write decent documentation.
Great link :)
"The Grammar Cheat Sheet | Retinart" ( http://bit.ly/aHrIfE )
Thursday, November 11, 2010
Inserting documentation into code
1. Right click the name and select Insert Comment.
2. Type away :)
3. Your comments will now be visible in intellisense :)
2. Type away :)
3. Your comments will now be visible in intellisense :)
Wednesday, November 10, 2010
ASCII Character codes
Set TheQuoteChar to "
Dim TheQuoteChar As Char = Chr(34)
"ASCII - Wikipedia, the free encyclopedia" ( http://bit.ly/aFPbSt )
Dim TheQuoteChar As Char = Chr(34)
"ASCII - Wikipedia, the free encyclopedia" ( http://bit.ly/aFPbSt )
Tuesday, November 9, 2010
Australia Post API
Real time postage calculation fro Australia Post.
"Australia Post API for Shopping Carts" ( http://bit.ly/cclHtj )
"Australia Post eDeliver" ( http://bit.ly/auyEhw )
API at http://drc.edeliver.com.au/ratecalc.asp
Try this:
http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode=3198&Destination_Postcode=3199&Country=AU&Weight=150&Service_Type=STANDARD&Length=150&Width=15&Height=150&Quantity=1
"Australia Post API for Shopping Carts" ( http://bit.ly/cclHtj )
"Australia Post eDeliver" ( http://bit.ly/auyEhw )
API at http://drc.edeliver.com.au/ratecalc.asp
Try this:
http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode=3198&Destination_Postcode=3199&Country=AU&Weight=150&Service_Type=STANDARD&Length=150&Width=15&Height=150&Quantity=1
Friday, November 5, 2010
Working with dates and times in VB.NET
"Working with dates and times in VB.NET" ( http://bit.ly/bTodek )
Wednesday, November 3, 2010
Interfaces
Create the interface and define required behavior. An access specifier is not required.
Implement the interface in the desired class:
Now, implement the behaviors (you will have errors until you do):
Public Function Foo() As String Implements I_Test.Foo
Return "Foo"
End Function
Public Interface I_Test
Function Foo() As String
End Interface
Function Foo() As String
End Interface
Implement the interface in the desired class:
Public MustInherit Class ShoppingListItem
Implements I_Test
Implements I_Test
Now, implement the behaviors (you will have errors until you do):
Public Function Foo() As String Implements I_Test.Foo
Return "Foo"
End Function
Looping through an enum
Basic class containing the enum:
Public Class WeightUnits
Enum ItemWeightUnits
gms = 1
kgs = 2
mls = 3
ltr = 4
End Enum
End Class
An instance of the WeightUnits class is not required as the enum is shared by default.
Loop through the enum and get the NAMES of each entry in the enum.
Dim items As Array
items = System.Enum.GetNames(GetType(WeightUnits.ItemWeightUnits))
Dim item As String
For Each item In items
MsgBox(item)
Next
Loop 1
Loop 2
Loop 3
Loop 4
Loop through the enum and get the VALUES of each entry in the enum.
Dim items As Array
items = System.Enum.GetValues(GetType(WeightUnits.ItemWeightUnits))
Dim item As String
For Each item In items
MsgBox(item)
Next
Loop 1
Loop 2
Loop 3
Loop 4
Public Class WeightUnits
Enum ItemWeightUnits
gms = 1
kgs = 2
mls = 3
ltr = 4
End Enum
End Class
An instance of the WeightUnits class is not required as the enum is shared by default.
Loop through the enum and get the NAMES of each entry in the enum.
Dim items As Array
items = System.Enum.GetNames(GetType(WeightUnits.ItemWeightUnits))
Dim item As String
For Each item In items
MsgBox(item)
Next
Loop 1
Loop 2
Loop 3
Loop 4
Loop through the enum and get the VALUES of each entry in the enum.
Dim items As Array
items = System.Enum.GetValues(GetType(WeightUnits.ItemWeightUnits))
Dim item As String
For Each item In items
MsgBox(item)
Next
Loop 1
Loop 2
Loop 3
Loop 4
Labels:
Array,
Constant Values,
Enum,
For Each,
Loop,
Visual Basic
Close an Input Sequential Access File
HOW TO: Close an Input Sequential Access File
Syntax
streamReaderVariableName.Close()
Example
inFile.Close()
closes the file associated with the inFile variable.
Syntax
streamReaderVariableName.Close()
Example
inFile.Close()
closes the file associated with the inFile variable.
Use the Peek method of the StreamReader
HOW TO: Use the Peek method
Syntax
streamReaderVariableName.Peek
Example
Dim lineOfText As String
Do Until inFile.Peek = -1
lineOfText = inFile.ReadLine
MessageBox.Show(lineOfText)
Loop
reads each line of the file associated with the inFile variable, line by line. Each line (excluding the newline character) is assigned to the lineOfText variable and is then displayed in a messagebox.
Syntax
streamReaderVariableName.Peek
Example
Dim lineOfText As String
Do Until inFile.Peek = -1
lineOfText = inFile.ReadLine
MessageBox.Show(lineOfText)
Loop
reads each line of the file associated with the inFile variable, line by line. Each line (excluding the newline character) is assigned to the lineOfText variable and is then displayed in a messagebox.
Determine whether a Sequential Access File Exists
HOW TO: Determine whether a Sequential Access File Exists
Syntax
IO.File.Exists(fileName)
Example
If IO.File.Exists(“report.txt”) = True Then
determines whether the report.txt file exists in the current project’s bin\Debug folder.
Syntax
IO.File.Exists(fileName)
Example
If IO.File.Exists(“report.txt”) = True Then
determines whether the report.txt file exists in the current project’s bin\Debug folder.
Reading data from a Sequential Access File
HOW TO: Declare a StreamReader Variable
Syntax
{Dim | Private} streamReaderVariableName As IO.StreamReader
Example
Dim inFile As IO.StreamReader
declares a StreamReader variable named inFile.
HOW TO: Create a StreamReader Object
Syntax
IO.File.OpenText(fileName)
Example
inFile = IO.File.OpenText(“report.txt”)
opens the report.txt file for input, creates a StreamReader object and assigns it to the inFile variable.
HOW TO: Read data from a sequential access file
Syntax
streamReaderVariableName.ReadLine
Example
Dim message As String
message = inFile.ReadLine
reads a line of text from the file associated with the inFile variable and assigns the line, excluding the newline character, to the message variable.
Syntax
{Dim | Private} streamReaderVariableName As IO.StreamReader
Example
Dim inFile As IO.StreamReader
declares a StreamReader variable named inFile.
HOW TO: Create a StreamReader Object
Syntax
IO.File.OpenText(fileName)
Example
inFile = IO.File.OpenText(“report.txt”)
opens the report.txt file for input, creates a StreamReader object and assigns it to the inFile variable.
HOW TO: Read data from a sequential access file
Syntax
streamReaderVariableName.ReadLine
Example
Dim message As String
message = inFile.ReadLine
reads a line of text from the file associated with the inFile variable and assigns the line, excluding the newline character, to the message variable.
Labels:
File,
IO,
OpenText,
Read,
ReadLine,
Sequential Access File,
StreamReader
Close an Output Sequential Access File
HOW TO: Close an Output Sequential Access File
Syntax
streamWriterVariableName.Close()
Example
outFile.Close()
closes the file associated with the outFile variable.
Syntax
streamWriterVariableName.Close()
Example
outFile.Close()
closes the file associated with the outFile variable.
Write data to a sequential access file
HOW TO: Write data to a sequential access file using StreamWriter
Syntax
streamWriterVariableName.Write(data)
streamWriterVariableName.WriteLine(data)
Example 1
outFile.write(“Hello”)
Result
The string “Hello” is written to the file, the next character written to the file will appear immediatley after the letter “o”.
Example 2
outFile.WriteLine(“Hello”)
Result
The string “Hello” is written to the file. The next character written to the file will appear on the next line.
Syntax
streamWriterVariableName.Write(data)
streamWriterVariableName.WriteLine(data)
Example 1
outFile.write(“Hello”)
Result
The string “Hello” is written to the file, the next character written to the file will appear immediatley after the letter “o”.
Example 2
outFile.WriteLine(“Hello”)
Result
The string “Hello” is written to the file. The next character written to the file will appear on the next line.
StreamWriter object
HOW TO: Declare a StreamWriter object
Syntax
{Dim | Private} streamWriterVariableName As IO.StreamWriter
Example
Dim outFile As IO.StreamWriter
declares a StreamWriter variable named outFile
HOW TO: Create a StreamWriter object
Syntax
IO.File.method(fileName)
Methods
CreateText: opens a file for output - creates a new empty file to which data can be written. If the file already exists, the data in the file is deleted before any new data is written to it.
AppendText: opens a file for append - the new data is written after any existing data in the file. If the file does not exist, the file is created for you.
Example 1
outFile = IO.File.CreateText(“mytextfile.txt”)
opens the mytextfile.txt file for output; creates a StreamWriter object and assigns it to the outFile variable. The file is open for output.
Example 2
outFile = IO.File.AppendText(“report.txt”)
opens the report.txt file for append; creates a StreamWriter object and assigns it to the outFile variable. The file is open for append.
Syntax
{Dim | Private} streamWriterVariableName As IO.StreamWriter
Example
Dim outFile As IO.StreamWriter
declares a StreamWriter variable named outFile
HOW TO: Create a StreamWriter object
Syntax
IO.File.method(fileName)
Methods
CreateText: opens a file for output - creates a new empty file to which data can be written. If the file already exists, the data in the file is deleted before any new data is written to it.
AppendText: opens a file for append - the new data is written after any existing data in the file. If the file does not exist, the file is created for you.
Example 1
outFile = IO.File.CreateText(“mytextfile.txt”)
opens the mytextfile.txt file for output; creates a StreamWriter object and assigns it to the outFile variable. The file is open for output.
Example 2
outFile = IO.File.AppendText(“report.txt”)
opens the report.txt file for append; creates a StreamWriter object and assigns it to the outFile variable. The file is open for append.
Labels:
AppendText,
CreateText,
File,
IO,
StreamWriter,
TextFiles,
Write
Multiple Forms
If your application calls for multiple forms:
1. Create the required forms via the 'Add New Item' option.
2. Design the form as required.
3. To launch an instance of one form from another:
- Shows the form as a modal window.
1. Create the required forms via the 'Add New Item' option.
2. Design the form as required.
3. To launch an instance of one form from another:
Dim FormInstanceName as New FormClassName
FormInstanceName.ShowDialog()
- Shows the form as a modal window.
Dim FormInstanceName as New FormClassName
FormInstanceName.Show()
- Shows the form as a normal window.
Labels:
Form,
Modal,
Multiple Forms,
Show,
ShowDialog,
Window
Form.ShowDialog Method
"Shows the form as a modal dialog box."
From MSDN "Form.ShowDialog Method (System.Windows.Forms)" ( http://bit.ly/c6lYQ1 )
From MSDN "Form.ShowDialog Method (System.Windows.Forms)" ( http://bit.ly/c6lYQ1 )
Modal Windows
"Modal windows are commonly used in GUI systems to command user awareness and to display emergency states. In the web, they are often used to show images in detail."
From "Modal window - Wikipedia, the free encyclopedia" ( http://bit.ly/aWOtgT )
From "Modal window - Wikipedia, the free encyclopedia" ( http://bit.ly/aWOtgT )
Form class
"Represents a window or dialog box that makes up an application's user interface."
Go to MSDN --> http://msdn.microsoft.com/en-us/library/system.windows.forms.form.aspx
Go to MSDN --> http://msdn.microsoft.com/en-us/library/system.windows.forms.form.aspx
Tuesday, November 2, 2010
Subscribe to:
Posts (Atom)