diff --git a/1229.html b/1229.html new file mode 100644 index 0000000..2301539 --- /dev/null +++ b/1229.html @@ -0,0 +1,79 @@ + + + + + + + + +* Chapter 7, Page 267 -- Implementing Powerful MD5 Encryption + + + + + + +
+ +

* Chapter 7, Page 267 -- Implementing Powerful MD5 +Encryption

+ +

 

+ +

Line 21 of the sample code reads:

+ +

 

+ +

   For intCount = 0 +To OriginalHash.Length

+ +

 

+ +

Yet should in fact state:

+ +

 

+ +

   For intCount = 0 +To OriginalHash.Length - 1

+ +
+ + + + diff --git a/810.html b/810.html new file mode 100644 index 0000000..526a43e --- /dev/null +++ b/810.html @@ -0,0 +1,10 @@ +Chapter 1: Moving from VB6
+Chapter 2: Creating Great Windows Applications
+Chapter 3: Web Sites in Seconds!
+Chapter 4: Working with Data
+Chapter 5: The Lowdown on Web Services
+Chapter 6: From Microwaves to Pocket PCs: Special Project Types
+Chapter 7: More .NET Secrets
+Chapter 8: Unveiled: The Hidden .NET Language
+Chapter 9: The Quick C# Translation Guide
+Appendix \ No newline at end of file diff --git a/968.pdf b/968.pdf new file mode 100644 index 0000000..134d4b2 Binary files /dev/null and b/968.pdf differ diff --git a/969.pdf b/969.pdf new file mode 100644 index 0000000..41eb7b5 Binary files /dev/null and b/969.pdf differ diff --git a/9781590591062.jpg b/9781590591062.jpg new file mode 100644 index 0000000..bc3d52d Binary files /dev/null and b/9781590591062.jpg differ diff --git a/Ch2 - AutoComplete/AssemblyInfo.vb b/Ch2 - AutoComplete/AssemblyInfo.vb new file mode 100644 index 0000000..ef5bf7c --- /dev/null +++ b/Ch2 - AutoComplete/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch2 - AutoComplete/Ch2 - AutoComplete.sln b/Ch2 - AutoComplete/Ch2 - AutoComplete.sln new file mode 100644 index 0000000..e67923b --- /dev/null +++ b/Ch2 - AutoComplete/Ch2 - AutoComplete.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch2 - AutoComplete", "Ch2 - AutoComplete.vbproj", "{3BC7363C-4092-41AA-A847-0685F31885B4}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {3BC7363C-4092-41AA-A847-0685F31885B4}.Debug.ActiveCfg = Debug|.NET + {3BC7363C-4092-41AA-A847-0685F31885B4}.Debug.Build.0 = Debug|.NET + {3BC7363C-4092-41AA-A847-0685F31885B4}.Release.ActiveCfg = Release|.NET + {3BC7363C-4092-41AA-A847-0685F31885B4}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch2 - AutoComplete/Ch2 - AutoComplete.suo b/Ch2 - AutoComplete/Ch2 - AutoComplete.suo new file mode 100644 index 0000000..83cfbd2 Binary files /dev/null and b/Ch2 - AutoComplete/Ch2 - AutoComplete.suo differ diff --git a/Ch2 - AutoComplete/Ch2 - AutoComplete.vbproj b/Ch2 - AutoComplete/Ch2 - AutoComplete.vbproj new file mode 100644 index 0000000..c78590b --- /dev/null +++ b/Ch2 - AutoComplete/Ch2 - AutoComplete.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch2 - AutoComplete/Ch2 - AutoComplete.vbproj.user b/Ch2 - AutoComplete/Ch2 - AutoComplete.vbproj.user new file mode 100644 index 0000000..447fdc6 --- /dev/null +++ b/Ch2 - AutoComplete/Ch2 - AutoComplete.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch2 - AutoComplete/Form1.resx b/Ch2 - AutoComplete/Form1.resx new file mode 100644 index 0000000..7cd0eb0 --- /dev/null +++ b/Ch2 - AutoComplete/Form1.resx @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch2 - AutoComplete/Form1.vb b/Ch2 - AutoComplete/Form1.vb new file mode 100644 index 0000000..0bed739 --- /dev/null +++ b/Ch2 - AutoComplete/Form1.vb @@ -0,0 +1,132 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.ComboBox1 = New System.Windows.Forms.ComboBox() + Me.Label1 = New System.Windows.Forms.Label() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'ComboBox1 + ' + Me.ComboBox1.Items.AddRange(New Object() {"(all)", "Angela Lansbury", "Peter Ustinov", "Elvis Presley", "Suzanne Vega"}) + Me.ComboBox1.Location = New System.Drawing.Point(88, 88) + Me.ComboBox1.Name = "ComboBox1" + Me.ComboBox1.Size = New System.Drawing.Size(184, 21) + Me.ComboBox1.TabIndex = 0 + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(24, 24) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(320, 32) + Me.Label1.TabIndex = 1 + Me.Label1.Text = "Try typing a few characters and seeing this AutoComplete combo box in action:" + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(288, 176) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(72, 24) + Me.Button1.TabIndex = 2 + Me.Button1.Text = "OK" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(376, 213) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1, Me.Label1, Me.ComboBox1}) + Me.Name = "Form1" + Me.Text = "Save User Time: Add AutoComplete to Combo Boxes" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub ComboBox1_KeyUp(ByVal sender As Object, _ + ByVal e As System.Windows.Forms.KeyEventArgs) Handles ComboBox1.KeyUp + AutoCompleteKeyUp(ComboBox1, e) + End Sub + Private Sub ComboBox1_Leave(ByVal sender As Object, _ + ByVal e As System.EventArgs) Handles ComboBox1.Leave + AutoCompleteLeave(ComboBox1) + End Sub + + Public Sub AutoCompleteKeyUp(ByVal Combo As ComboBox, _ + ByVal e As KeyEventArgs) + Dim strTyped As String + Dim intFoundIndex As Integer + Dim objFoundItem As Object + Dim strFoundText As String + Dim strAppendText As String + ' Ignore basic selection keys + Select Case e.KeyCode + Case Keys.Back, Keys.Left, Keys.Right, Keys.Up, _ + Keys.Delete, Keys.Down, Keys.CapsLock + Return + End Select + ' Find what user has typed in list + strTyped = Combo.Text + intFoundIndex = Combo.FindString(strTyped) + ' If found... + If intFoundIndex >= 0 Then + ' Get list item (actual type depends on whether data bound) + objFoundItem = Combo.Items(intFoundIndex) + ' Use control to resolve text - in case data bound + strFoundText = Combo.GetItemText(objFoundItem) + ' Append the typed text to rest of the found string + ' (text is set twice due to a combo box quirk: + ' on certain platforms, setting just once ignores casing!) + strAppendText = strFoundText.Substring(strTyped.Length) + Combo.Text = strTyped & strAppendText + Combo.Text = strTyped & strAppendText + ' Select the appended text + Combo.SelectionStart = strTyped.Length + Combo.SelectionLength = strAppendText.Length + End If + End Sub + + Public Sub AutoCompleteLeave(ByVal Combo As ComboBox) + ' Correct casing when leaving combo + Dim intFoundIndex As Integer + intFoundIndex = Combo.FindStringExact(Combo.Text) + Combo.SelectedIndex = -1 + Combo.SelectedIndex = intFoundIndex + End Sub + + Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged + + End Sub +End Class diff --git a/Ch2 - AutoComplete/bin/Ch2 - AutoComplete.exe b/Ch2 - AutoComplete/bin/Ch2 - AutoComplete.exe new file mode 100644 index 0000000..921d5c7 Binary files /dev/null and b/Ch2 - AutoComplete/bin/Ch2 - AutoComplete.exe differ diff --git a/Ch2 - AutoComplete/bin/Ch2 - AutoComplete.pdb b/Ch2 - AutoComplete/bin/Ch2 - AutoComplete.pdb new file mode 100644 index 0000000..a64df25 Binary files /dev/null and b/Ch2 - AutoComplete/bin/Ch2 - AutoComplete.pdb differ diff --git a/Ch2 - AutoComplete/obj/Debug/Ch2 - AutoComplete.exe b/Ch2 - AutoComplete/obj/Debug/Ch2 - AutoComplete.exe new file mode 100644 index 0000000..921d5c7 Binary files /dev/null and b/Ch2 - AutoComplete/obj/Debug/Ch2 - AutoComplete.exe differ diff --git a/Ch2 - AutoComplete/obj/Debug/Ch2 - AutoComplete.pdb b/Ch2 - AutoComplete/obj/Debug/Ch2 - AutoComplete.pdb new file mode 100644 index 0000000..a64df25 Binary files /dev/null and b/Ch2 - AutoComplete/obj/Debug/Ch2 - AutoComplete.pdb differ diff --git a/Ch2 - AutoComplete/obj/Debug/Ch2___AutoComplete.Form1.resources b/Ch2 - AutoComplete/obj/Debug/Ch2___AutoComplete.Form1.resources new file mode 100644 index 0000000..c66d1b2 Binary files /dev/null and b/Ch2 - AutoComplete/obj/Debug/Ch2___AutoComplete.Form1.resources differ diff --git a/Ch2 - Drag and Drop Explorer/AssemblyInfo.vb b/Ch2 - Drag and Drop Explorer/AssemblyInfo.vb new file mode 100644 index 0000000..984f6b2 --- /dev/null +++ b/Ch2 - Drag and Drop Explorer/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch2 - Drag and Drop Explorer/Ch2 - Drag and Drop Explorer.sln b/Ch2 - Drag and Drop Explorer/Ch2 - Drag and Drop Explorer.sln new file mode 100644 index 0000000..803a751 --- /dev/null +++ b/Ch2 - Drag and Drop Explorer/Ch2 - Drag and Drop Explorer.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch2 - Drag and Drop Explorer", "Ch2 - Drag and Drop Explorer.vbproj", "{11D401EC-5BB9-42FB-83DC-6E43BA4CC42A}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {11D401EC-5BB9-42FB-83DC-6E43BA4CC42A}.Debug.ActiveCfg = Debug|.NET + {11D401EC-5BB9-42FB-83DC-6E43BA4CC42A}.Debug.Build.0 = Debug|.NET + {11D401EC-5BB9-42FB-83DC-6E43BA4CC42A}.Release.ActiveCfg = Release|.NET + {11D401EC-5BB9-42FB-83DC-6E43BA4CC42A}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch2 - Drag and Drop Explorer/Ch2 - Drag and Drop Explorer.suo b/Ch2 - Drag and Drop Explorer/Ch2 - Drag and Drop Explorer.suo new file mode 100644 index 0000000..7461347 Binary files /dev/null and b/Ch2 - Drag and Drop Explorer/Ch2 - Drag and Drop Explorer.suo differ diff --git a/Ch2 - Drag and Drop Explorer/Ch2 - Drag and Drop Explorer.vbproj b/Ch2 - Drag and Drop Explorer/Ch2 - Drag and Drop Explorer.vbproj new file mode 100644 index 0000000..abd3906 --- /dev/null +++ b/Ch2 - Drag and Drop Explorer/Ch2 - Drag and Drop Explorer.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch2 - Drag and Drop Explorer/Ch2 - Drag and Drop Explorer.vbproj.user b/Ch2 - Drag and Drop Explorer/Ch2 - Drag and Drop Explorer.vbproj.user new file mode 100644 index 0000000..447fdc6 --- /dev/null +++ b/Ch2 - Drag and Drop Explorer/Ch2 - Drag and Drop Explorer.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch2 - Drag and Drop Explorer/Form1.resx b/Ch2 - Drag and Drop Explorer/Form1.resx new file mode 100644 index 0000000..e74d68b --- /dev/null +++ b/Ch2 - Drag and Drop Explorer/Form1.resx @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + 17, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFpTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0xLjAuMzMw + MC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZT + eXN0ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMA + AAD0BwAAAk1TRnQBSQFMAwEBAAEFAQABBAEAARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgAB + KAMAAUADAAEgAwABAQEAAQgGAAEIGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwB + wAEAAfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQAD + OQEAAYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMD + AAFmAwABmQMAAcwCAAEzAwACMwIAATMBZgIAATMBmQIAATMBzAIAATMB/wIAAWYDAAFmATMCAAJmAgAB + ZgGZAgABZgHMAgABZgH/AgABmQMAAZkBMwIAAZkBZgIAApkCAAGZAcwCAAGZAf8CAAHMAwABzAEzAgAB + zAFmAgABzAGZAgACzAIAAcwB/wIAAf8BZgIAAf8BmQIAAf8BzAEAATMB/wIAAf8BAAEzAQABMwEAAWYB + AAEzAQABmQEAATMBAAHMAQABMwEAAf8BAAH/ATMCAAMzAQACMwFmAQACMwGZAQACMwHMAQACMwH/AQAB + MwFmAgABMwFmATMBAAEzAmYBAAEzAWYBmQEAATMBZgHMAQABMwFmAf8BAAEzAZkCAAEzAZkBMwEAATMB + mQFmAQABMwKZAQABMwGZAcwBAAEzAZkB/wEAATMBzAIAATMBzAEzAQABMwHMAWYBAAEzAcwBmQEAATMC + zAEAATMBzAH/AQABMwH/ATMBAAEzAf8BZgEAATMB/wGZAQABMwH/AcwBAAEzAv8BAAFmAwABZgEAATMB + AAFmAQABZgEAAWYBAAGZAQABZgEAAcwBAAFmAQAB/wEAAWYBMwIAAWYCMwEAAWYBMwFmAQABZgEzAZkB + AAFmATMBzAEAAWYBMwH/AQACZgIAAmYBMwEAA2YBAAJmAZkBAAJmAcwBAAFmAZkCAAFmAZkBMwEAAWYB + mQFmAQABZgKZAQABZgGZAcwBAAFmAZkB/wEAAWYBzAIAAWYBzAEzAQABZgHMAZkBAAFmAswBAAFmAcwB + /wEAAWYB/wIAAWYB/wEzAQABZgH/AZkBAAFmAf8BzAEAAcwBAAH/AQAB/wEAAcwBAAKZAgABmQEzAZkB + AAGZAQABmQEAAZkBAAHMAQABmQMAAZkCMwEAAZkBAAFmAQABmQEzAcwBAAGZAQAB/wEAAZkBZgIAAZkB + ZgEzAQABmQEzAWYBAAGZAWYBmQEAAZkBZgHMAQABmQEzAf8BAAKZATMBAAKZAWYBAAOZAQACmQHMAQAC + mQH/AQABmQHMAgABmQHMATMBAAFmAcwBZgEAAZkBzAGZAQABmQLMAQABmQHMAf8BAAGZAf8CAAGZAf8B + MwEAAZkBzAFmAQABmQH/AZkBAAGZAf8BzAEAAZkC/wEAAcwDAAGZAQABMwEAAcwBAAFmAQABzAEAAZkB + AAHMAQABzAEAAZkBMwIAAcwCMwEAAcwBMwFmAQABzAEzAZkBAAHMATMBzAEAAcwBMwH/AQABzAFmAgAB + zAFmATMBAAGZAmYBAAHMAWYBmQEAAcwBZgHMAQABmQFmAf8BAAHMAZkCAAHMAZkBMwEAAcwBmQFmAQAB + zAKZAQABzAGZAcwBAAHMAZkB/wEAAswCAALMATMBAALMAWYBAALMAZkBAAPMAQACzAH/AQABzAH/AgAB + zAH/ATMBAAGZAf8BZgEAAcwB/wGZAQABzAH/AcwBAAHMAv8BAAHMAQABMwEAAf8BAAFmAQAB/wEAAZkB + AAHMATMCAAH/AjMBAAH/ATMBZgEAAf8BMwGZAQAB/wEzAcwBAAH/ATMB/wEAAf8BZgIAAf8BZgEzAQAB + zAJmAQAB/wFmAZkBAAH/AWYBzAEAAcwBZgH/AQAB/wGZAgAB/wGZATMBAAH/AZkBZgEAAf8CmQEAAf8B + mQHMAQAB/wGZAf8BAAH/AcwCAAH/AcwBMwEAAf8BzAFmAQAB/wHMAZkBAAH/AswBAAH/AcwB/wEAAv8B + MwEAAcwB/wFmAQAC/wGZAQAC/wHMAQACZgH/AQABZgH/AWYBAAFmAv8BAAH/AmYBAAH/AWYB/wEAAv8B + ZgEAASEBAAGlAQADXwEAA3cBAAOGAQADlgEAA8sBAAOyAQAD1wEAA90BAAPjAQAD6gEAA/EBAAP4AQAB + 8AH7Af8BAAGkAqABAAOAAwAB/wIAAf8DAAL/AQAB/wMAAf8BAAH/AQAC/wIAA///AP8A/wD/AMsAAf8B + +zwAAf8BAAH7Af8B+wH/OQAB+wIAAf8B+wH/AfsB/wH7NgAB/wEAAf8BAAH7Af8B+wH/AfsB/wH7Af8z + AAH7AQAC/wEAAf8B+wH/AfsB/wH7Af8B+wH/MwAD/wIAAf8B+wH/AfsB/wH7Af8B+zUAA/8CAAH7Af8B + +wH/AfsB/zMAAfsB/wIAAv8BAAH/AfsB/wH7Af8B+zQAAfsB/wH7AQAC/wIAAfsB/wH7Af82AAH/AfsB + AAL/AwAB/wH7OwAB/wH7tAABQgFNAT4HAAE+AwABKAMAAUADAAEgAwABAQEAAQEGAAEBFgAD/4EAAv8G + AAL/BgAB+AH/BgAB8AE/BgAB4AEPBgABwAEDBgABgBcAAYAHAAGABwABwAcAAeAHAAH5BwAB/wHPBgAC + /wYACw== + + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch2 - Drag and Drop Explorer/Form1.vb b/Ch2 - Drag and Drop Explorer/Form1.vb new file mode 100644 index 0000000..67e4373 --- /dev/null +++ b/Ch2 - Drag and Drop Explorer/Form1.vb @@ -0,0 +1,109 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents ListView1 As System.Windows.Forms.ListView + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents ImageList1 As System.Windows.Forms.ImageList + Friend WithEvents Filename As System.Windows.Forms.ColumnHeader + Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container() + Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1)) + Me.ListView1 = New System.Windows.Forms.ListView() + Me.Label1 = New System.Windows.Forms.Label() + Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components) + Me.Filename = New System.Windows.Forms.ColumnHeader() + Me.SuspendLayout() + ' + 'ListView1 + ' + Me.ListView1.AllowDrop = True + Me.ListView1.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.Filename}) + Me.ListView1.Location = New System.Drawing.Point(16, 32) + Me.ListView1.Name = "ListView1" + Me.ListView1.Size = New System.Drawing.Size(368, 296) + Me.ListView1.SmallImageList = Me.ImageList1 + Me.ListView1.TabIndex = 0 + Me.ListView1.View = System.Windows.Forms.View.Details + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(16, 8) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(360, 16) + Me.Label1.TabIndex = 1 + Me.Label1.Text = "Drag and drop files from Explorer, or similar, onto this ListView control:" + ' + 'ImageList1 + ' + Me.ImageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit + Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16) + Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer) + Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent + ' + 'Filename + ' + Me.Filename.Text = "File / folder" + Me.Filename.Width = 300 + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(400, 342) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label1, Me.ListView1}) + Me.Name = "Form1" + Me.Text = "Drag and Drop from Windows Explorer" + Me.ResumeLayout(False) + + End Sub + +#End Region + + + Private Sub ListView1_DragOver(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListView1.DragOver + ' As dragged over, check data is file drop + If e.Data.GetDataPresent(DataFormats.FileDrop) Then + ' Display the copy (or other) icon + e.Effect = DragDropEffects.Copy + End If + End Sub + + Private Sub ListView1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListView1.DragDrop + ' Check this is a file drop + If (e.Data.GetDataPresent(DataFormats.FileDrop)) Then + ' Retrieve list of files and loop through string array + Dim strFiles() As String = e.Data.GetData(DataFormats.FileDrop) + Dim intCount As Integer + For intCount = 0 To strFiles.Length + ListView1.Items.Add(strFiles(intCount), 0) + Next + End If + End Sub +End Class diff --git a/Ch2 - Drag and Drop Explorer/bin/Ch2 - Drag and Drop Explorer.exe b/Ch2 - Drag and Drop Explorer/bin/Ch2 - Drag and Drop Explorer.exe new file mode 100644 index 0000000..638a40d Binary files /dev/null and b/Ch2 - Drag and Drop Explorer/bin/Ch2 - Drag and Drop Explorer.exe differ diff --git a/Ch2 - Drag and Drop Explorer/bin/Ch2 - Drag and Drop Explorer.pdb b/Ch2 - Drag and Drop Explorer/bin/Ch2 - Drag and Drop Explorer.pdb new file mode 100644 index 0000000..d25cde2 Binary files /dev/null and b/Ch2 - Drag and Drop Explorer/bin/Ch2 - Drag and Drop Explorer.pdb differ diff --git a/Ch2 - Drag and Drop Explorer/obj/Debug/Ch2 - Drag and Drop Explorer.exe b/Ch2 - Drag and Drop Explorer/obj/Debug/Ch2 - Drag and Drop Explorer.exe new file mode 100644 index 0000000..638a40d Binary files /dev/null and b/Ch2 - Drag and Drop Explorer/obj/Debug/Ch2 - Drag and Drop Explorer.exe differ diff --git a/Ch2 - Drag and Drop Explorer/obj/Debug/Ch2 - Drag and Drop Explorer.pdb b/Ch2 - Drag and Drop Explorer/obj/Debug/Ch2 - Drag and Drop Explorer.pdb new file mode 100644 index 0000000..d25cde2 Binary files /dev/null and b/Ch2 - Drag and Drop Explorer/obj/Debug/Ch2 - Drag and Drop Explorer.pdb differ diff --git a/Ch2 - Drag and Drop Explorer/obj/Debug/Ch2___Drag_and_Drop_Explorer.Form1.resources b/Ch2 - Drag and Drop Explorer/obj/Debug/Ch2___Drag_and_Drop_Explorer.Form1.resources new file mode 100644 index 0000000..d4739e8 Binary files /dev/null and b/Ch2 - Drag and Drop Explorer/obj/Debug/Ch2___Drag_and_Drop_Explorer.Form1.resources differ diff --git a/Ch2 - Number-Only Text Box/AssemblyInfo.vb b/Ch2 - Number-Only Text Box/AssemblyInfo.vb new file mode 100644 index 0000000..aa1a95d --- /dev/null +++ b/Ch2 - Number-Only Text Box/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch2 - Number-Only Text Box/Ch2 - Number-Only Text Box.sln b/Ch2 - Number-Only Text Box/Ch2 - Number-Only Text Box.sln new file mode 100644 index 0000000..f0ae3a9 --- /dev/null +++ b/Ch2 - Number-Only Text Box/Ch2 - Number-Only Text Box.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch2 - Number-Only Text Box", "Ch2 - Number-Only Text Box.vbproj", "{3223F9D7-22C2-46AB-B34C-239C8F4F531A}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {3223F9D7-22C2-46AB-B34C-239C8F4F531A}.Debug.ActiveCfg = Debug|.NET + {3223F9D7-22C2-46AB-B34C-239C8F4F531A}.Debug.Build.0 = Debug|.NET + {3223F9D7-22C2-46AB-B34C-239C8F4F531A}.Release.ActiveCfg = Release|.NET + {3223F9D7-22C2-46AB-B34C-239C8F4F531A}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch2 - Number-Only Text Box/Ch2 - Number-Only Text Box.suo b/Ch2 - Number-Only Text Box/Ch2 - Number-Only Text Box.suo new file mode 100644 index 0000000..2bb5ef4 Binary files /dev/null and b/Ch2 - Number-Only Text Box/Ch2 - Number-Only Text Box.suo differ diff --git a/Ch2 - Number-Only Text Box/Ch2 - Number-Only Text Box.vbproj b/Ch2 - Number-Only Text Box/Ch2 - Number-Only Text Box.vbproj new file mode 100644 index 0000000..4c959b0 --- /dev/null +++ b/Ch2 - Number-Only Text Box/Ch2 - Number-Only Text Box.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch2 - Number-Only Text Box/Ch2 - Number-Only Text Box.vbproj.user b/Ch2 - Number-Only Text Box/Ch2 - Number-Only Text Box.vbproj.user new file mode 100644 index 0000000..447fdc6 --- /dev/null +++ b/Ch2 - Number-Only Text Box/Ch2 - Number-Only Text Box.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch2 - Number-Only Text Box/Form1.resx b/Ch2 - Number-Only Text Box/Form1.resx new file mode 100644 index 0000000..ef8a086 --- /dev/null +++ b/Ch2 - Number-Only Text Box/Form1.resx @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch2 - Number-Only Text Box/Form1.vb b/Ch2 - Number-Only Text Box/Form1.vb new file mode 100644 index 0000000..0414c85 --- /dev/null +++ b/Ch2 - Number-Only Text Box/Form1.vb @@ -0,0 +1,77 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents Label1 As System.Windows.Forms.Label + Private Sub InitializeComponent() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.Label1 = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(64, 64) + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(208, 20) + Me.TextBox1.TabIndex = 0 + Me.TextBox1.Text = "" + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(8, 16) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(328, 23) + Me.Label1.TabIndex = 1 + Me.Label1.Text = "The following text box allows numbers, a colon, dash and space:" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(344, 149) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label1, Me.TextBox1}) + Me.Name = "Form1" + Me.Text = "Creating your Own Number-Only Text Box" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress + Dim strAllowableChars As String + strAllowableChars = "0123456789-: " + ' If the character they have entered isn't in our list... + If InStr(strAllowableChars, e.KeyChar.ToString) = 0 Then + ' Cancel the character + e.Handled = True + End If + End Sub +End Class diff --git a/Ch2 - Number-Only Text Box/bin/Ch2 - Number-Only Text Box.exe b/Ch2 - Number-Only Text Box/bin/Ch2 - Number-Only Text Box.exe new file mode 100644 index 0000000..29e8699 Binary files /dev/null and b/Ch2 - Number-Only Text Box/bin/Ch2 - Number-Only Text Box.exe differ diff --git a/Ch2 - Number-Only Text Box/bin/Ch2 - Number-Only Text Box.pdb b/Ch2 - Number-Only Text Box/bin/Ch2 - Number-Only Text Box.pdb new file mode 100644 index 0000000..5b5232e Binary files /dev/null and b/Ch2 - Number-Only Text Box/bin/Ch2 - Number-Only Text Box.pdb differ diff --git a/Ch2 - Number-Only Text Box/obj/Debug/Ch2 - Number-Only Text Box.exe b/Ch2 - Number-Only Text Box/obj/Debug/Ch2 - Number-Only Text Box.exe new file mode 100644 index 0000000..29e8699 Binary files /dev/null and b/Ch2 - Number-Only Text Box/obj/Debug/Ch2 - Number-Only Text Box.exe differ diff --git a/Ch2 - Number-Only Text Box/obj/Debug/Ch2 - Number-Only Text Box.pdb b/Ch2 - Number-Only Text Box/obj/Debug/Ch2 - Number-Only Text Box.pdb new file mode 100644 index 0000000..5b5232e Binary files /dev/null and b/Ch2 - Number-Only Text Box/obj/Debug/Ch2 - Number-Only Text Box.pdb differ diff --git a/Ch2 - Number-Only Text Box/obj/Debug/Ch2___Number_Only_Text_Box.Form1.resources b/Ch2 - Number-Only Text Box/obj/Debug/Ch2___Number_Only_Text_Box.Form1.resources new file mode 100644 index 0000000..20b70d2 Binary files /dev/null and b/Ch2 - Number-Only Text Box/obj/Debug/Ch2___Number_Only_Text_Box.Form1.resources differ diff --git a/Ch2 - Previous Instances/AssemblyInfo.vb b/Ch2 - Previous Instances/AssemblyInfo.vb new file mode 100644 index 0000000..e03b0b3 --- /dev/null +++ b/Ch2 - Previous Instances/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch2 - Previous Instances/Ch2 - Previous Instances.sln b/Ch2 - Previous Instances/Ch2 - Previous Instances.sln new file mode 100644 index 0000000..02663cb --- /dev/null +++ b/Ch2 - Previous Instances/Ch2 - Previous Instances.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch2 - Previous Instances", "Ch2 - Previous Instances.vbproj", "{EFB32147-DA7D-4F6D-81E0-277CB64C4406}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {EFB32147-DA7D-4F6D-81E0-277CB64C4406}.Debug.ActiveCfg = Debug|.NET + {EFB32147-DA7D-4F6D-81E0-277CB64C4406}.Debug.Build.0 = Debug|.NET + {EFB32147-DA7D-4F6D-81E0-277CB64C4406}.Release.ActiveCfg = Release|.NET + {EFB32147-DA7D-4F6D-81E0-277CB64C4406}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch2 - Previous Instances/Ch2 - Previous Instances.suo b/Ch2 - Previous Instances/Ch2 - Previous Instances.suo new file mode 100644 index 0000000..2fbbd40 Binary files /dev/null and b/Ch2 - Previous Instances/Ch2 - Previous Instances.suo differ diff --git a/Ch2 - Previous Instances/Ch2 - Previous Instances.vbproj b/Ch2 - Previous Instances/Ch2 - Previous Instances.vbproj new file mode 100644 index 0000000..250db1b --- /dev/null +++ b/Ch2 - Previous Instances/Ch2 - Previous Instances.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch2 - Previous Instances/Ch2 - Previous Instances.vbproj.user b/Ch2 - Previous Instances/Ch2 - Previous Instances.vbproj.user new file mode 100644 index 0000000..447fdc6 --- /dev/null +++ b/Ch2 - Previous Instances/Ch2 - Previous Instances.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch2 - Previous Instances/Form1.resx b/Ch2 - Previous Instances/Form1.resx new file mode 100644 index 0000000..ed1cd0f --- /dev/null +++ b/Ch2 - Previous Instances/Form1.resx @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch2 - Previous Instances/Form1.vb b/Ch2 - Previous Instances/Form1.vb new file mode 100644 index 0000000..fc4e742 --- /dev/null +++ b/Ch2 - Previous Instances/Form1.vb @@ -0,0 +1,83 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Label1 As System.Windows.Forms.Label + Private Sub InitializeComponent() + Me.Label1 = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(16, 16) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(296, 23) + Me.Label1.TabIndex = 0 + Me.Label1.Text = "Run the final .EXE version of this application." + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(360, 157) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label1}) + Me.Name = "Form1" + Me.Text = "Form1" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + If PrevInstance() = True Then + ' Get all previous instances + Dim Processes() As Process + Processes = Diagnostics.Process.GetProcessesByName( _ + Diagnostics.Process.GetCurrentProcess.ProcessName) + ' Display message + MessageBox.Show("A previous instance of this program is " & _ + "running. It's about to be activated...") + ' Activate the first instance + AppActivate(Processes(0).Id) + ' Exit the current instance + Application.Exit() + End If + End Sub + + Public Function PrevInstance() As Boolean + If Diagnostics.Process.GetProcessesByName _ + (Diagnostics.Process.GetCurrentProcess.ProcessName).Length > 1 Then + Return True + Else + Return False + End If + End Function + +End Class diff --git a/Ch2 - Previous Instances/bin/Ch2 - Instance.exe b/Ch2 - Previous Instances/bin/Ch2 - Instance.exe new file mode 100644 index 0000000..1bb56ee Binary files /dev/null and b/Ch2 - Previous Instances/bin/Ch2 - Instance.exe differ diff --git a/Ch2 - Previous Instances/bin/Ch2 - Instance.pdb b/Ch2 - Previous Instances/bin/Ch2 - Instance.pdb new file mode 100644 index 0000000..8e347fc Binary files /dev/null and b/Ch2 - Previous Instances/bin/Ch2 - Instance.pdb differ diff --git a/Ch2 - Previous Instances/obj/Debug/Ch2 - Instance.exe b/Ch2 - Previous Instances/obj/Debug/Ch2 - Instance.exe new file mode 100644 index 0000000..1bb56ee Binary files /dev/null and b/Ch2 - Previous Instances/obj/Debug/Ch2 - Instance.exe differ diff --git a/Ch2 - Previous Instances/obj/Debug/Ch2 - Instance.pdb b/Ch2 - Previous Instances/obj/Debug/Ch2 - Instance.pdb new file mode 100644 index 0000000..8e347fc Binary files /dev/null and b/Ch2 - Previous Instances/obj/Debug/Ch2 - Instance.pdb differ diff --git a/Ch2 - Previous Instances/obj/Debug/Ch2 - PrevInstance.exe b/Ch2 - Previous Instances/obj/Debug/Ch2 - PrevInstance.exe new file mode 100644 index 0000000..86fc703 Binary files /dev/null and b/Ch2 - Previous Instances/obj/Debug/Ch2 - PrevInstance.exe differ diff --git a/Ch2 - Previous Instances/obj/Debug/Ch2 - PrevInstance.pdb b/Ch2 - Previous Instances/obj/Debug/Ch2 - PrevInstance.pdb new file mode 100644 index 0000000..84f3522 Binary files /dev/null and b/Ch2 - Previous Instances/obj/Debug/Ch2 - PrevInstance.pdb differ diff --git a/Ch2 - Previous Instances/obj/Debug/Ch2 - Previous Instances.exe b/Ch2 - Previous Instances/obj/Debug/Ch2 - Previous Instances.exe new file mode 100644 index 0000000..5124e5a Binary files /dev/null and b/Ch2 - Previous Instances/obj/Debug/Ch2 - Previous Instances.exe differ diff --git a/Ch2 - Previous Instances/obj/Debug/Ch2 - Previous Instances.pdb b/Ch2 - Previous Instances/obj/Debug/Ch2 - Previous Instances.pdb new file mode 100644 index 0000000..bb42e08 Binary files /dev/null and b/Ch2 - Previous Instances/obj/Debug/Ch2 - Previous Instances.pdb differ diff --git a/Ch2 - Previous Instances/obj/Debug/Ch2___Previous_Instances.Form1.resources b/Ch2 - Previous Instances/obj/Debug/Ch2___Previous_Instances.Form1.resources new file mode 100644 index 0000000..09dc0fa Binary files /dev/null and b/Ch2 - Previous Instances/obj/Debug/Ch2___Previous_Instances.Form1.resources differ diff --git a/Ch2 - Print Form/AssemblyInfo.vb b/Ch2 - Print Form/AssemblyInfo.vb new file mode 100644 index 0000000..d9a78d7 --- /dev/null +++ b/Ch2 - Print Form/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch2 - Print Form/Ch2 - Print Form.sln b/Ch2 - Print Form/Ch2 - Print Form.sln new file mode 100644 index 0000000..f66e00c --- /dev/null +++ b/Ch2 - Print Form/Ch2 - Print Form.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch2 - Print Form", "Ch2 - Print Form.vbproj", "{92776199-879F-4641-BBD9-B2426D63F111}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {92776199-879F-4641-BBD9-B2426D63F111}.Debug.ActiveCfg = Debug|.NET + {92776199-879F-4641-BBD9-B2426D63F111}.Debug.Build.0 = Debug|.NET + {92776199-879F-4641-BBD9-B2426D63F111}.Release.ActiveCfg = Release|.NET + {92776199-879F-4641-BBD9-B2426D63F111}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch2 - Print Form/Ch2 - Print Form.suo b/Ch2 - Print Form/Ch2 - Print Form.suo new file mode 100644 index 0000000..f90595b Binary files /dev/null and b/Ch2 - Print Form/Ch2 - Print Form.suo differ diff --git a/Ch2 - Print Form/Ch2 - Print Form.vbproj b/Ch2 - Print Form/Ch2 - Print Form.vbproj new file mode 100644 index 0000000..1483d39 --- /dev/null +++ b/Ch2 - Print Form/Ch2 - Print Form.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch2 - Print Form/Ch2 - Print Form.vbproj.user b/Ch2 - Print Form/Ch2 - Print Form.vbproj.user new file mode 100644 index 0000000..447fdc6 --- /dev/null +++ b/Ch2 - Print Form/Ch2 - Print Form.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch2 - Print Form/Form1.resx b/Ch2 - Print Form/Form1.resx new file mode 100644 index 0000000..61f63af --- /dev/null +++ b/Ch2 - Print Form/Form1.resx @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + Assembly + + + Assembly + + + 148, 17 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch2 - Print Form/Form1.vb b/Ch2 - Print Form/Form1.vb new file mode 100644 index 0000000..59a86fd --- /dev/null +++ b/Ch2 - Print Form/Form1.vb @@ -0,0 +1,214 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents MyPrintDocument As System.Drawing.Printing.PrintDocument + Friend WithEvents MyPrintDialog As System.Windows.Forms.PrintDialog + Friend WithEvents MyPictureBox As System.Windows.Forms.PictureBox + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid + Friend WithEvents MonthCalendar1 As System.Windows.Forms.MonthCalendar + Friend WithEvents Label2 As System.Windows.Forms.Label + Friend WithEvents Label3 As System.Windows.Forms.Label + Friend WithEvents MonthCalendar2 As System.Windows.Forms.MonthCalendar + Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel + Private Sub InitializeComponent() + Me.MyPrintDocument = New System.Drawing.Printing.PrintDocument() + Me.MyPrintDialog = New System.Windows.Forms.PrintDialog() + Me.MyPictureBox = New System.Windows.Forms.PictureBox() + Me.Label1 = New System.Windows.Forms.Label() + Me.DataGrid1 = New System.Windows.Forms.DataGrid() + Me.MonthCalendar1 = New System.Windows.Forms.MonthCalendar() + Me.Label2 = New System.Windows.Forms.Label() + Me.Label3 = New System.Windows.Forms.Label() + Me.MonthCalendar2 = New System.Windows.Forms.MonthCalendar() + Me.LinkLabel1 = New System.Windows.Forms.LinkLabel() + CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'MyPrintDocument + ' + ' + 'MyPictureBox + ' + Me.MyPictureBox.Location = New System.Drawing.Point(296, 16) + Me.MyPictureBox.Name = "MyPictureBox" + Me.MyPictureBox.Size = New System.Drawing.Size(16, 16) + Me.MyPictureBox.TabIndex = 0 + Me.MyPictureBox.TabStop = False + Me.MyPictureBox.Visible = False + ' + 'Label1 + ' + Me.Label1.Font = New System.Drawing.Font("Tahoma", 8.25!, (System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline), System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label1.Location = New System.Drawing.Point(16, 16) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(224, 23) + Me.Label1.TabIndex = 1 + Me.Label1.Text = "Sales Summary for May, 2004" + ' + 'DataGrid1 + ' + Me.DataGrid1.AlternatingBackColor = System.Drawing.Color.GhostWhite + Me.DataGrid1.BackColor = System.Drawing.Color.GhostWhite + Me.DataGrid1.BackgroundColor = System.Drawing.Color.Lavender + Me.DataGrid1.BorderStyle = System.Windows.Forms.BorderStyle.None + Me.DataGrid1.CaptionBackColor = System.Drawing.Color.RoyalBlue + Me.DataGrid1.CaptionForeColor = System.Drawing.Color.White + Me.DataGrid1.DataMember = "" + Me.DataGrid1.FlatMode = True + Me.DataGrid1.Font = New System.Drawing.Font("Tahoma", 8.0!) + Me.DataGrid1.ForeColor = System.Drawing.Color.MidnightBlue + Me.DataGrid1.GridLineColor = System.Drawing.Color.RoyalBlue + Me.DataGrid1.HeaderBackColor = System.Drawing.Color.MidnightBlue + Me.DataGrid1.HeaderFont = New System.Drawing.Font("Tahoma", 8.0!, System.Drawing.FontStyle.Bold) + Me.DataGrid1.HeaderForeColor = System.Drawing.Color.Lavender + Me.DataGrid1.LinkColor = System.Drawing.Color.Teal + Me.DataGrid1.Location = New System.Drawing.Point(16, 48) + Me.DataGrid1.Name = "DataGrid1" + Me.DataGrid1.ParentRowsBackColor = System.Drawing.Color.Lavender + Me.DataGrid1.ParentRowsForeColor = System.Drawing.Color.MidnightBlue + Me.DataGrid1.SelectionBackColor = System.Drawing.Color.Teal + Me.DataGrid1.SelectionForeColor = System.Drawing.Color.PaleGreen + Me.DataGrid1.Size = New System.Drawing.Size(392, 368) + Me.DataGrid1.TabIndex = 2 + ' + 'MonthCalendar1 + ' + Me.MonthCalendar1.Location = New System.Drawing.Point(432, 256) + Me.MonthCalendar1.Name = "MonthCalendar1" + Me.MonthCalendar1.SelectionRange = New System.Windows.Forms.SelectionRange(New Date(2003, 3, 31, 0, 0, 0, 0), New Date(2003, 4, 6, 0, 0, 0, 0)) + Me.MonthCalendar1.ShowToday = False + Me.MonthCalendar1.ShowTodayCircle = False + Me.MonthCalendar1.TabIndex = 3 + Me.MonthCalendar1.TodayDate = New Date(2004, 5, 31, 0, 0, 0, 0) + ' + 'Label2 + ' + Me.Label2.Font = New System.Drawing.Font("Tahoma", 8.25!, (System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline), System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label2.Location = New System.Drawing.Point(432, 224) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(200, 23) + Me.Label2.TabIndex = 4 + Me.Label2.Text = "Best sales week for 2004:" + ' + 'Label3 + ' + Me.Label3.Font = New System.Drawing.Font("Tahoma", 8.25!, (System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline), System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label3.Location = New System.Drawing.Point(432, 16) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(200, 23) + Me.Label3.TabIndex = 6 + Me.Label3.Text = "Best sales week for May, 2004:" + ' + 'MonthCalendar2 + ' + Me.MonthCalendar2.Location = New System.Drawing.Point(432, 48) + Me.MonthCalendar2.Name = "MonthCalendar2" + Me.MonthCalendar2.SelectionRange = New System.Windows.Forms.SelectionRange(New Date(2004, 5, 17, 0, 0, 0, 0), New Date(2004, 5, 23, 0, 0, 0, 0)) + Me.MonthCalendar2.TabIndex = 5 + Me.MonthCalendar2.TodayDate = New Date(2004, 5, 31, 0, 0, 0, 0) + ' + 'LinkLabel1 + ' + Me.LinkLabel1.Location = New System.Drawing.Point(368, 16) + Me.LinkLabel1.Name = "LinkLabel1" + Me.LinkLabel1.Size = New System.Drawing.Size(32, 16) + Me.LinkLabel1.TabIndex = 7 + Me.LinkLabel1.TabStop = True + Me.LinkLabel1.Text = "Print" + Me.LinkLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleRight + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(648, 430) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.LinkLabel1, Me.Label3, Me.MonthCalendar2, Me.Label2, Me.MonthCalendar1, Me.DataGrid1, Me.Label1, Me.MyPictureBox}) + Me.Name = "Form1" + Me.Text = "The Secret Rebirth of .PrintForm" + CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + + End Sub + +#End Region + + Public Sub PrintForm() + ' Takes a screenshot, then initiates the print + GrabScreen() + MyPrintDialog.Document = MyPrintDocument + If MyPrintDialog.ShowDialog = DialogResult.OK Then + MyPrintDocument.Print() + End If + End Sub + + ' API call to help generate final screenshot + Private Declare Auto Function BitBlt Lib "gdi32.dll" (ByVal hdcDest As IntPtr, ByVal _ + nXDest As Integer, ByVal nYDest As Integer, ByVal nWidth As Integer, ByVal nHeight _ + As Integer, ByVal hdcSrc As IntPtr, ByVal nXSrc As Integer, _ + ByVal nYSrc As Integer, ByVal dwRop As System.Int32) As Boolean + ' Variable to store screenshot + Private bmpScreenshot As Bitmap + + Private Sub GrabScreen() + ' Performs a screenshot, saving results to bmpScreenshot + Dim objGraphics As Graphics = Me.CreateGraphics + Dim objSize As Size = Me.Size + Const SRCCOPY As Integer = &HCC0020 + + bmpScreenshot = New Bitmap(objSize.Width, objSize.Height, objGraphics) + Dim objGraphics2 As Graphics = objGraphics.FromImage(bmpScreenshot) + Dim deviceContext1 As IntPtr = objGraphics.GetHdc + Dim deviceContext2 As IntPtr = objGraphics2.GetHdc + + BitBlt(deviceContext2, 0, 0, Me.ClientRectangle.Width, _ + Me.ClientRectangle.Height, deviceContext1, 0, 0, SRCCOPY) + objGraphics.ReleaseHdc(deviceContext1) + objGraphics2.ReleaseHdc(deviceContext2) + End Sub + + Private Sub MyPrintDocument_PrintPage(ByVal sender As System.Object, _ + ByVal e As System.Drawing.Printing.PrintPageEventArgs) _ + Handles MyPrintDocument.PrintPage + ' Method that handles the printing + Dim objImageToPrint As Graphics = e.Graphics + objImageToPrint.DrawImage(bmpScreenshot, 0, 0) + bmpScreenshot.Dispose() + objImageToPrint.Dispose() + e.HasMorePages = False + End Sub + + Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked + LinkLabel1.Visible = False + PrintForm() + LinkLabel1.Visible = True + End Sub + +End Class diff --git a/Ch2 - Print Form/bin/Ch2 - Print Form.exe b/Ch2 - Print Form/bin/Ch2 - Print Form.exe new file mode 100644 index 0000000..fe9e7cb Binary files /dev/null and b/Ch2 - Print Form/bin/Ch2 - Print Form.exe differ diff --git a/Ch2 - Print Form/bin/Ch2 - Print Form.pdb b/Ch2 - Print Form/bin/Ch2 - Print Form.pdb new file mode 100644 index 0000000..4db5e63 Binary files /dev/null and b/Ch2 - Print Form/bin/Ch2 - Print Form.pdb differ diff --git a/Ch2 - Print Form/obj/Debug/Ch2 - Print Form.exe b/Ch2 - Print Form/obj/Debug/Ch2 - Print Form.exe new file mode 100644 index 0000000..fe9e7cb Binary files /dev/null and b/Ch2 - Print Form/obj/Debug/Ch2 - Print Form.exe differ diff --git a/Ch2 - Print Form/obj/Debug/Ch2 - Print Form.pdb b/Ch2 - Print Form/obj/Debug/Ch2 - Print Form.pdb new file mode 100644 index 0000000..4db5e63 Binary files /dev/null and b/Ch2 - Print Form/obj/Debug/Ch2 - Print Form.pdb differ diff --git a/Ch2 - Print Form/obj/Debug/Ch2___Print_Form.Form1.resources b/Ch2 - Print Form/obj/Debug/Ch2___Print_Form.Form1.resources new file mode 100644 index 0000000..6f2fb2c Binary files /dev/null and b/Ch2 - Print Form/obj/Debug/Ch2___Print_Form.Form1.resources differ diff --git a/Ch2 - Printing/AssemblyInfo.vb b/Ch2 - Printing/AssemblyInfo.vb new file mode 100644 index 0000000..e8573b7 --- /dev/null +++ b/Ch2 - Printing/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch2 - Printing/Ch2 - Printing.sln b/Ch2 - Printing/Ch2 - Printing.sln new file mode 100644 index 0000000..cf1367c --- /dev/null +++ b/Ch2 - Printing/Ch2 - Printing.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch2 - Printing", "Ch2 - Printing.vbproj", "{0CE55B5B-6660-49BB-94D4-F5BC45B22A58}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {0CE55B5B-6660-49BB-94D4-F5BC45B22A58}.Debug.ActiveCfg = Debug|.NET + {0CE55B5B-6660-49BB-94D4-F5BC45B22A58}.Debug.Build.0 = Debug|.NET + {0CE55B5B-6660-49BB-94D4-F5BC45B22A58}.Release.ActiveCfg = Release|.NET + {0CE55B5B-6660-49BB-94D4-F5BC45B22A58}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch2 - Printing/Ch2 - Printing.suo b/Ch2 - Printing/Ch2 - Printing.suo new file mode 100644 index 0000000..f6a715f Binary files /dev/null and b/Ch2 - Printing/Ch2 - Printing.suo differ diff --git a/Ch2 - Printing/Ch2 - Printing.vbproj b/Ch2 - Printing/Ch2 - Printing.vbproj new file mode 100644 index 0000000..2fd66d6 --- /dev/null +++ b/Ch2 - Printing/Ch2 - Printing.vbproj @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch2 - Printing/Ch2 - Printing.vbproj.user b/Ch2 - Printing/Ch2 - Printing.vbproj.user new file mode 100644 index 0000000..447fdc6 --- /dev/null +++ b/Ch2 - Printing/Ch2 - Printing.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch2 - Printing/Form1.resx b/Ch2 - Printing/Form1.resx new file mode 100644 index 0000000..bbf07fb --- /dev/null +++ b/Ch2 - Printing/Form1.resx @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch2 - Printing/Form1.vb b/Ch2 - Printing/Form1.vb new file mode 100644 index 0000000..0eea3db --- /dev/null +++ b/Ch2 - Printing/Form1.vb @@ -0,0 +1,78 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(64, 144) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(248, 40) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Click here to print this text" + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(16, 16) + Me.TextBox1.Multiline = True + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(336, 112) + Me.TextBox1.TabIndex = 1 + Me.TextBox1.Text = "" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(376, 198) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox1, Me.Button1}) + Me.Name = "Form1" + Me.Text = "Text Printing Class... That Works!" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + ' Create object, passing in text + Dim MyPrintObject As New TextPrint(TextBox1.Text) + ' Set font, if required + MyPrintObject.Font = New Font("Tahoma", 8) + ' Issue print command + MyPrintObject.Print() + End Sub +End Class + diff --git a/Ch2 - Printing/Printing.resx b/Ch2 - Printing/Printing.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch2 - Printing/Printing.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch2 - Printing/Printing.vb b/Ch2 - Printing/Printing.vb new file mode 100644 index 0000000..4a14cd2 --- /dev/null +++ b/Ch2 - Printing/Printing.vb @@ -0,0 +1,97 @@ +Public Class TextPrint + ' Inherits all the functionality of a PrintDocument + Inherits Printing.PrintDocument + ' Private variables to hold default font and text + Private fntPrintFont As Font + Private strText As String + Public Sub New(ByVal Text As String) + ' Sets the file stream + MyBase.New() + strText = Text + End Sub + Public Property Text() As String + Get + Return strText + End Get + Set(ByVal Value As String) + strText = Value + End Set + End Property + Protected Overrides Sub OnBeginPrint(ByVal ev As Printing.PrintEventArgs) + ' Run base code + MyBase.OnBeginPrint(ev) + ' Sets the default font + If fntPrintFont Is Nothing Then + fntPrintFont = New Font("Times New Roman", 12) + End If + End Sub + Public Property Font() As Font + ' Allows the user to override the default font + Get + Return fntPrintFont + End Get + Set(ByVal Value As Font) + fntPrintFont = Value + End Set + End Property + Protected Overrides Sub OnPrintPage(ByVal ev _ + As Printing.PrintPageEventArgs) + ' Provides the print logic for our document + + ' Run base code + MyBase.OnPrintPage(ev) + ' Variables + Static intCurrentChar As Integer + Dim intPrintAreaHeight, intPrintAreaWidth, _ + intMarginLeft, intMarginTop As Integer + ' Set printing area boundaries and margin coordinates + With MyBase.DefaultPageSettings + intPrintAreaHeight = .PaperSize.Height - .Margins.Top - .Margins.Bottom + intPrintAreaWidth = .PaperSize.Width - .Margins.Left - .Margins.Right + intMarginLeft = .Margins.Left 'X + intMarginTop = .Margins.Top 'Y + End With + ' If Landscape set, swap printing height/width + If MyBase.DefaultPageSettings.Landscape Then + Dim intTemp As Integer + intTemp = intPrintAreaHeight + intPrintAreaHeight = intPrintAreaWidth + intPrintAreaWidth = intTemp + End If + ' Calculate total number of lines + Dim intLineCount As Int32 = CInt(intPrintAreaHeight / Font.Height) + ' Initialise rectangle printing area + Dim rectPrintingArea As New RectangleF(intMarginLeft, intMarginTop, _ + intPrintAreaWidth, intPrintAreaHeight) + ' Initialise StringFormat class, for text layout + Dim objSF As New StringFormat(StringFormatFlags.LineLimit) + ' Figure out how many lines will fit into rectangle + Dim intLinesFilled, intCharsFitted As Int32 + ev.Graphics.MeasureString(Mid(strText, _ + UpgradeZeros(intCurrentChar)), Font, _ + New SizeF(intPrintAreaWidth, intPrintAreaHeight), objSF, _ + intCharsFitted, intLinesFilled) + ' Print the text to the page + ev.Graphics.DrawString(Mid(strText, _ + UpgradeZeros(intCurrentChar)), Font, _ + Brushes.Black, rectPrintingArea, objSF) + ' Increase current char count + intCurrentChar += intCharsFitted + ' Check whether we need to print more + If intCurrentChar < strText.Length Then + ev.HasMorePages = True + Else + ev.HasMorePages = False + intCurrentChar = 0 + End If + End Sub + Public Function UpgradeZeros(ByVal Input As Integer) As Integer + ' Upgrades all zeros to ones + ' - used as opposed to defunct IIF or messy If statements + If Input = 0 Then + Return 1 + Else + Return Input + End If + End Function +End Class diff --git a/Ch2 - Printing/bin/Ch2 - Printing.exe b/Ch2 - Printing/bin/Ch2 - Printing.exe new file mode 100644 index 0000000..6b48205 Binary files /dev/null and b/Ch2 - Printing/bin/Ch2 - Printing.exe differ diff --git a/Ch2 - Printing/bin/Ch2 - Printing.pdb b/Ch2 - Printing/bin/Ch2 - Printing.pdb new file mode 100644 index 0000000..91d24e9 Binary files /dev/null and b/Ch2 - Printing/bin/Ch2 - Printing.pdb differ diff --git a/Ch2 - Printing/obj/Debug/Ch2 - Printing.exe b/Ch2 - Printing/obj/Debug/Ch2 - Printing.exe new file mode 100644 index 0000000..6b48205 Binary files /dev/null and b/Ch2 - Printing/obj/Debug/Ch2 - Printing.exe differ diff --git a/Ch2 - Printing/obj/Debug/Ch2 - Printing.pdb b/Ch2 - Printing/obj/Debug/Ch2 - Printing.pdb new file mode 100644 index 0000000..91d24e9 Binary files /dev/null and b/Ch2 - Printing/obj/Debug/Ch2 - Printing.pdb differ diff --git a/Ch2 - Printing/obj/Debug/Ch2___Printing.Form1.resources b/Ch2 - Printing/obj/Debug/Ch2___Printing.Form1.resources new file mode 100644 index 0000000..22657e2 Binary files /dev/null and b/Ch2 - Printing/obj/Debug/Ch2___Printing.Form1.resources differ diff --git a/Ch2 - Printing/obj/Debug/Ch2___Printing.TextPrint.resources b/Ch2 - Printing/obj/Debug/Ch2___Printing.TextPrint.resources new file mode 100644 index 0000000..4e892e6 Binary files /dev/null and b/Ch2 - Printing/obj/Debug/Ch2___Printing.TextPrint.resources differ diff --git a/Ch2 - RTF to HTML/AssemblyInfo.vb b/Ch2 - RTF to HTML/AssemblyInfo.vb new file mode 100644 index 0000000..af44109 --- /dev/null +++ b/Ch2 - RTF to HTML/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch2 - RTF to HTML/Ch2 - RTF to HTML.sln b/Ch2 - RTF to HTML/Ch2 - RTF to HTML.sln new file mode 100644 index 0000000..3f8edf8 --- /dev/null +++ b/Ch2 - RTF to HTML/Ch2 - RTF to HTML.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch2 - RTF to HTML", "Ch2 - RTF to HTML.vbproj", "{ADDBAFFD-B37D-415E-86E2-918CCC9CB693}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {ADDBAFFD-B37D-415E-86E2-918CCC9CB693}.Debug.ActiveCfg = Debug|.NET + {ADDBAFFD-B37D-415E-86E2-918CCC9CB693}.Debug.Build.0 = Debug|.NET + {ADDBAFFD-B37D-415E-86E2-918CCC9CB693}.Release.ActiveCfg = Release|.NET + {ADDBAFFD-B37D-415E-86E2-918CCC9CB693}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch2 - RTF to HTML/Ch2 - RTF to HTML.suo b/Ch2 - RTF to HTML/Ch2 - RTF to HTML.suo new file mode 100644 index 0000000..9540578 Binary files /dev/null and b/Ch2 - RTF to HTML/Ch2 - RTF to HTML.suo differ diff --git a/Ch2 - RTF to HTML/Ch2 - RTF to HTML.vbproj b/Ch2 - RTF to HTML/Ch2 - RTF to HTML.vbproj new file mode 100644 index 0000000..0514ca7 --- /dev/null +++ b/Ch2 - RTF to HTML/Ch2 - RTF to HTML.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch2 - RTF to HTML/Ch2 - RTF to HTML.vbproj.user b/Ch2 - RTF to HTML/Ch2 - RTF to HTML.vbproj.user new file mode 100644 index 0000000..447fdc6 --- /dev/null +++ b/Ch2 - RTF to HTML/Ch2 - RTF to HTML.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch2 - RTF to HTML/Form1.resx b/Ch2 - RTF to HTML/Form1.resx new file mode 100644 index 0000000..8d79fcb --- /dev/null +++ b/Ch2 - RTF to HTML/Form1.resx @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch2 - RTF to HTML/Form1.vb b/Ch2 - RTF to HTML/Form1.vb new file mode 100644 index 0000000..3c45cbb --- /dev/null +++ b/Ch2 - RTF to HTML/Form1.vb @@ -0,0 +1,186 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel + Friend WithEvents TB As System.Windows.Forms.TextBox + Friend WithEvents RTB As System.Windows.Forms.RichTextBox + Private Sub InitializeComponent() + Me.RTB = New System.Windows.Forms.RichTextBox() + Me.Label1 = New System.Windows.Forms.Label() + Me.LinkLabel1 = New System.Windows.Forms.LinkLabel() + Me.TB = New System.Windows.Forms.TextBox() + Me.SuspendLayout() + ' + 'RTB + ' + Me.RTB.Location = New System.Drawing.Point(16, 32) + Me.RTB.Name = "RTB" + Me.RTB.Size = New System.Drawing.Size(432, 104) + Me.RTB.TabIndex = 0 + Me.RTB.Text = "" + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(16, 8) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(320, 16) + Me.Label1.TabIndex = 1 + Me.Label1.Text = "Paste a little formatted text from Word or WordPad here:" + ' + 'LinkLabel1 + ' + Me.LinkLabel1.Location = New System.Drawing.Point(16, 152) + Me.LinkLabel1.Name = "LinkLabel1" + Me.LinkLabel1.Size = New System.Drawing.Size(376, 23) + Me.LinkLabel1.TabIndex = 2 + Me.LinkLabel1.TabStop = True + Me.LinkLabel1.Text = "Click here to extract HTML from the above RichTextBox control:" + ' + 'TB + ' + Me.TB.Location = New System.Drawing.Point(16, 176) + Me.TB.Multiline = True + Me.TB.Name = "TB" + Me.TB.Size = New System.Drawing.Size(432, 128) + Me.TB.TabIndex = 3 + Me.TB.Text = "" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(464, 318) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TB, Me.LinkLabel1, Me.Label1, Me.RTB}) + Me.Name = "Form1" + Me.Text = "Converting RTF to HTML" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked + TB.Text = ConvertToHTML(RTB) + End Sub + Public Function ConvertToHTML(ByVal Box As RichTextBox) As String + ' Takes a RichTextBox control and returns a + ' simple HTML-formatted version of its contents + Dim strHTML As String + Dim strColour As String + Dim blnBold As Boolean + Dim blnItalic As Boolean + Dim strFont As String + Dim shtSize As Short + Dim lngOriginalStart As Long + Dim lngOriginalLength As Long + Dim intCount As Integer + ' If nothing in the box, exit + If Box.Text.Length = 0 Then Exit Function + ' Store original selections, then select first character + lngOriginalStart = 0 + lngOriginalLength = Box.TextLength + Box.Select(0, 1) + ' Add HTML header + strHTML = "" + ' Setup initial parameters + strColour = Box.SelectionColor.ToKnownColor.ToString + blnBold = Box.SelectionFont.Bold + blnItalic = Box.SelectionFont.Italic + strFont = Box.SelectionFont.FontFamily.Name + shtSize = Box.SelectionFont.Size + ' Include first 'style' parameters in the HTML + strHTML += "" + ' Include bold tag, if required + If blnBold = True Then + strHTML += "" + End If + ' Include italic tag, if required + If blnItalic = True Then + strHTML += "" + End If + ' Finally, add our first character + strHTML += Box.Text.Substring(0, 1) + ' Loop around all remaining characters + For intCount = 2 To Box.Text.Length + ' Select current character + Box.Select(intCount - 1, 1) + ' If this is a line break, add HTML tag + If Box.Text.Substring(intCount - 1, 1) = Convert.ToChar(10) Then + strHTML += "
" + End If + ' Check/implement any changes in style + If Box.SelectionColor.ToKnownColor.ToString <> strColour _ + Or Box.SelectionFont.FontFamily.Name <> strFont Or _ + Box.SelectionFont.Size <> shtSize Then + strHTML += "
" + End If + ' Check for bold changes + If Box.SelectionFont.Bold <> blnBold Then + If Box.SelectionFont.Bold = False Then + strHTML += "" + Else + strHTML += "" + End If + End If + ' Check for italic changes + If Box.SelectionFont.Italic <> blnItalic Then + If Box.SelectionFont.Italic = False Then + strHTML += "" + Else + strHTML += "" + End If + End If + ' Add the actual character + strHTML += Mid(Box.Text, intCount, 1) + ' Update variables with current style + strColour = Box.SelectionColor.ToKnownColor.ToString + blnBold = Box.SelectionFont.Bold + blnItalic = Box.SelectionFont.Italic + strFont = Box.SelectionFont.FontFamily.Name + shtSize = Box.SelectionFont.Size + Next + ' Close off any open bold/italic tags + If blnBold = True Then strHTML += "" + If blnItalic = True Then strHTML += "" + ' Terminate outstanding HTML tags + strHTML += "" + ' Restore original RichTextBox selection + Box.Select(lngOriginalStart, lngOriginalLength) + ' Return HTML + Return strHTML + End Function + +End Class diff --git a/Ch2 - RTF to HTML/bin/Ch2 - RTF to HTML.exe b/Ch2 - RTF to HTML/bin/Ch2 - RTF to HTML.exe new file mode 100644 index 0000000..68500df Binary files /dev/null and b/Ch2 - RTF to HTML/bin/Ch2 - RTF to HTML.exe differ diff --git a/Ch2 - RTF to HTML/bin/Ch2 - RTF to HTML.pdb b/Ch2 - RTF to HTML/bin/Ch2 - RTF to HTML.pdb new file mode 100644 index 0000000..3f52cce Binary files /dev/null and b/Ch2 - RTF to HTML/bin/Ch2 - RTF to HTML.pdb differ diff --git a/Ch2 - RTF to HTML/obj/Debug/Ch2 - RTF to HTML.exe b/Ch2 - RTF to HTML/obj/Debug/Ch2 - RTF to HTML.exe new file mode 100644 index 0000000..68500df Binary files /dev/null and b/Ch2 - RTF to HTML/obj/Debug/Ch2 - RTF to HTML.exe differ diff --git a/Ch2 - RTF to HTML/obj/Debug/Ch2 - RTF to HTML.pdb b/Ch2 - RTF to HTML/obj/Debug/Ch2 - RTF to HTML.pdb new file mode 100644 index 0000000..3f52cce Binary files /dev/null and b/Ch2 - RTF to HTML/obj/Debug/Ch2 - RTF to HTML.pdb differ diff --git a/Ch2 - RTF to HTML/obj/Debug/Ch2___RTF_to_HTML.Form1.resources b/Ch2 - RTF to HTML/obj/Debug/Ch2___RTF_to_HTML.Form1.resources new file mode 100644 index 0000000..704dfdf Binary files /dev/null and b/Ch2 - RTF to HTML/obj/Debug/Ch2___RTF_to_HTML.Form1.resources differ diff --git a/Ch2 - Reset Form/AssemblyInfo.vb b/Ch2 - Reset Form/AssemblyInfo.vb new file mode 100644 index 0000000..5cd6f85 --- /dev/null +++ b/Ch2 - Reset Form/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch2 - Reset Form/Ch2 - Reset Form.sln b/Ch2 - Reset Form/Ch2 - Reset Form.sln new file mode 100644 index 0000000..ca1e83c --- /dev/null +++ b/Ch2 - Reset Form/Ch2 - Reset Form.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch2 - Reset Form", "Ch2 - Reset Form.vbproj", "{65D80F86-CD03-4CED-897B-A07F3373371E}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {65D80F86-CD03-4CED-897B-A07F3373371E}.Debug.ActiveCfg = Debug|.NET + {65D80F86-CD03-4CED-897B-A07F3373371E}.Debug.Build.0 = Debug|.NET + {65D80F86-CD03-4CED-897B-A07F3373371E}.Release.ActiveCfg = Release|.NET + {65D80F86-CD03-4CED-897B-A07F3373371E}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch2 - Reset Form/Ch2 - Reset Form.suo b/Ch2 - Reset Form/Ch2 - Reset Form.suo new file mode 100644 index 0000000..bdbf15f Binary files /dev/null and b/Ch2 - Reset Form/Ch2 - Reset Form.suo differ diff --git a/Ch2 - Reset Form/Ch2 - Reset Form.vbproj b/Ch2 - Reset Form/Ch2 - Reset Form.vbproj new file mode 100644 index 0000000..2a44473 --- /dev/null +++ b/Ch2 - Reset Form/Ch2 - Reset Form.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch2 - Reset Form/Ch2 - Reset Form.vbproj.user b/Ch2 - Reset Form/Ch2 - Reset Form.vbproj.user new file mode 100644 index 0000000..447fdc6 --- /dev/null +++ b/Ch2 - Reset Form/Ch2 - Reset Form.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch2 - Reset Form/Form1.resx b/Ch2 - Reset Form/Form1.resx new file mode 100644 index 0000000..c6c4d74 --- /dev/null +++ b/Ch2 - Reset Form/Form1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch2 - Reset Form/Form1.vb b/Ch2 - Reset Form/Form1.vb new file mode 100644 index 0000000..2fdb9c6 --- /dev/null +++ b/Ch2 - Reset Form/Form1.vb @@ -0,0 +1,172 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox + Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents TabControl1 As System.Windows.Forms.TabControl + Friend WithEvents TabPage1 As System.Windows.Forms.TabPage + Friend WithEvents CheckBox2 As System.Windows.Forms.CheckBox + Private Sub InitializeComponent() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.CheckBox1 = New System.Windows.Forms.CheckBox() + Me.ComboBox1 = New System.Windows.Forms.ComboBox() + Me.Button1 = New System.Windows.Forms.Button() + Me.TabControl1 = New System.Windows.Forms.TabControl() + Me.TabPage1 = New System.Windows.Forms.TabPage() + Me.CheckBox2 = New System.Windows.Forms.CheckBox() + Me.TabControl1.SuspendLayout() + Me.TabPage1.SuspendLayout() + Me.SuspendLayout() + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(64, 32) + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(144, 20) + Me.TextBox1.TabIndex = 0 + Me.TextBox1.Text = "TextBox1" + ' + 'CheckBox1 + ' + Me.CheckBox1.Checked = True + Me.CheckBox1.CheckState = System.Windows.Forms.CheckState.Checked + Me.CheckBox1.Location = New System.Drawing.Point(64, 64) + Me.CheckBox1.Name = "CheckBox1" + Me.CheckBox1.TabIndex = 1 + Me.CheckBox1.Text = "CheckBox1" + ' + 'ComboBox1 + ' + Me.ComboBox1.Items.AddRange(New Object() {"Item #1", "Item #2", "Item #3"}) + Me.ComboBox1.Location = New System.Drawing.Point(64, 104) + Me.ComboBox1.Name = "ComboBox1" + Me.ComboBox1.Size = New System.Drawing.Size(121, 21) + Me.ComboBox1.TabIndex = 2 + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(256, 144) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(104, 24) + Me.Button1.TabIndex = 3 + Me.Button1.Text = "Reset This Form" + ' + 'TabControl1 + ' + Me.TabControl1.Controls.AddRange(New System.Windows.Forms.Control() {Me.TabPage1}) + Me.TabControl1.Location = New System.Drawing.Point(240, 32) + Me.TabControl1.Name = "TabControl1" + Me.TabControl1.SelectedIndex = 0 + Me.TabControl1.Size = New System.Drawing.Size(120, 88) + Me.TabControl1.TabIndex = 4 + ' + 'TabPage1 + ' + Me.TabPage1.Controls.AddRange(New System.Windows.Forms.Control() {Me.CheckBox2}) + Me.TabPage1.Location = New System.Drawing.Point(4, 22) + Me.TabPage1.Name = "TabPage1" + Me.TabPage1.Size = New System.Drawing.Size(112, 62) + Me.TabPage1.TabIndex = 0 + Me.TabPage1.Text = "TabPage1" + ' + 'CheckBox2 + ' + Me.CheckBox2.Checked = True + Me.CheckBox2.CheckState = System.Windows.Forms.CheckState.Checked + Me.CheckBox2.Location = New System.Drawing.Point(16, 24) + Me.CheckBox2.Name = "CheckBox2" + Me.CheckBox2.Size = New System.Drawing.Size(88, 24) + Me.CheckBox2.TabIndex = 0 + Me.CheckBox2.Text = "CheckBox2" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(376, 181) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TabControl1, Me.Button1, Me.ComboBox1, Me.CheckBox1, Me.TextBox1}) + Me.Name = "Form1" + Me.Text = "Form1" + Me.TabControl1.ResumeLayout(False) + Me.TabPage1.ResumeLayout(False) + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + ResetForm(Me) + End Sub + + Public Sub ResetForm(ByVal FormToReset As Form) + ' Resets the main data entry controls on the passed FormToReset + Dim objControl As Control + ' Loop around every control on the form and run the reset method + For Each objControl In FormToReset.Controls + ResetControl(objControl) + Next + End Sub + + Public Sub ResetControl(ByVal ControlToReset As Control) + ' Resets the core control, then loops and + ' resets any sub controls, such as Tab pages + Dim intCount As Integer + ClearControl(ControlToReset) + If ControlToReset.Controls.Count > 0 Then + For intCount = 1 To ControlToReset.Controls.Count + ResetControl(ControlToReset.Controls(intCount - 1)) + Next + End If + End Sub + + Public Sub ClearControl(ByVal ControlToClear As Control) + ' Clears the value of a particular control - + ' you may wish to extend this to suit your exact needs + If InStr(ControlToClear.Tag, "skip", CompareMethod.Text) = 0 Then + If TypeOf (ControlToClear) Is System.Windows.Forms.TextBox Then + ControlToClear.Text = "" ' Clear TextBox + ElseIf TypeOf (ControlToClear) Is System.Windows.Forms.CheckBox Then + Dim objCheckBox As System.Windows.Forms.CheckBox = ControlToClear + objCheckBox.Checked = False ' Uncheck CheckBox + ElseIf TypeOf (ControlToClear) Is System.Windows.Forms.ComboBox Then + Dim objComboBox As System.Windows.Forms.ComboBox = ControlToClear + objComboBox.SelectedIndex = -1 ' Deselect any ComboBox entry + End If + End If + End Sub + + Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + ' Select sample item in combo box + ComboBox1.SelectedIndex = 1 + End Sub +End Class diff --git a/Ch2 - Reset Form/bin/Ch2 - Reset Form.exe b/Ch2 - Reset Form/bin/Ch2 - Reset Form.exe new file mode 100644 index 0000000..50519f7 Binary files /dev/null and b/Ch2 - Reset Form/bin/Ch2 - Reset Form.exe differ diff --git a/Ch2 - Reset Form/bin/Ch2 - Reset Form.pdb b/Ch2 - Reset Form/bin/Ch2 - Reset Form.pdb new file mode 100644 index 0000000..df13a67 Binary files /dev/null and b/Ch2 - Reset Form/bin/Ch2 - Reset Form.pdb differ diff --git a/Ch2 - Reset Form/obj/Debug/Ch2 - Reset Form.exe b/Ch2 - Reset Form/obj/Debug/Ch2 - Reset Form.exe new file mode 100644 index 0000000..50519f7 Binary files /dev/null and b/Ch2 - Reset Form/obj/Debug/Ch2 - Reset Form.exe differ diff --git a/Ch2 - Reset Form/obj/Debug/Ch2 - Reset Form.pdb b/Ch2 - Reset Form/obj/Debug/Ch2 - Reset Form.pdb new file mode 100644 index 0000000..df13a67 Binary files /dev/null and b/Ch2 - Reset Form/obj/Debug/Ch2 - Reset Form.pdb differ diff --git a/Ch2 - Reset Form/obj/Debug/Ch2___Reset_Form.Form1.resources b/Ch2 - Reset Form/obj/Debug/Ch2___Reset_Form.Form1.resources new file mode 100644 index 0000000..9764c41 Binary files /dev/null and b/Ch2 - Reset Form/obj/Debug/Ch2___Reset_Form.Form1.resources differ diff --git a/Ch2 - Screen Capture/AssemblyInfo.vb b/Ch2 - Screen Capture/AssemblyInfo.vb new file mode 100644 index 0000000..5e96163 --- /dev/null +++ b/Ch2 - Screen Capture/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch2 - Screen Capture/Ch2 - Screen Capture.sln b/Ch2 - Screen Capture/Ch2 - Screen Capture.sln new file mode 100644 index 0000000..bb71bbb --- /dev/null +++ b/Ch2 - Screen Capture/Ch2 - Screen Capture.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch2 - Screen Capture", "Ch2 - Screen Capture.vbproj", "{BB772E59-89A4-4EBD-84DF-62D14746F2E0}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {BB772E59-89A4-4EBD-84DF-62D14746F2E0}.Debug.ActiveCfg = Debug|.NET + {BB772E59-89A4-4EBD-84DF-62D14746F2E0}.Debug.Build.0 = Debug|.NET + {BB772E59-89A4-4EBD-84DF-62D14746F2E0}.Release.ActiveCfg = Release|.NET + {BB772E59-89A4-4EBD-84DF-62D14746F2E0}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch2 - Screen Capture/Ch2 - Screen Capture.suo b/Ch2 - Screen Capture/Ch2 - Screen Capture.suo new file mode 100644 index 0000000..e07156b Binary files /dev/null and b/Ch2 - Screen Capture/Ch2 - Screen Capture.suo differ diff --git a/Ch2 - Screen Capture/Ch2 - Screen Capture.vbproj b/Ch2 - Screen Capture/Ch2 - Screen Capture.vbproj new file mode 100644 index 0000000..a81e345 --- /dev/null +++ b/Ch2 - Screen Capture/Ch2 - Screen Capture.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch2 - Screen Capture/Ch2 - Screen Capture.vbproj.user b/Ch2 - Screen Capture/Ch2 - Screen Capture.vbproj.user new file mode 100644 index 0000000..a6e254a --- /dev/null +++ b/Ch2 - Screen Capture/Ch2 - Screen Capture.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch2 - Screen Capture/Form1.resx b/Ch2 - Screen Capture/Form1.resx new file mode 100644 index 0000000..f135189 --- /dev/null +++ b/Ch2 - Screen Capture/Form1.resx @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch2 - Screen Capture/Form1.vb b/Ch2 - Screen Capture/Form1.vb new file mode 100644 index 0000000..a5c1238 --- /dev/null +++ b/Ch2 - Screen Capture/Form1.vb @@ -0,0 +1,90 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.PictureBox1 = New System.Windows.Forms.PictureBox() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'PictureBox1 + ' + Me.PictureBox1.Location = New System.Drawing.Point(288, 16) + Me.PictureBox1.Name = "PictureBox1" + Me.PictureBox1.Size = New System.Drawing.Size(192, 136) + Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage + Me.PictureBox1.TabIndex = 0 + Me.PictureBox1.TabStop = False + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(32, 40) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(208, 40) + Me.Button1.TabIndex = 1 + Me.Button1.Text = "Click to Capture the Screen" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(496, 166) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1, Me.PictureBox1}) + Me.Name = "Form1" + Me.Text = "Capturing the Screen, Quick and Easy" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + GetScreenCapture(True).Save("c:\screengrab.bmp") + PictureBox1.Image = GetScreenCapture() + End Sub + + Public Function GetScreenCapture( _ + Optional ByVal FullScreen As Boolean = False) As Image + ' Captures the current screen and returns as an Image object + Dim objSK As SendKeys + Dim imgCapture As Image + If FullScreen = True Then + ' Print Screen pressed twice here as some systems + ' grab active window "accidentally" on first run + objSK.SendWait("{PRTSC 2}") + Else + objSK.SendWait("%{PRTSC}") + End If + Dim objData As IDataObject = Clipboard.GetDataObject() + Return objData.GetData(DataFormats.Bitmap) + End Function + +End Class diff --git a/Ch2 - Screen Capture/bin/Ch2 - Screen Capture.exe b/Ch2 - Screen Capture/bin/Ch2 - Screen Capture.exe new file mode 100644 index 0000000..1cf1935 Binary files /dev/null and b/Ch2 - Screen Capture/bin/Ch2 - Screen Capture.exe differ diff --git a/Ch2 - Screen Capture/bin/Ch2 - Screen Capture.pdb b/Ch2 - Screen Capture/bin/Ch2 - Screen Capture.pdb new file mode 100644 index 0000000..5ed8fb8 Binary files /dev/null and b/Ch2 - Screen Capture/bin/Ch2 - Screen Capture.pdb differ diff --git a/Ch2 - Screen Capture/obj/Debug/Ch2 - Screen Capture.exe b/Ch2 - Screen Capture/obj/Debug/Ch2 - Screen Capture.exe new file mode 100644 index 0000000..1cf1935 Binary files /dev/null and b/Ch2 - Screen Capture/obj/Debug/Ch2 - Screen Capture.exe differ diff --git a/Ch2 - Screen Capture/obj/Debug/Ch2 - Screen Capture.pdb b/Ch2 - Screen Capture/obj/Debug/Ch2 - Screen Capture.pdb new file mode 100644 index 0000000..5ed8fb8 Binary files /dev/null and b/Ch2 - Screen Capture/obj/Debug/Ch2 - Screen Capture.pdb differ diff --git a/Ch2 - Screen Capture/obj/Debug/Ch2___Screen_Capture.Form1.resources b/Ch2 - Screen Capture/obj/Debug/Ch2___Screen_Capture.Form1.resources new file mode 100644 index 0000000..81aacf8 Binary files /dev/null and b/Ch2 - Screen Capture/obj/Debug/Ch2___Screen_Capture.Form1.resources differ diff --git a/Ch2 - Snap to Control/AssemblyInfo.vb b/Ch2 - Snap to Control/AssemblyInfo.vb new file mode 100644 index 0000000..fb22250 --- /dev/null +++ b/Ch2 - Snap to Control/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch2 - Snap to Control/Ch2 - Snap to Control.sln b/Ch2 - Snap to Control/Ch2 - Snap to Control.sln new file mode 100644 index 0000000..4760e19 --- /dev/null +++ b/Ch2 - Snap to Control/Ch2 - Snap to Control.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch2 - Snap to Control", "Ch2 - Snap to Control.vbproj", "{B5065D3D-1430-42B9-9DEC-44419B8492E6}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {B5065D3D-1430-42B9-9DEC-44419B8492E6}.Debug.ActiveCfg = Debug|.NET + {B5065D3D-1430-42B9-9DEC-44419B8492E6}.Debug.Build.0 = Debug|.NET + {B5065D3D-1430-42B9-9DEC-44419B8492E6}.Release.ActiveCfg = Release|.NET + {B5065D3D-1430-42B9-9DEC-44419B8492E6}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch2 - Snap to Control/Ch2 - Snap to Control.suo b/Ch2 - Snap to Control/Ch2 - Snap to Control.suo new file mode 100644 index 0000000..5e70722 Binary files /dev/null and b/Ch2 - Snap to Control/Ch2 - Snap to Control.suo differ diff --git a/Ch2 - Snap to Control/Ch2 - Snap to Control.vbproj b/Ch2 - Snap to Control/Ch2 - Snap to Control.vbproj new file mode 100644 index 0000000..cac864a --- /dev/null +++ b/Ch2 - Snap to Control/Ch2 - Snap to Control.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch2 - Snap to Control/Ch2 - Snap to Control.vbproj.user b/Ch2 - Snap to Control/Ch2 - Snap to Control.vbproj.user new file mode 100644 index 0000000..eabb41d --- /dev/null +++ b/Ch2 - Snap to Control/Ch2 - Snap to Control.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch2 - Snap to Control/Form1.resx b/Ch2 - Snap to Control/Form1.resx new file mode 100644 index 0000000..6641da5 --- /dev/null +++ b/Ch2 - Snap to Control/Form1.resx @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + + R0lGODlh1AE8APcAAAAAAAAACAAIAAAQAAAYAAAYCAAhAAApAAAxAAA5AABCAABKAABSAAgAAAgIAAgI + CAgYABAACBAIABAQABgAABgQABgYACEYACkAADEAACkIACUcAEIAAD0lAEoxAFY5AAAIGAg5GBAQEBAp + CBgIEBgYEBgYGBgxCDEACEIACFIACFoACCMgGCFCEEJCEBhKGBAYJSkpKSkxKSk5KTEhKS01IDE1MUcx + KwAYOTk5OT9BO1I+OQAYSkpKSgAhWgA8nABaAABjAABrAABzAAB7AACEAAhSCAiECBCMEClSEBh7GBiM + GDFjGDlrGBBaISGUIUJ7IUKMIUqcISlSKSlaKSljKSlrKSlzKSmEKSmMKSmUKVKlKRh7MTFSMTFjMTGE + MTGMMTGUMTGcMRiMOTlSOTlaOTlrOTlzOTl7OTmEOTmMOTmUOTmcOSGtQkJ7QkKcQkKlQiG9SkpSSkpj + SkprSkqcSkqlSinOUlJSUlpSUgBSzlKEUj3HVlpaWgBa7xixsWsACHsACIQACGsAEHsAEIQAEGtCAGky + OYQpOYwIGJQAEJQhMZQpOZwpOaUAEKUAGHNKAHtSAIRaAIxaAGtaQmtaY5xjAGNjKXtjSmNjY2trKVpr + Wmtra3NzGHNzKYxzUqU5Sq0AEK0AGK0pOa0pQrU5Sr0AEL0AGL0pOb0pQr05SsYpOcYpQs4AEM4AGM4p + Qs45StYAGNYhQtYpQtY5St4AId4IId4QKd4QMd4hOd4hQt4pQt4pSt4xSt45Uuc5UnNzc5x7Wnt7e4SE + KYSEhIyMAIyMOVqMWq2Ma4yMjGOUY4yUjJSUlJycIVqcWmuca72cc5ycnKWlKVqlWs6le6WlpVqtWmOt + Y2uta62trVq1KWu1a3u1e961hLW1tXu9e4S9hO+9jL29vWPGMYzGjMbGxs7OAJzOnP/OnKXOpc7OzmvW + Ma3WrbXWtdbW1t7eAHPeOb3evd7e3ufnOcbnxs7nztbn1ufn5+/vAN7v3u/v7/f3Ke/37/f39///AP// + /ywAAAAA1AE8AAAI/wD/CRxIsKDBgwgTKlzIsKHDhxAjSpxIUWK/fxf7ZdTIsaNHjRhDZgw58GLJiign + 6lOncKVCefJSypxJs6bNmzhz6txp0+RGkR9B/hRKsujJozxT9gEQE2EmpglZmEhKtWpLlgldJoRptavX + rzt9Ag0aFOPIsyRHGl0LNqE4By36IHx7IhNCYSNKRGvLF+fTpgf/Rp3at7DhwwXPDiXr0SxasQIhm4yM + mKCNJuOgGrycGfBAeSK2RGFRufRDunYPor6bd6/p17Bvir14zzHjjmZzExVZFDLsZBDgwUuSmiBw4cQN + 9kgiHEK12NAtY9ZckDP1z6FHR9/OHaLYe3hi9P/xdrs8UMpoKbMtrC+08M4E2295f13cg3XCtXd/fXx4 + 8YH9JVfQcs09t9+BB06WkT55MCJLIzfoQF55Qm1ElFrpKVhZHy0Ih9x/HHroH0EsQCGicwgiJh99nq0I + D3wD2YcfPPqlaGN0PjGYyiy7yMIIDX1Q+BFviqVlJFJ8vTWOiDAqyaRmeIlII2k39pVJhx4KKFCIWf5X + 4okGVinmYWLpgwcqs+gyyw05JCOkbo4ReZ5kpclwAhMzfiiQnXiKmBxoSTQhJYpjeuWkh006sCSiUI4g + ZY2FRoqSPuLoQ5E+lYzC4yyI6CCPeYzZJudj6q1nVTQAADBCnlAwwRSqqrL/6qo8TwHAnHDrNNEClZJS + ZcOdeY74D5/B/ilCoIOG2euyDukTAwjJTNQPJzvusksqMXx6m22hVghnhofJY8OqfrKggzjikpulueKI + c6yI64xggw6WMqsTrOrC0+qrqea7L62p3gpPrrvaa/BnBrn7gw94TCQMI9byeAMxFjYmZFkXYlgqX33k + m+VemXiMXDT62CCwh+vUgNXBN6VbLLsul3uuuyfHO2+9LEeqjw6pAnDuP2YG8MMPAOCRw38L9cMMxDzu + wkoM+mTM7cUVcjRqb3xl4kATSZwsHBM2bN21lPAwwcIIuprI5BSu5UxTyMGO/A/cZCdBsslkp7yy22KC + //aDHn748QMILLDgA9ET2PAAJbwylM0hu/AS+SyHADNWkVRvC25fyQBgAycBMEE2FKkCA4DoZEcBwFNS + kD1c23xXlIkAXHtddti1k2022i2ojSjbsYvZhw+BF++HHoOnKsIO1LAQbUPu3DCL5Na+QoM7o2ZO4dVY + 88WJoyJu0cT4I5wtpfjki4C6h1GM38QDsAcPUeefnz566fanvjoArdcdv/zdEQHgjKcHHwDgBjsIRjia + xwmBqIMFPdOBQfSRg1f0YhcX5EUjGkYqxQQlah4BIcaONJkkPWBRHiIdMISBhxNKSYXCGBfZWiACYgiD + GNkAYEW+dz73lQ98HkJfE/9GoL5HuQ9+8ouHEpfIRHZ8AxzfeGIUoSjFJ1rjDWzAohazyMUterGLYPzi + G6wAAuMJbgKY6EY3oIEMSgjACG94QxpEsIA3KIEBA/ACGKegAllkEIM3cMM1rGGNa2wDioj8BjnIcQ52 + OPKRkHRkOtJxjkqeg5KXbGQ9NsnJeNDjk5/sS3ui8CIpJcEGoyyln2zwFm2oElcjaKAOK2IfFAoHhi20 + pb4AsEIZSomGNsQhdPjBRCU6kYpQ3MYXw1AEIjTzmc6MJjSnKc1qPvOazsRmEbTJzWx6c5vZVADxiqeH + AiADHegoAQEOkIAhNJMIA1CANBkgAGkWQQEqqIUfMZj/ChlkQQth0IIW7EDIaVhjGgbFhkIVeg1sNPSh + 17hGHSZK0TrYwaIYtYNGp/GGJyzho0t4Qh0Oag07gPEaU0zpOZiYj4roIAnrYIIDyEZEmMqUpgCIwjhO + gCVEIXGWEkmlLk8pVFOy0gGutGW8ZLmTfBQzHud4ojLByExrWpWa4MwqVq/K1a16tatg9eoCcIA8HAyg + BpQIBzqoMQBrKoAA1DRAAqQ5BAE8Iha4wCAiphAGLGAhC28oKEkNakiHbsOhiI3oNCz6hovCAaOP1ahk + p6HRMHg0Cx7N7BKOoM2wXvUJXbRDFak4hxFIQQT8I9sQT5taKa3jAUl4wAR0CY8t/4hgb0BtyEtjOlMp + 1ZS3ONUpT6U0jp8+hJhKlOI1wsjZsHbzq9D1bHSnK93qfhUIAhAAJbqBTnRSQwILmOYAwkuEIAQBCOcF + QAIUAAQgFAEIDRBFLWxBuRnMIAYxuAJBBYvQQh52Gw1N7DUu+oaJPjajCJasZEMa0sx61LpgtadVhQCA + FqRqfR7SRoUv7Dp4aOMBrU2dCHCW24XghbX9E9FqUZtilMFWtrS1rTrqocSogmOqW3xCV58LYer6uMdA + /jF1h6CABCDAAEh+gFq7u9YStLWZQBjAPXvWMwqoYBAqoAAADCAADJyiFq5gwQ1icAlp2MAZgxxsSQvL + UABfg/+yE7VDgevQ2DlfVMGUtQNltcDgJ2QhpEgIco+HMIAtG+AEZNtCqhwwAkRLSRsjYIIU3udKEUHh + BE3YQgtswA1FKrGlJS6IOjacPxFp2MKlfjSIWyyiKAjAndbsrJAFPeta0/rWXyUCAjrgAUhAwhAdcAAl + 0tjdcNDgAM80AAIKjYD2BkEBGHBFLWJRi1qc4hGEUEEETnEKACTCBJrYhzE2QdKCGnQahjxsQ0s60Tk3 + ls4JzuhG9RyGBtsb19VFgAAWsAAHxG04D3AAAO7jOigIPFWORpmrACAAAMhzq0jw4jaeWEx+GEwfENSB + DhIexEU3mmyQljSlX4hpTROACPj/trXKU85y6j4byQY4QDSJIABDWOLmOPdAqh6ACbVSwgCwHkLPZN7M + IGhA2kifNphrMQgKDKJnE3DBPPpwDMEe1KDWwAaAOXrRdsO7wHJOsIIVzIbM/vkJgV75j4XAdgBU+tHj + kILbO/yiE5QgCm8PHwQMAAQhTHe6Eqd4POqBoHzgQQB0YMYA/h1bgRN8dAcHAMcHtvCGP7zlmFd75nsc + ZQBswAOGiMQkNrCAIRBhARvAueoFsIELDGAAn0DHDRgQzQQAYAAUNj0DVJD0akvb948AQARU4Hl8TGAY + OSCDReVsh8fGUaMYNTC8v85YeS9fz9ivwxMcvITN51oApOzw/2vDT3d9DaBPeWOCABSg+WlGd4uH/AYT + LV6YIgRhCBTOe4bjPvcO7/Tu+iccW7B3fdd+3neABjhdQeAAH6B6ONcBALBOFeCANzcBhjAJEgAAnxAO + mIAAz5RdQVAEB3AACJBPv7d0S3cKKhAAKyBtAGAO/mAOMaADOcAGNsgGYYCDYrAGYQB9XVdgcTR9dpZg + ebZRcNBgD5aA0mUAtzIOTQABPTMCSSCF7/GEUZgEePceJ0BlkSYFizKAQIeAsRZW8AdF7KBESfFO4Ed3 + 41d+t3R+/0Z566eEdCiGdYhVB9CAFDh6DHgBnjcJDvgBEzAJH1AAIVAAAFAAHrgAAEB7Rf/AiCnwe70n + baLQACnwZWAGAP6wiTuQAzrABmJgg2uwgzuYg5DldUBIZ113Z8u3fJRFWXCgWUdgh9WUACMwDlEwAgBw + AACAc1t2i7k4cL14cwyXF5KXaTLVAZMAAAtgAAMAF5mWBHNIi0IGXTn4BlPERBXRTExYhVDYL1PYhFYI + jllYd1woaV+4d6Z3h9TYjj9GBAwAAIBIgR1gAfMYCRvgAPOIcxtgCBvQBncQkHcwBgxAAFIGBAbQAIrg + e9XGkGCmAingkJq4iZ6gA2VwgzuIgzoYBmtwYGGXih4JdvI2dhy1fZvljkQABKoSgQzgTsNoCf3CkgrA + i764kgcABAr/YAA9UwEA8ExDgJME0HBbxo5E6VlYZAdQtFLxAGoHUQS2iIu6SJPEaADAqIsg5osCYIwl + l4zL2IzP2ALROI1FOZYoCV1BIJQ2R4EXAAkOWI8OKAkOUAEByQd3QJdcoF4I0ACDMIko+HsBUAgN6YKb + 6A/NkHxrwAaHSYqjyJFhEAbv9pFeF2fXN1nzJmdPcASzSJbTJAAD0E7S9JK3pwB+F02gSQAtCU3yaAg6 + t1VDsAAKAGuaSY3RFXFsgFLfoJK6SAALgHKguZKmOZO9GZU4qZOpwpM+CZRCaQCxuZxl6UwKAACFsAIY + IAEUaAkeYAEUOAF6+IAAIJB0eQd3CQAq/4CJksiQkogCKDAIj/AImTiYnZADh6ADaQCKiCkGHGmfjcmR + p1gHkcWfYkeZlCUGzcWcXwWaWGWg1oSgBNqcKseZoomavhhPo9lMpXmapDkJqtmTVtWar7mgHnqAREAA + FBAKroACKUAB26l61xkJqgcJDvCW3fmdcQADDbAC5OmQ5bl0rjAIg4CeAIABAFAM71AMD3AIvgAKOXAG + oHiYORgGpZifQxhvkuWKlTmgDJqgvnigWYqlxPihXtpjW6Wgn7ml0ySmX3qm3rcAAqACsRAKVuYKokAB + HiAJFPgBAJCi2ql6kyAAd9AGTgACKJAI1UZtOVqoDklttYBtKNAzpP/gC75QCjqgpIpZivgJpax4Zz5I + mZKFg2hKTQTQMx5oTZ+aKqG6makiAAnQqVeqcmbqTK1aBK+6qrKagEJwABSgCLFQCA1ACL5XogxIgYbg + AB6Acx9wAZYgCR+QjwOXAonwZdSGbSmAAkBKZakSASmgnn2po9N2CimwArjgqI+aA2awBmrwBWrwpDiY + n42ZRY2FqZpKZzfYfarqfrNarx86qgBQqtKEr/r6gaeaqvYasJqnprznCoDQAOx5gq6gCBQgABYAenQa + CQ7gAB1wc5IAABaQKhgwCPKldK7gCipgiYXwCB1LbSbrConQo+KZoyg4qL3wC46qCjtABjqQCWT/4KSL + 2aTqmp+imEVrgEX1iZECO7TzuqpFe7RXqmsN4AixEAsrYKMe27KnEJ0okIHUKgANgAIrUAi/R6jVlggU + cImBma0oGAuuQAgB0LF8KW3f6qi/QAs5wAnykAwX2aQ8aJ+jmLfrep8aGYo3yAZpR7SCi7SEO7iGW2sH + EG2uEAsqAJgty7KDqnQmG7lfy6ODwG0oEAGO23tkq7BxqrYOuXSyALOOegjEIA/3IAdq0KSlmK73mbeK + uaR/q2OFW7uHG2S2m7vNqQANcApN27hKp606OgjRip4rMAgL2XuxkAIR0DMRoAgR0IKdi6PmWW2isG3U + 27W9AK6HkA2oywxe/wC7i6mROBu7Gfm3WqC76nu7f8e+7vtVCyAE+EZhTMu4m/u4rlAImbsCirCe2LYC + FDB8zbp0i5oqt0oBoNu5opCyPFoImLh0+muoKLi9sJAD6oC65UAGiZm3S5qRpIiYNui3NlhV61vC73vC + JuxV8aicuGYAbBoLhACYhXq21rqQkYuotSAKK7CoKMCeweu0gzC9KJtlAUCtACC2S3et07t0r7ADnOAO + 7iAPFKSRI6yRsBu0PWuD6YvCXJzCKdzFBIBaQXBrDNC7seAIJoijjxABPVy9wgtmp7ACmqutPVyoiVDA + RkytNvyxCLvEJSoC3qAO7nAP4KEGshuKoyiKIv+cmCEcuF/8yOwLyesbBAAQAyZwebZGAIDQtClACF6r + oyiwx9TrxrVQCBTgkA0wiXGax6w8x9VWCBgwytIWfHgQyFF8D5kwn3+ryH+byDcYBpnZxcIsycMsuAjw + ADHAAnOlckGQyrHQbQ/8e6eAAgkswTkaAWp7CqfMkNfLyt7cuwTMq9mavxiQA9XgDeJwwffACbqMxTfo + yxgpr8VMzPQ8z7IqACKAXyxsawqQAk0Ly8LrCikgw7Jc0CrgydX2CCjQl1rmzd4ckWD2CKnMkImwgiaA + B8lQDdkgDuUwyDFgyLsc0jeoBY5sz/WMtGiQ0iq90izd0i790jAd0zI90zT/XdM2DdNUAAAmgF8CcNMt + PQUU0LQoIM6SiGVj25cpUMQOTQLy5QoKzc1K7dCs/MDXmr/Mi8yZIAzJwAwa7Q3loA7MIAJosAfHoAzK + 8AxnndZofQx74NNu/dZwHddyPdd0Xdc2vUJ4LQx5vdd63dd8/dd+HdiAPdiCXdiEfdiGndiI/dc5oNMx + 0NiZsNiJ/QCh0G0fy80UwJdJHAN4wAmKzQksIF88ioIr4M02cNrePAiEKgoAEADInAN9kAmeTQzMEA3Z + 4NXq0AM58Nd7Ldm+rdjA/dvCHdzEPdzGXdzIfdyLjdfKndzO3dzQ/dyJbQKOnQNSwdzPHQMroAL5hILa + /+zDZKsCeCDZfRABOxrEBJzHmZDO6vDV6sAJRrzQ1vZ0LGADOdADeCDbN1Tb51wO1fAAng0M2D3g0V3g + 0m3gCH7gCp7g0E3geu3gAv7gEh7hFA7hFj7hF17hGL7hGt7hGQ7hek3dO+2J+UzhHD7gfY0HWvZlRZ3G + OZoCPSDYhG0ChMCjiOoKzUutfaAO7c3j7t0DRhwLYBsA+fzY+N0HnAAMxJAM0XDO1RADkW3Yh/3hJ17l + Hm7lVH7lWp7lXI7lXr7lX97lYN7hEx7mZj7mYp7mZ67mJp4qI47fJmADbC4C8p2CAXCjKDgIOiDlHN4D + GEAIK6Cjecze7t3jzGDEDf/9ACLAAo+tA3iA5Eq+1dXACTGQ5H6N4iDO5pq+5pyO5p2+6Z4e6qBO4Ay+ + 4KZe6g0uDG5u5EjeAzEQ48st4TkQ6JLYrZ1LCDmg2IAN34pQ58FHrTbg48LO44fOyoo+4o4e23jdA/aN + 6bp+6ace7agu7dQ+7dYO7Sae7dW+7deu3Kaj6Kzu2ZzwACbQA8I97rwqbacQAIb6CDHQ28++QiKwwxBs + xMHe48Ou6t4sAjs9Lz3QB0bzAMjcBzKO7WUO793O7Qqf8Axf7YON8KP+6RIv6hOf1yD25ki+5NHACSZg + An2Q7byt15lA5wvJ3WT7CCSg7SBf2DaAnr73dNRqAsP/7t7lYAMOfez4FQMigMx4cPCY/vAGT/FCH/FD + X/FGX/RIn+bODvQh3/QF7/QI//RSH/VUH/RW39sxUN3/7tlc7dV9wALY7vQ9IAIUcOfUiwFRDvV/jQc/ + unQwT63AMPPqsBTerANSIRWPjeQ+H+9TX/VLf/BXD/h/r/KCX/iEf/hMP/WBj/h8DvWLz/RN7/eGn/iS + z/iOP/iU//gTngngft8Zn9Fe7Q68xPfYzfYU4MAMOQg2EPakj1q+Vwh5/ADAYNs8Xg02780xUNyXP/iT + 3/iKj/m+X/mZD/yX3/vFb/m/b/y/X/nJj/zCH/yaf/zDb/h6vRThLgxcnQ0dzQKW/878FN4HMWCtI/sI + FPDxQQ/5je24p9AAUt3+AA75fX/10g/9xN/80+/80W//9K/8zz///s/6AAEMmLCBAgkeLFgQIUGFDRsi + fJhwocSIERlOvFgRo0GNPQDE6NFnILNq3sq569Fjo8OMFzn1iGHCRAyOKyFOBPYAgytXtVQAABpU6FCi + QHXg3GjTYs2lFG9qhIo0KsupT6VepYrValauW7067Qr2q1aqTZWSbRk27VimbJeu1fHABB5OxJKVPAks + R0azYgeyXcvUY4SihQ1/PAu171O1jRc7Tuw2st/AldtSvmz5seSKZSen9Qw2NGjGW0czPR2aIrAYAEz0 + 4SSMGP8zZjBFW0bLETJrEzlaHwZOk6/St2H9VtVdOnXg25ebK1YePfly56Sro2ZuHXnizZi7a/6cWfx3 + iZxysDCBnkWMHH2Sqn4/fOrS38CLCn/+fvfX4+HJ//cvwO3GEzA3AAeU7jT9cFOwr+KkW5BA8bJbjTgG + w1soLvuEekClCSvErrkIrZPPOPkoFBFEE6dDkUQV+TvxuhRLNA2+D7WjkEauQDQtRhyvu7A46HbkLsYH + B8okBxHseyCH2ObLrUchsToSxu6mbCxH5LAEDMgtR8QMwiolXFEqB60008L+wuRyzPi8U64pHWIIYCi5 + bMCDzTI/fLFN8LL0kiw/+Ywy0D0HBQWTQYkCAgA7 + + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch2 - Snap to Control/Form1.vb b/Ch2 - Snap to Control/Form1.vb new file mode 100644 index 0000000..825016e --- /dev/null +++ b/Ch2 - Snap to Control/Form1.vb @@ -0,0 +1,82 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel + Private Sub InitializeComponent() + Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1)) + Me.Button1 = New System.Windows.Forms.Button() + Me.LinkLabel1 = New System.Windows.Forms.LinkLabel() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Image = CType(resources.GetObject("Button1.Image"), System.Drawing.Bitmap) + Me.Button1.Location = New System.Drawing.Point(192, 48) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(168, 64) + Me.Button1.TabIndex = 1 + ' + 'LinkLabel1 + ' + Me.LinkLabel1.Location = New System.Drawing.Point(24, 16) + Me.LinkLabel1.Name = "LinkLabel1" + Me.LinkLabel1.TabIndex = 2 + Me.LinkLabel1.TabStop = True + Me.LinkLabel1.Text = "Click here to snap!" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(544, 182) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.LinkLabel1, Me.Button1}) + Me.Name = "Form1" + Me.Text = "Snapping to a Control" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked + SnapToControl(Button1) + End Sub + + Public Sub SnapToControl(ByVal Control As Control) + ' Snaps the cursor to the bottom middle of the passed control + Dim objPoint As Point = Control.PointToScreen(New Point(0, 0)) + objPoint.X += (Control.Width / 2) + objPoint.Y += ((Control.Height / 4) * 3) + Cursor.Position = objPoint + End Sub + + +End Class diff --git a/Ch2 - Snap to Control/bin/Ch2 - Snap to Control.exe b/Ch2 - Snap to Control/bin/Ch2 - Snap to Control.exe new file mode 100644 index 0000000..1346f44 Binary files /dev/null and b/Ch2 - Snap to Control/bin/Ch2 - Snap to Control.exe differ diff --git a/Ch2 - Snap to Control/bin/Ch2 - Snap to Control.pdb b/Ch2 - Snap to Control/bin/Ch2 - Snap to Control.pdb new file mode 100644 index 0000000..62e61c8 Binary files /dev/null and b/Ch2 - Snap to Control/bin/Ch2 - Snap to Control.pdb differ diff --git a/Ch2 - Snap to Control/obj/Debug/Ch2 - Snap to Control.exe b/Ch2 - Snap to Control/obj/Debug/Ch2 - Snap to Control.exe new file mode 100644 index 0000000..1346f44 Binary files /dev/null and b/Ch2 - Snap to Control/obj/Debug/Ch2 - Snap to Control.exe differ diff --git a/Ch2 - Snap to Control/obj/Debug/Ch2 - Snap to Control.pdb b/Ch2 - Snap to Control/obj/Debug/Ch2 - Snap to Control.pdb new file mode 100644 index 0000000..62e61c8 Binary files /dev/null and b/Ch2 - Snap to Control/obj/Debug/Ch2 - Snap to Control.pdb differ diff --git a/Ch2 - Snap to Control/obj/Debug/Ch2___Snap_to_Control.Form1.resources b/Ch2 - Snap to Control/obj/Debug/Ch2___Snap_to_Control.Form1.resources new file mode 100644 index 0000000..ce46bf5 Binary files /dev/null and b/Ch2 - Snap to Control/obj/Debug/Ch2___Snap_to_Control.Form1.resources differ diff --git a/Ch2 - Split Panels/AssemblyInfo.vb b/Ch2 - Split Panels/AssemblyInfo.vb new file mode 100644 index 0000000..c0b62a3 --- /dev/null +++ b/Ch2 - Split Panels/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch2 - Split Panels/Ch2 - Split Panels.sln b/Ch2 - Split Panels/Ch2 - Split Panels.sln new file mode 100644 index 0000000..3a0581b --- /dev/null +++ b/Ch2 - Split Panels/Ch2 - Split Panels.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch2 - Split Panels", "Ch2 - Split Panels.vbproj", "{887604CE-848C-448D-8F79-E612EB108B0D}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {887604CE-848C-448D-8F79-E612EB108B0D}.Debug.ActiveCfg = Debug|.NET + {887604CE-848C-448D-8F79-E612EB108B0D}.Debug.Build.0 = Debug|.NET + {887604CE-848C-448D-8F79-E612EB108B0D}.Release.ActiveCfg = Release|.NET + {887604CE-848C-448D-8F79-E612EB108B0D}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch2 - Split Panels/Ch2 - Split Panels.suo b/Ch2 - Split Panels/Ch2 - Split Panels.suo new file mode 100644 index 0000000..9d0e7df Binary files /dev/null and b/Ch2 - Split Panels/Ch2 - Split Panels.suo differ diff --git a/Ch2 - Split Panels/Ch2 - Split Panels.vbproj b/Ch2 - Split Panels/Ch2 - Split Panels.vbproj new file mode 100644 index 0000000..e777e27 --- /dev/null +++ b/Ch2 - Split Panels/Ch2 - Split Panels.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch2 - Split Panels/Ch2 - Split Panels.vbproj.user b/Ch2 - Split Panels/Ch2 - Split Panels.vbproj.user new file mode 100644 index 0000000..447fdc6 --- /dev/null +++ b/Ch2 - Split Panels/Ch2 - Split Panels.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch2 - Split Panels/Form1.resx b/Ch2 - Split Panels/Form1.resx new file mode 100644 index 0000000..4be049c --- /dev/null +++ b/Ch2 - Split Panels/Form1.resx @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch2 - Split Panels/Form1.vb b/Ch2 - Split Panels/Form1.vb new file mode 100644 index 0000000..a8ab01d --- /dev/null +++ b/Ch2 - Split Panels/Form1.vb @@ -0,0 +1,83 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents TreeView1 As System.Windows.Forms.TreeView + Friend WithEvents ListView1 As System.Windows.Forms.ListView + Friend WithEvents Splitter1 As System.Windows.Forms.Splitter + Private Sub InitializeComponent() + Me.TreeView1 = New System.Windows.Forms.TreeView() + Me.ListView1 = New System.Windows.Forms.ListView() + Me.Splitter1 = New System.Windows.Forms.Splitter() + Me.SuspendLayout() + ' + 'TreeView1 + ' + Me.TreeView1.Dock = System.Windows.Forms.DockStyle.Left + Me.TreeView1.ImageIndex = -1 + Me.TreeView1.Name = "TreeView1" + Me.TreeView1.SelectedImageIndex = -1 + Me.TreeView1.Size = New System.Drawing.Size(120, 261) + Me.TreeView1.TabIndex = 0 + ' + 'ListView1 + ' + Me.ListView1.Dock = System.Windows.Forms.DockStyle.Fill + Me.ListView1.Location = New System.Drawing.Point(120, 0) + Me.ListView1.Name = "ListView1" + Me.ListView1.Size = New System.Drawing.Size(232, 261) + Me.ListView1.TabIndex = 1 + ' + 'Splitter1 + ' + Me.Splitter1.Location = New System.Drawing.Point(120, 0) + Me.Splitter1.Name = "Splitter1" + Me.Splitter1.Size = New System.Drawing.Size(3, 261) + Me.Splitter1.TabIndex = 2 + Me.Splitter1.TabStop = False + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(352, 261) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Splitter1, Me.ListView1, Me.TreeView1}) + Me.Name = "Form1" + Me.Text = "Creating Split Panels, Explorer-Style" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + TreeView1.Nodes.Add("Example entry") + ListView1.Items.Add("Sample data") + End Sub +End Class diff --git a/Ch2 - Split Panels/bin/Ch2 - Split Panels.exe b/Ch2 - Split Panels/bin/Ch2 - Split Panels.exe new file mode 100644 index 0000000..b2a121f Binary files /dev/null and b/Ch2 - Split Panels/bin/Ch2 - Split Panels.exe differ diff --git a/Ch2 - Split Panels/bin/Ch2 - Split Panels.pdb b/Ch2 - Split Panels/bin/Ch2 - Split Panels.pdb new file mode 100644 index 0000000..fa6c147 Binary files /dev/null and b/Ch2 - Split Panels/bin/Ch2 - Split Panels.pdb differ diff --git a/Ch2 - Split Panels/obj/Debug/Ch2 - Split Panels.exe b/Ch2 - Split Panels/obj/Debug/Ch2 - Split Panels.exe new file mode 100644 index 0000000..b2a121f Binary files /dev/null and b/Ch2 - Split Panels/obj/Debug/Ch2 - Split Panels.exe differ diff --git a/Ch2 - Split Panels/obj/Debug/Ch2 - Split Panels.pdb b/Ch2 - Split Panels/obj/Debug/Ch2 - Split Panels.pdb new file mode 100644 index 0000000..fa6c147 Binary files /dev/null and b/Ch2 - Split Panels/obj/Debug/Ch2 - Split Panels.pdb differ diff --git a/Ch2 - Split Panels/obj/Debug/Ch2___Split_Panels.Form1.resources b/Ch2 - Split Panels/obj/Debug/Ch2___Split_Panels.Form1.resources new file mode 100644 index 0000000..275fc2e Binary files /dev/null and b/Ch2 - Split Panels/obj/Debug/Ch2___Split_Panels.Form1.resources differ diff --git a/Ch2 - Updater Component/Dot Net Updater Component.htm b/Ch2 - Updater Component/Dot Net Updater Component.htm new file mode 100644 index 0000000..b1d79a3 --- /dev/null +++ b/Ch2 - Updater Component/Dot Net Updater Component.htm @@ -0,0 +1,2318 @@ + + +.NET Application Updater Component + + + + + +
+ + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + +
+ + + + +
Search  +
+ +
Sign in with your Passport.
+ + + + + +
+
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ +
+ +
.NET + Application Updater Component

+
+

Download + the .NET Application Updater Component

+

+

.NET Client + Applications: .NET + Application Updater Component

+

+

I + recently received a mail from the + Microsoft IT team notifying me that they had detected several + applications on my desktop computer that did not have the latest + patches installed and instructed me to install the latest + updates. Ill be the first to + admit that I dont update the applications I run as much as I should; + either on my home machine or on my work machines. It usually takes a problem like a + broken feature in an application or an email (or sometimes several) + from the IT department, to get me to install updates. Unfortunately Im more of the rule + than the exception when it comes to users updating their + applications. +

+

+

This requirement of + needing a user or admin to manually install an update is why rolling + out client updates has traditionally been such a huge problem and + expense. One solution is to + move the responsibility of updating the application from the user to + the application itself. + Instead of the user obtaining and installing a software + update, the client application itself is responsible for downloading + and installing updates from a well known server. The only user interaction + necessary is whether or not they want to install the new updates now + or later. You can see this + type of approach to updating applications in action today with + products like Windows XP and Microsoft Money.

+

+

In this article we will + talk about an approach to building .NET client applications that are + able to automatically update themselves.

+

+

+

The .NET Application + Updater Component

+

Included with this + whitepaper is a component for enabling .NET client applications to + automatically update themselves. + The component was written using the .NET Framework and + enables you to make your application auto-updatable simply by + dropping the component into your existing .NET applications and + setting a few properties (ex. where to get updates from). Download + the .NET Application Updater Component.

+

+

This component is not a + Microsoft product. It is + intended as a sample to get you started and as such the source is + also included with this whitepaper. + However, it is worth mentioning that this component has + gotten a fair amount of real world use already. It has been used internally in + Microsoft to enable auto-updatability in the .NET Terrarium game (http://www.gotdotnet.com/terrarium/). Terrarium has been installed and + used by over 10,000 individuals since it was first unveiled as a + beta product in October, 2001.

+

+

This component will be + the basis for the discussion of what it takes to make an application + auto-updatable. This paper + will focus on how the .NET Application Updater component works and + how you can use it in your own application.

+

+

+

Checking for + Updates

+

The first thing an + application needs to be able to do in order to update itself is + figure out when a new update is available. In order to do this an application + needs to know three things 1) where to check for updates, 2) when to + check for updates and 3) how to check for updates. The application update component + uses HTTP for all network communication. This allows it to update + applications over the intranet or extranet. Thus the where to check for + updates is simply a URL to a well known Web server.

+

+

To address the when to + check for updates, the .NET Application Updater component creates a + thread on component creation which is responsible for checking for + updates. This thread will + sleep for most of the time, but will wake up at the configured + interval to perform an update check. + How often the application checks for new updates is dependent + on the individual application, but common values range from one hour + to one day between update checks. + This polling based approach is not appropriate for all + applications, for example Microsoft Money only checks for updates + when the user tells them to. + In this case, the update poller thread can be disabled and + update checks performed on-demand by calling the CheckForUpdate() + method on the updater component. +

+

+

There are several ways + to go about the how to check for updates:

+

+

Method #1: Direct File Check The simplest way to + check for updates is to use HTTP to compare the last modified + date/time stamp of the application files on the server with that on + the client. If the server has + newer files, the client knows its time to update itself. This is the same way a Web browser + knows if it needs to re-download an html page or image or whether it + can just re-use the one previously downloaded. This is certainly the simplest to + administrate. When a new + version of the app is available, the administrator simply copies the + newer version over the older version on the Web server. The problem with this is that the + update is not atomic and thus there are potential windows of + failure. For example, if an + administrator updates the version of the app on the Web server while + a client was in the middle of downloading the previous update, that + client may be left with some files from the previous update and some + files from new update. For + this reason, using a direct file check is not recommended for any + non-trivial applications. +

+

+

Method #2: Manifest Check To solve the atomicity + problem with direct file checks a level of indirection is + needed. To create a level of + indirection a manifest file on the server is used. A valid server manifest file for + use with the .NET Application Updater component looks like + this:

+

+

<VersionConfig>

+

<AvailableVersion>1.0.0.0</AvailableVersion>

+

<ApplicationUrl>http://localhost/demos/selfupdate/V1/</ApplicationUrl>

+

</VersionConfig>

+

+

AvailableVersion + specifies the assembly version number of the latest available + version. The ApplicationURL + property specifies the URL where that version of the application + resides. When the + administrator wants to update the client applications, they would + copy the new version of the app up to the Web server and modify the + server manifest file appropriately. + The client itself will then detect that the server manifest + file has changed and download the manifest file. The client then compares the + assembly version number specified in the manifest with the assembly + version number of the applications .exe file. If the server manifest file + AvailableVersion is newer, the application knows its time to perform + an update. This approach has + none of the atomicity problems of the previous approach and is the + recommended way to check for updates for most applications.

+

+

Method #3: XML Web Service + Check + XML Web services provide a way to perform more advanced update + checks. For example, suppose + you wanted to roll out an update to a set of early adopters before + you rolled it out to the rest of your users. If the client application calls an + XML Web service to check if an update is available, that XML Web + service could then look up that user in a database and determine if + the user is an early adopter or not. + If they are, the XML Web service could return a value + indicating that an update is available. If not, the Web service could + return a value indicating that a new update is not available. Because the Web service used to + check for updates could take many forms depending on what custom + functionality is desired, the .NET Application Updater component + does not provide direct XML Web service support. To use an XML Web service to check + for updates, first build the XML Web service and then hook the + OnCheckForUpdate event. This + allows the poller threads update check to be replaced with your own + custom check. The + OnCheckForUpdate event has a return value to indicate whether an + update was detected or not.

+

+

+

Downloading + Updates

+

Once the application + determines a new update is available, the update needs to be + downloaded. By default, when + the .NET Application Updater component detects that a new update is + available it will automatically kick off another thread and start an + asynchronous background download of the update. The download is done using + HTTP-DAV. DAV is an extension + to HTTP that provides functionality such as directory and file + enumeration. A complete and + deep download is done starting with the specified URL. The URL used to download depends + on the type of update check being done. For example, if a server manifest + is used, the URL to download the update from is specified by the + ApplicationURL property in the server +manifest.

+

+

The download of the + update obviously needs to be robust. + Leaving the client application in any kind of bad state after + the download and update is unacceptable. Any number of problems could occur + during the download: The Web + server where the update resides could go down, the client machine + could crash, or for that matter the user could simply shut down the + application itself. Since the + application is what is doing the download, if its shut down, the + download will stop. An + alternative design would have been to use a separate system service + to do the download and update of the application. With a system service, the + download of the update could continue even when the application + itself is not running. In + fact, Windows XP has a built-in download service called BITS for + just this purpose. BITS is + what Windows XP uses to download updates to Windows itself. For more information on BITS, see + http://msdn.microsoft.com/library/en-us/dnwxp/html/WinXP_BITS.asp. A service was not used in the .NET + Application Updater component so that it would work on the Windows + 9x operating systems which do not support system services. +

+

+

The .NET Application + Updater component achieves robustness by breaking the download and + update process into separate stages. + As each stage is complete, it is recorded in an updater + manifest file which resides in the application directory on the + client. If the download or + update process is interrupted at any stage, it will simply resume + from the point of the last completed phase the next time the app is + started. Each stage is re-run + able so that if a failure occurs in the middle of a stage, + re-running the stage from start will succeed. If an error occurs, such as the + loss of connectivity with the Web server during a download, the .NET + Application Updater component will simply try again later. If enough failures are reported + (ex. The Web server never came back online), the download and update + will be aborted and an error reported.

+

+

+

Performing + updates

+

Once the new update has + been downloaded, the last step is to apply the update. This last step is by far the most + challenging. The fundamental + problem is that the application is trying to update its own files + while running. Thus the files + are locked. The only way to + unlock the files is to stop the application, but if you stop the + application, how can it update its files? Its a catch 22. We went through several designs + before we came up with our final approach. Before I describe the final + design, lets look at our first approach and describe its + shortcomings. +

+

+

Our first approach was + to simply kick off a separate process to perform the update. This separate process would first + shut down the application process, perform the update (since the + files were now unlocked), restart the application process and then + shut itself down when complete. + However, there were three fundamental problems with this + design:

+
    +
  • It simply did not work + in some scenarios. For + example, Windows runs screen savers in what is called a Job + object. The defining + characteristic of a Job is that when the root process of a Job is + shut down, all processes it created are also shut down. This makes sense when you think + about it. When a screen + saver goes away, you want to make sure it all goes away. However, in the application + update case, when the updater process shut down the original + application process, the updater process itself would also be shut + down and thus no update performed. +
  • We wanted to be able + to automatically update all of the code that performed the + update. In the course of + use, we would find bugs in the .NET Application Updater component, + (ex. A timing window that would effect 1% of clients), and we + wanted the ability to automatically roll out fixes of not just the + application, but the .NET Application Updater component as + well. With this model, we + could not update the process that performed the + update. +
  • Forcing the user to + shut down the application and wait in the middle of use was + undesirable. +
+

+

The final approach used + to perform the application update was inspired by the side-by-side + assembly model of the .NET Framework. Instead of trying to update the + application itself, create a new upto-date version of the + application next to the existing version. The new version can be created by + merging the existing application directory with the downloaded + update. When the new version + is complete, the user will automatically use that version the next + time they launch the application. + The original copy of the application can then be removed. + This tricky part is figuring out which version to launch at any + given time. To do that, a + program named Appstart is introduced. Appstart is the entry point into + your application. With this + model, your application directory will look something like + this:

+

+

Program Files +

+

MyApp +

+

Appstart.exe

+

Appstart.config

+

V1 + Folder

+

MyApp.exe

+

V1.1 + Folder

+

MyApp.exe

+

+

To run your application, + you always run Appstart.exe. + If you want a shortcut on the desktop, the shortcut should + point at Appstart, not at the application directly (Note that you + can rename AppStart.exe to be whatever you want, ex. + YourApp.exe). Appstart.exe is + a very simple program that reads the Appstart.config file and + launches the specified application. + A valid Appstart.config file looks like the following:

+

+

<Config>

+

<AppFolderName>V1 + Folder</AppFolderName>

+

<AppExeName>MyApp.exe</AppExeName>

+

<AppLaunchMode>appdomain</AppLaunchMode>

+

</Config>

+

+

The AppFolderName + specifies the subfolder that contains the current version of the app + to run. The AppExeName + contains the name of the exe within that folder to launch. When an application update is + complete, the final step is to change the AppFolderName value to + point at the new version of the application. Thus the next time the user runs + the application, they will run the new updated version of the + application. The + AppLaunchMode specifies how to launch the application. There are two ways to launch the + application. This first + approach is with AppDomains. + AppDomains are a feature of the .NET Framework common + language runtime and the logical unit of isolation and + administration of objects. + The common language runtime allows multiple application + domains per process. Thus + Appstart.exe can launch your application in a separate AppDomain but + within the same AppStart.exe process. Thus, despite the fact that two + different exes are running (in this case Appstart.exe and + MyApp.exe), only one process is used. For most applications AppDomains + will work well, however there are a few minor differences with + running in a separate AppDomain vs. a separate process. For that case, the AppLaunchMode + can be set to process which will cause the application to launch in + a separate process.

+

+

Once Appstart has + started the application, it will go to sleep and wait for the + application to terminate. + Once the application terminates, Appstart will also shut + down. However, if the + application shuts down with a well known return code, the Appstart + process will re-read the Appstart.config file and re-launch the + application. This is useful + if the user wants to begin using the new version of the application + immediately after it is available.

+

+

+

Using the .NET + Application Updater Component

+

Now that weve discussed + how the .NET Application Updater works, lets put it in action. First we will build a very simple + Windows Forms application. + Then we will enable it to auto-update itself using the .NET + Application Updater component. + Finally well deploy the application and see the auto-update + feature in action.

+

+

Included with this paper + is a zip file named DotNetUpdater.zip that contains the .NET + Application Updater component. + The zip file also contains a Sample directory which contains + a number of files and folders we will be using in this walkthrough. +

+

+

Step 1: Build the application to + update

+

In this step we will + build the application to auto-update. If you want, you can substitute in + your own application here. + You can also use the pre-built sample application included in + the Samples\SampleApp\SampleApp directory of the zip file. However for the purpose of proving + that there isnt anything special about SampleApp, well walk through + its creation.

+

+

1.       + Use Visual Studio .NET + to create a new Windows Application project, name it SampleApp.

+

2.       + Give the form an + interesting background color of your choice. We will be using background color + to differentiate between versions later.

+

3.       + Now lets add a tiny bit + of functionality to this application in the form of a button that + opens a form residing in a separate assembly. First add a button to your + form. The zip file contains + an assembly with a simple Windows Form in it. Add a reference to the + Samples\SampleApp\SimpleForm assembly in the zip. Then add two lines of code to your + button event handler:

+

+

SimpleForm.Form1 F = new + SimpleForm.Form1();

+

F.Show();

+

+

4.       + Switch your build flag + to build RELEASE instead of debug. + This will allow us to avoid pdb file locking problems later + when we build a new version of the application while the original + copy is still running. +

+

5.       + Build and test your + application. It should look + similar to the Samples\SampleApp\SampleApp in the zip + file.

+

+

Step 2: Add the .NET Application Updater + Component

+

In this step we will add + the .NET Application Updater component to + SampleApp.

+

+

1.       + In the components tab of + the Visual Studio .NET toolbox, right click and select Customize + Toolbox. Select the .NET Framework Components tab. Browse and select the + AppUpdater.dll in the AppUpdater project included in the zip. Click OK.

+

2.       + An AppUpdater icon + should now show up at the bottom of the list of components in the + toolbox. Drag and drop the + AppUpdater component onto the SampleApp Form. An appUpdater1 instance of the + .NET Application Updater component should be instantiated and appear + below the form.

+

+

Step 3: Configure the .NET Application + Updater Component

+

In this step we will + configure the .NET Application Updater component. To do this, select the appUpdater1 + component and open its properties. + The following section contains a description of each property + and what value to set it to. + Note that you only need to change the first four properties + for this example, for the rest, the defaults are + adequate.

+

+

AppUpdater + Properties These are the core + properties of the .NET Application Updater and will need to be set + for this application as follows:

+

+ + + + + + + + + + + + + + + + +
+

Property + Name

+

Description

+

AutoFileLoad

+

+

This controls the + on-demand download feature described later, for now set this + to true.

+

ChangeDetectionMode

+

+

This enum + determines how to check for updates. In this example, we will use + a server manifest check, so set this value to + ServerManifestCheck.

+

ShowDefaultUI

+

+

The .NET + Application Updater component has a set of simple UI for + notifying the user of events such as a new update becoming + available or errors during updates. This UI can be replaced with + custom application specific UI by disabling the default UI, + hooking the appropriate events (ex. OnUpdateComplete) and + popping up the custom UI. + For this example we will use the default UI, so set + this value to true.

+

UpdateUrl

+

+

The UpdateUrl is + what determines where the updater looks for updates. In this case we are using a + server manifest to check for updates, so this property should + be set to the URL of the server manifest. For this example, set it to + http://yourWebserver/SampleApp_ServerSetup/UpdateVersion.xml. Replace yourWebserver with + the name of your Web server. +

+


Downloader + Properties The AppUpdater component has two + sub-components. The first is + called the Downloader and controls the download and installation of + the component. Below is a + description of the properties, but all defaults will work fine for + our SampleApp.

+

+ + + + + + + + + + + + + + + + +
+

Property + Name

+

Description

+

DownloadRetryAttempts

+

+

If a failure + occurs during download (ex the Web server goes down) the + downloader will try again a little later. This property controls the + number of times the downloader will retry the network request + before treating it as a complete application update failure. +

+

SecondsBeteweenDownloadRety

+

+

The number of + seconds before retrying the network + request.

+

UpdateRetryAttempts

+

+

If a serious error + occurs during the update process, (ex. The downloader has + exceeded the DownloadRetryAttempts), an application update + error is generated. By + default, the update attempt will stop, but will attempt to + resume the next time the application is started (ex maybe the + update Web server was just down for day). This property controls how + many times an update will be attempted. If this value is exceeded, + the updater aborts the update, resets its state and goes back + to checking for updates. +

+

ValidateAssemblies

+

+

This controls the + level of validation done on downloaded assemblies. See the security section of + this paper for more + info.

+

+

Poller + Properties The second + sub-component of the AppUpdater is the Poller. The Poller controls the update + checks. Below is a + description of the properties, but all defaults will work fine for + our SampleApp.

+

+ + + + + + + + + + + + + + + + +
+

Property + Name

+

Description

+

AutoStart

+

+

A Boolean that + controls whether or not the Poller should begin polling for + updates on application startup or whether it should wait until + it is explicitly started + programmatically.

+

DownloadOnDetection

+

A Boolean that + controls whether or not the Poller starts a download of an update + immediately after a new update is found, or whether the + download must be started explicitly by a call to the + DownloadUdpate() method.

+

InitialPollInterval

+

+

The number of + seconds after application startup before the first update + check is performed.

+

PollInterval

+

+

After the first + update check, the PollInterval controls the number of seconds + between each subsequent update check. Note: By default this checks every + 30 seconds; clearly you will want to reduce the frequency for + your application.

+

+

When all is said and + done, your property grid should look the + following:

+

+

+

+

+

The + Samples\SampleApp\SampleApp_Complete directory contains a version of + the application correctly setup.

+

+

Step 4: Build & Deploy V1 of the + application to the client

+

In this step we will + build the V1 version of the application and deploy it to the + client. The deployment is + essentially simulating what the install program for your application + will do. +

+

+

1.       + In the SampleApp + project, open the AssemblyInfo.cs file. Change the AssemblyVersion value + from "1.0.*" to 1.0.0.0. This + will cause the built assembly to get marked with a value of 1.0.0.0 + instead of the ever increasing value Visual Studio normally + assigns.

+

2.       + Build the + application.

+

3.       + Copy the + Samples\SampleApp\SampleApp_ClientSetup directory from the zip onto + your local machine. It doesnt + matter where you copy it, however the program files directory is the + most realistic place to put it since that is where most applications + get installed. Youll notice + that SampleApp_ClientSetup directory already has AppStart.exe + included. AppStart.config is + already set to point into the 1.0.0.0 directory and run + SampleApp.exe.

+

4.       + Copy the complete + SampleApp (Appupdater.dll, SimpleForm.dll & SampleApp.exe) from + the release build directory of SampleApp to the + SampleApp_ClientSetup\1.0.0.0 directory on your client.

+

+

At this point a fully + functional version of the application should be installed on the + client and executable by running AppStart.exe

+

+

Step 5: Setup the Web + server

+

In this step we will + setup the Web server for use in rolling out application + updates. The .NET Application + Updater component uses HTTP-DAV to download the application update + and thus requires a Web server that supports HTTP-DAV. IIS 5.0 that comes with Windows + 2000 and newer operating systems support + HTTP-DAV.

+

+

1.       + Copy the + Samples/SampleApp_ServerSetup directory from the zip into the + wwwroot directory of your Web server. Note: Any location on your Web server + can be used, but be sure to update the UpdateUrl property + accordingly. Notice that + UpdateVersion.xml is already setup for use as the server manifest + file.

+

2.       + For completeness, copy + the V1 version of SampleApp into the 1.0.0.0 folder of the Web + server.

+

3.       + Enable IIS Directory + Browsing for the SampleApp_ServerSetup directory on your Web + server. Since the .NET + Application Updater component enumerates the contents of directories + during download, Directory Browsing must be enabled. To do this, open the Internet + Information Services manager in the control panel. Select the SampleApp_ServerSetup + folder and open its properties. + Select the Directory Tab. + Check Directory Browsing, and click OK.

+

+

Step 6: Automatically update the + application

+

OK, now its time to see + the results of all this hard work by automatically rolling out a new + version. +

+

+

1.       + If the SampleApp version + you deployed to the client isnt running, launch it and leave it + running. Remember to use + AppStart.exe. +

+

2.       + Go back to Visual Studio + and change something noticeable on the SampleApp form (ex change the + background color).

+

3.       + Change the VersionInfo + in AssemblyInfo.cs to be 2.0.0.0.

+

4.       + Rebuild.

+

5.       + Go to the Web server and + create a 2.0.0.0 directory as a peer to the 1.0.0.0 directory. Copy the new version of the + application from the release build directory into the new 2.0.0.0 + directory on the Web server.

+

6.       + Open UpdateVersion.xml + and change AvailableVersion to be 2.0.0.0. Change the ApplicationURL to point + at the new 2.0.0.0 directory.

+

7.       + Save the changes to + UpdateVersion.xml. +

+

+

As soon as you save the + new UpdateVersion.xml, within 30 seconds the running copy of + SampleApp should detect the newly available version. SampleApp will then download the + new version, apply the update, and pop up the default UI asking the + user if they want to restart and start using the new version + immediately. Click Yes in + response to this dialog. + SampleApp should restart and be running the new version. + If you look at the client + deployment of SampleApp you will notice there is now a 2.0.0.0 + directory next to the original 1.0.0.0 directory. The 1.0.0.0 directory will be + cleaned up the next time an update occurs.

+

+

+

On-Demand + Install

+

By exploiting the + extensible nature of the .NET Framework, the .NET Application + Updater component is able to enable another feature, On-Demand + installation. By enabling + On-Demand installation, only the main exe needs to be explicitly + installed on the client. The + remainder of the application can be automatically downloaded and + installed on an as needed basis.

+

+

You can see this feature + in action with the SampleApp you just finished building and + deploying. In SampleApp we + enabled the On-Demand install feature by setting the AutoFileLoad + property to true. First close + SampleApp if it is still running. + Next, in the 2.0.0.0 folder of the SampleApp client + deployment, delete SimpleForm.dll. + Youll recall that SimpleForm.dll is the assembly that + contains the form that is displayed when the button on SampleApp is + clicked. With SimpleForm.dll + deleted, you would expect the application to throw an exception when + the button is clicked. Go + ahead and try it by running SampleApp (remember to use AppStart.exe) + and click the button in SampleApp. +

+

+

What happened? It worked. In fact if you look in the 2.0.0.0 + folder youll see that SimpleForm.dll has reappeared. So how did this happen? The CLR is fundamentally + programmable and extensible. + When the CLR could not find the SimpleForm.dll assembly, + instead of simply failing, it raised the AppDomain.AssemblyResolve + event. The .NET Application + Updater component hooks that event. + The .NET Application Updater component knows where a valid + copy of SimpleForm.dll resides; on the deployment Web server. It then downloads the assembly to + the local application directory and tells the CLR to try to load the + assembly again. The second + load attempt then succeeds. +

+

+

On-Demand installation + is enabled and disabled via the AutoFileLoad property on the .NET + Application Updater component. + It is a powerful feature that can make the initial download + and install of your application tiny, but can be difficult to use + correctly. You must think + hard about where the assembly boundaries reside in your application + and what actions will cause an assembly to be downloaded. Because the assembly download + involves network I/O, it will take variable lengths of time to + download. During the assembly + download, the application is frozen waiting for the assembly + download to complete.

+

+

+

Deployment + Security

+

While the ability to + roll out application updates automatically has great benefits, it + also comes with an inherent danger. + When you make it easier to roll out updates, if not careful, + you could also make it easier to roll out malicious code. There are two dangers. The first danger is that someone + will spoof the Web server used to deploy updates with their own Web + server. They could then use + that Web server to roll out a virus in place of your + application. The easiest way + to prevent spoofing or any other tampering over the wire is to use + HTTPS. To use HTTPS with the + .NET Application Updater component, simply use HTTPS URLs in place + of HTTP URLs. +

+

+

However, HTTPS is not a + silver bullet. There are two + problems with HTTPS. The first is scalability. Using HTTPS requires the server to + encrypt all of the files that are downloaded from the Web + server. If an application + update is large, the cost of encrypting the update can overburden + the server. The other issue + with HTTPS is that it does nothing to address the second security + danger. The second danger has + to do with your Web server being compromised, either from an insider + or from an outsider hacking your server. If your Web server is compromised, + its bad enough, but if it also means that a thousand clients are + also compromised via automatic updates, it could be disastrous. +

+

+

To solve this problem, + the .NET Application Updater component uses the ability to strong + name a .NET assembly to verify the authenticity of the assembly upon + download. If the .NET + Application Updater detects that an assembly is not signed with your + applications key during download, the update is aborted. This means that only someone that + has the private key of your application can build updates that can + be automatically deployed. + .NET security is based on keeping your private key + secret. Even inside your own + organization, only the few select people should have access to your + private key.

+

+

To validate assemblies, + the .NET Application Updater component verifies that the public key + on the exe of your current installed application matches the public + key on downloaded updates. + The embedded public key can only be the same if the two + assemblies were signed with the same secret private key. Because the assembly is loaded by + the CLR in order to verify its public key, the CLR does its normal + hash value check to ensure the assembly is in fact a real assembly + and has not been tampered with. + If a verification check fails, it is treated just like any + other update failure. To + enable verification on download, simply strong name all of your + application assemblies and set the ValidateAssemblies property on + the .NET Application Updater component to True.

+

+

Assembly validation on + download works great, but in practice, applications will often have + components signed with different private keys. For example, your application may + have two files: The exe + assembly signed with your private key and a dll assembly that + contains a 3rd party charting control you purchased to + use in your application. This + 3rd party assembly may be signed with the 3rd + partys private key and not yours. + What makes it even more complicated is that the set of valid + private keys that can be used to sign assemblies in your application + could change from version to version. How do you auto-update these types + of applications? To solve + this problem, you create an assembly that contains a list of valid + public keys for your application. + Sign this assembly with the applications main private key + (the key that the exe of the application is signed with) and place + this assembly in the directory with the application update on the + Web server. Before the update + download process begins, the .NET Application Updater will check for + a well known assembly AppUpdaterKeys.dll in the application update + directory on the server. If + present, the assembly will be downloaded. The assembly will be verified + against the main application public key. If the signature is valid, the + list of keys will be extracted. + From that point on, any of the keys in that list will be + treated as valid signatures for the files in the update. The zip file that comes with this + paper contains an AppUpdaterKeys project that can be used to build + your own AppUpdaterKeys assembly. + The AppUpdaterKeys.dll also allows you to specify a set of + file exceptions. Files + specified as exceptions can be downloaded and updated without + passing the validation check. + This can be useful when your application contains + non-assembly files, such as pdb files for + debugging.

+

+

The recommended approach + to security is to use HTTPS URLs to perform update checks. This provides a first level of + spoofing protection. For + update download, its best not to use HTTPS URLs to avoid the + overhead on your Web server. + Instead, strong name your application assemblies and enable + the Validate Assemblies feature.

+

+

+

Extensibility and + Terrarium

+

In the sample we walked + through earlier in this paper we enabled auto-deployment in an + application simply by dropping a component into an application and + setting some properties. + While this works well for many applications, some + applications require a higher degree of control that can only be + achieved by writing code. The + .NET Application Updater component has an API that can be used to + customize and replace application update behavior. The .NET Terrarium game (http://www.gotdotnet.com/terrarium/) + I mentioned earlier is a heavy user of these extensibility + hooks. Lets take a look at + how Terrarium uses the .NET Application Updater components + extensibility mechanisms. +

+

+

Terrarium uses a custom + XML Web service to check for updates. Terrarium hooks the + OnCheckForUpdate event of the .NET Application Updater component and + calls the XML Web service within this event handler. OnCheckForUpdate fires on the + poller thread. Thus the XML + Web service request is performed on a separate thread from the UI + thread and does not lock the UI. + The call to the XML Web service passes the assembly version + of the clients current Terrarium install. The XML Web service then decides + whether or not a newer update is available for that client. Two values are returned. The first indicates whether or not + an update is available. The + second is the URL where the update resides. For scalability reasons, in + practice, one server is used to check for updates and a separate + server is used to download updates. + On the return from the XML Web service call, if a new update + is available, Terrarium sets the UpdateUrl property of the .NET + Application Updater component to the URL returned from the Web + service. This instructs the + .NET Application Updater to use that URL for the next update + download. Finally, Terrarium + returns true in the OnCheckForUpdate event handler if an update is + available.

+

+

Terrarium also uses the + custom XML Web service to increase scalability. Updates to Terrarium exceed 10 MB + in size. Terrarium also + checks for updates very frequently. + Thus, in the beginning, when a new update was rolled out, it + wasnt uncommon to have hundreds of clients asking for updates at + once. This resulted in + Gigabytes worth of download requests and the server couldnt handle + the load. Moving away from + using HTTPS and decreasing the frequency of update checks helped the + situation, but the ultimate solution was to build some intelligence + into the XML Web service. + When the server is under load, the XML Web service only tells + the first X number of clients that an update is available. All of the rest are told that no + new update is available. The + next time the clients check for updates, the next X set of clients + are told an update is available. + In this way, the update is rolled out in waves and the server + is not overloaded. +

+

+

Terrarium puts up its + own custom UI that integrates better with the overall + application. Thus Terrarium + disables the default .NET Application Updater UI. Terrarium hooks the + OnUpdateComplete event. The + OnUpdateComplete event includes a set of information, such as + whether or not the update was successful, what, if anything, caused + failure, and an English string with an explanation of the problem + that can be presented to the user. + The OnUpdateComplete event fires on the main UI thread of the + application. Thus Terrarium + raises UI to the user, informing them of update success or failure, + directly in the OnUpdateComplete event handler.

+

+

The .NET Application + Updater component also includes additional APIs that allow explicit + control over when actions like update checks and updates are + performed. These actions are + controllable via the CheckForUpdate () and ApplyUpdate() methods + respectively. +

+

+

+

Debugging

+

The source code for the + .NET Application Updater component is provided so that you can debug + problems and add functionality as needed. However, before you dive too far + into the source code, this section will spell out some first level + debugging options, as well as describe the most frequently + encountered problems by consumers of this component.

+

+

The .NET Application + Updater creates a hidden log file named AppUpdate.log that resides + in the same directory as AppStart.exe. All successful and failed updates + are recorded in this log. The + log file is especially useful when there is a particular client + machine that wont update successfully. You can use the log to determine + when and how the update failed. + In addition, the .NET Application Updater component uses the + Debug class of the .NET Framework to write out a lot of useful + information. If you run your + application in the debugger, you will see this information in the + output window. You can + essentially watch the .NET Application Updater go through its update + steps and see where the problem is occurring.

+

+

If for whatever reason, + you just cant get the .NET Application Updater to work, make sure of + the following before you debug too far, more than likely one of + these is the problem you are encountering:

+

+
    +
  • Do you have IIS + Directory Browsing turned on? + If not, the downloader will see an empty directory on the + Web server where the update resides. The updater will then download + and install an update of zero files, leaving you with the original + unchanged application. See the Setting up the Web server section + earlier in this paper for instructions on how to enable Directory + Browsing. +
  • Do you have everything + deployed correctly and the correct URLs set? Its easy to make a mistake + here. Look at the URLs + being output by the .NET Application Updater when running in the + debugger. Navigate to these + URLs in the browser and make sure they are + valid. +
  • If your app is + installed in the program files directory, are you an admin or + power user on the box? If + not, you wont have the write access necessary to update the + application. +
  • Did you create the + AppUpdater object on the main UI thread of the application? If not, the updater will not be + able to present UI and will fail when firing events back to the UI + thread. +
  • Is the update + succeeding, but the app failing to automatically restart to pick + up new updates? The .NET + Application Updater component attempts to restart the application + by calling the Application.Exit method. However, that method is not + guaranteed to shut down an application. If you spawn & leave + separate threads running, it will not close the process. The solution is to ensure that + all threads are terminated via the Application.OnExit event, or + hook the .NET Application Updaters OnUpdateComplete event and + handle the shutdown yourself.
+

+

+

Summary

+

Ease of deployment for + client applications was a major goal for the first version of the + .NET Framework. There is no + other technology for building client applications that addresses the + deployment problems as well as the .NET Framework. Ease of deployment will continue + to be a major goal for future versions of the .NET Framework. The .NET Application Updater + component described here represents some of our thinking in terms of + scenarios we would like to enable directly in future versions of the + .NET Framework. However, + until that time the .NET Application Updater component is a great + way to get started building auto-updating applications. +

+

+

+


[Printer + friendly version] +
+ © Copyright 2003 Microsoft Corporation. All + Rights Reserved.
Terms of + Use | Privacy + Statement | Code of + Conduct | About the team + | Contact + Us +

diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/1pix(1).gif b/Ch2 - Updater Component/Dot Net Updater Component_files/1pix(1).gif new file mode 100644 index 0000000..35d42e8 Binary files /dev/null and b/Ch2 - Updater Component/Dot Net Updater Component_files/1pix(1).gif differ diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/1pix.gif b/Ch2 - Updater Component/Dot Net Updater Component_files/1pix.gif new file mode 100644 index 0000000..35d42e8 Binary files /dev/null and b/Ch2 - Updater Component/Dot Net Updater Component_files/1pix.gif differ diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/Menu.js b/Ch2 - Updater Component/Dot Net Updater Component_files/Menu.js new file mode 100644 index 0000000..80f0a47 --- /dev/null +++ b/Ch2 - Updater Component/Dot Net Updater Component_files/Menu.js @@ -0,0 +1,105 @@ +window.onunload = function(){saveState(menuId);} +getState(menuId); +var openDisplay = "block"; +var closedDisplay = "none"; + +// expandit function +// calls toggleSection function after a +// short delay so that images display +// correctly +function expandit(itemId) +{ + window.setTimeout("toggleSection('" + itemId + "')",10); +} + +// toggleSection function +// opens or closes menu section +function toggleSection(itemId) { + var arrowId = itemId.replace("SectionPanel", "ArrowImage"); + var arrow, item; + + if (document.all) { + item = document.all[itemId]; + arrow = document.all[arrowId]; + } + + if (!document.all && document.getElementById) { + item = document.getElementById(itemId); + arrow = document.getElementById(arrowId); + } + + if (item.style.display == closedDisplay) { + arrow.src = arrowDown.src; + item.style.display = openDisplay; + } + else { + arrow.src = arrowRight.src; + item.style.display = closedDisplay; + } +} + +// saveState function +// sets the state of each menu section and +// adds the open menu sections to a cookie +function saveState(menuId) { + var cookieInfo = ""; + for (i = 0; i < sectionCount; i++) { + var item; + var itemId = menuClientId.replace(menuId + "_Menu",menuId + "_MenuSections__ctl" + i + "_SectionPanel"); + + if (document.all) { + item = document.all[itemId]; + } + if (!document.all && document.getElementById) { + item = document.getElementById(itemId); + } + if (item.style.display == openDisplay) + cookieInfo = cookieInfo + "|" + i; + } + setCookie(menuCookieName,cookieInfo, getExpirationDate(1)); +} + +// getState function +// gets and opens menu sections based on +// the values from the cookie set in saveState +function getState(menuId) { + var sections = new Array(); + sections = getCookie(menuCookieName).split("|"); + for (i = 1; i < sections.length; i++) { + if (i < sectionCount-1) { + var itemId = menuClientId.replace(menuId + "_Menu",menuId + "_MenuSections__ctl" + sections[i] + "_SectionPanel"); + expandit(itemId); + } + } +} + +// getCookie function +// gets the menu cookie +function getCookie(cookieName) { + var cookie; + cookie = "" + document.cookie; + var start = cookie.indexOf(cookieName); + if (cookie == "" || start == -1) + return ""; + var end = cookie.indexOf(';',start); + if (end == -1) + end = cookie.length; + return unescape(cookie.substring(start+cookieName.length + 1,end)); +} + +// setCookie function +// sets the menu cookie +function setCookie(cookieName, value, expires) { + cookieInfo = cookieName + "=" + escape(value) + ";path=/" + document.cookie = cookieInfo; + return document.cookie; +} + +// getExpirationDate function +// gets the menu cookie from the browser +function getExpirationDate(days){ + today = new Date(); + today.setTime(Date.parse(today) + (days * 60 * 60 * 24 * 100)); + return today.toUTCString(); +} + diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/appupdater_props.jpg b/Ch2 - Updater Component/Dot Net Updater Component_files/appupdater_props.jpg new file mode 100644 index 0000000..c128b7b Binary files /dev/null and b/Ch2 - Updater Component/Dot Net Updater Component_files/appupdater_props.jpg differ diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/footer_bg.gif b/Ch2 - Updater Component/Dot Net Updater Component_files/footer_bg.gif new file mode 100644 index 0000000..d25bde3 Binary files /dev/null and b/Ch2 - Updater Component/Dot Net Updater Component_files/footer_bg.gif differ diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/footer_l.gif b/Ch2 - Updater Component/Dot Net Updater Component_files/footer_l.gif new file mode 100644 index 0000000..a327221 Binary files /dev/null and b/Ch2 - Updater Component/Dot Net Updater Component_files/footer_l.gif differ diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/footer_r.gif b/Ch2 - Updater Component/Dot Net Updater Component_files/footer_r.gif new file mode 100644 index 0000000..c6ab2e1 Binary files /dev/null and b/Ch2 - Updater Component/Dot Net Updater Component_files/footer_r.gif differ diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/gdn_icon_leaving.gif b/Ch2 - Updater Component/Dot Net Updater Component_files/gdn_icon_leaving.gif new file mode 100644 index 0000000..fd72fce Binary files /dev/null and b/Ch2 - Updater Component/Dot Net Updater Component_files/gdn_icon_leaving.gif differ diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/gdn_logo.jpg b/Ch2 - Updater Component/Dot Net Updater Component_files/gdn_logo.jpg new file mode 100644 index 0000000..36fd28b Binary files /dev/null and b/Ch2 - Updater Component/Dot Net Updater Component_files/gdn_logo.jpg differ diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/left_bg.gif b/Ch2 - Updater Component/Dot Net Updater Component_files/left_bg.gif new file mode 100644 index 0000000..b0a1ad8 Binary files /dev/null and b/Ch2 - Updater Component/Dot Net Updater Component_files/left_bg.gif differ diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/leftnav_arrowd_new.gif b/Ch2 - Updater Component/Dot Net Updater Component_files/leftnav_arrowd_new.gif new file mode 100644 index 0000000..3513235 Binary files /dev/null and b/Ch2 - Updater Component/Dot Net Updater Component_files/leftnav_arrowd_new.gif differ diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/leftnav_bottom_new.gif b/Ch2 - Updater Component/Dot Net Updater Component_files/leftnav_bottom_new.gif new file mode 100644 index 0000000..1be1373 Binary files /dev/null and b/Ch2 - Updater Component/Dot Net Updater Component_files/leftnav_bottom_new.gif differ diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/leftnav_top_new.gif b/Ch2 - Updater Component/Dot Net Updater Component_files/leftnav_top_new.gif new file mode 100644 index 0000000..6dc2fca Binary files /dev/null and b/Ch2 - Updater Component/Dot Net Updater Component_files/leftnav_top_new.gif differ diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/nav_footer.gif b/Ch2 - Updater Component/Dot Net Updater Component_files/nav_footer.gif new file mode 100644 index 0000000..16e4df1 Binary files /dev/null and b/Ch2 - Updater Component/Dot Net Updater Component_files/nav_footer.gif differ diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/signin.gif b/Ch2 - Updater Component/Dot Net Updater Component_files/signin.gif new file mode 100644 index 0000000..4099397 Binary files /dev/null and b/Ch2 - Updater Component/Dot Net Updater Component_files/signin.gif differ diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/style.css b/Ch2 - Updater Component/Dot Net Updater Component_files/style.css new file mode 100644 index 0000000..d1c1caf --- /dev/null +++ b/Ch2 - Updater Component/Dot Net Updater Component_files/style.css @@ -0,0 +1,390 @@ +BODY { + FONT-SIZE: x-small; FONT-FAMILY: Verdana, Sans-Serif +} +TD { + FONT-SIZE: x-small; FONT-FAMILY: Verdana, Sans-Serif +} +DIV { + FONT-SIZE: x-small; FONT-FAMILY: Verdana, Sans-Serif +} +A { + COLOR: #000000; TEXT-DECORATION: underline +} +A:hover { + COLOR: #3399ff; TEXT-DECORATION: underline +} +A:active { + COLOR: #0066cc; TEXT-DECORATION: underline +} +H1 { + FONT-WEIGHT: bold; FONT-SIZE: medium; FONT-FAMILY: Verdana, Sans-Serif +} +H2 { + FONT-WEIGHT: bold; FONT-SIZE: small; FONT-FAMILY: Verdana, Sans-Serif +} +H3 { + FONT-WEIGHT: bold; FONT-SIZE: x-small; FONT-FAMILY: Verdana, Sans-Serif +} +LABEL { + FONT-SIZE: 8pt +} +.smalltext { + FONT-SIZE: xx-small +} +.boldtext { + FONT-WEIGHT: bold +} +.ValignMiddle { + VERTICAL-ALIGN: middle +} +.AlignCenter { + TEXT-ALIGN: center +} +TR.normal { + BACKGROUND-COLOR: #ffffff +} +TR.altern { + BACKGROUND-COLOR: #e5f2ff +} +TD.header { + FONT-SIZE: x-small; COLOR: #000000; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #99ccff; TEXT-ALIGN: left +} +TD.featuredheader { + FONT-WEIGHT: bold; FONT-SIZE: x-small; COLOR: #ffffff; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #0066cc; TEXT-ALIGN: left +} +TD.code { + FONT-SIZE: small; FONT-FAMILY: courier +} +A.rollover { + FONT-SIZE: 10px; COLOR: #3399ff; TEXT-DECORATION: none +} +A.rollover:hover { + COLOR: #000000 +} +A.rollover:active { + COLOR: #000000 +} +A.rollovernav { + FONT-SIZE: 10px; COLOR: #ffffff; TEXT-DECORATION: none +} +A.rollovernav:hover { + COLOR: #ffff99 +} +A.rollovernav:active { + COLOR: #000000 +} +A.2ndheadercell_rollover { + COLOR: #000000 +} +A.2ndheadercell_rollover:hover { + COLOR: #ffffff +} +A.2ndheadercell_rollover:active { + COLOR: #ffff99 +} +A.featuredrollovernav { + FONT-SIZE: 10px; COLOR: #ffffff +} +A.featuredrollovernav:hover { + COLOR: #ffff99 +} +A.featuredrollovernav:active { + COLOR: #000000 +} +A.rollovernavheader { + FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #cc0000; TEXT-DECORATION: none +} +A.rollovernavheader:hover { + COLOR: #000000 +} +A.rollovernavheader:active { + COLOR: #cc0000 +} +A.rollovernav_ltblue { + FONT-SIZE: 10px; COLOR: #000000 +} +A.rollovernav_ltblue:hover { + COLOR: #ffffff +} +A.rollovernav_ltblue:active { + COLOR: #3399ff +} +A.rollovertablehead { + FONT-WEIGHT: bold; FONT-SIZE: 13px; COLOR: #000000 +} +A.rollovertablehead:hover { + COLOR: #ffffff +} +A.rollovertablehead:active { + COLOR: #cc0000 +} +A.rollovertablehead_invert { + FONT-WEIGHT: bold; FONT-SIZE: 13px; COLOR: #ffffff +} +A.rollovertablehead_invert:hover { + COLOR: #000000 +} +A.rollovertablehead_invert:active { + COLOR: #ffff99 +} +A.featuredrollovertablehead { + FONT-WEIGHT: bold; FONT-SIZE: 13px; COLOR: #ffff99 +} +A.featuredrollovertablehead:hover { + COLOR: #ffffff +} +A.featuredrollovertablehead:active { + COLOR: #ffff99 +} +.gdnbutton { + BORDER-RIGHT: #336699 1px solid; BORDER-TOP: #99ccff 1px solid; FONT-WEIGHT: bold; FONT-SIZE: xx-small; BORDER-LEFT: #99ccff 1px solid; CURSOR: hand; COLOR: #ffffff; BORDER-BOTTOM: #336699 1px solid; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #3399ff; TEXT-DECORATION: none +} +INPUT.gdnbuttondemo { + BORDER-RIGHT: #000066 1px solid; BORDER-TOP: #ffffff 1px solid; FONT-WEIGHT: bold; FONT-SIZE: xx-small; BORDER-LEFT: #ffffff 1px solid; CURSOR: hand; COLOR: #000000; BORDER-BOTTOM: #000066 1px solid; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #99ccff; TEXT-DECORATION: none +} +.sampleCode { + BORDER-RIGHT: #3399ff 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #3399ff 1px solid; PADDING-LEFT: 5px; FONT-SIZE: x-small; PADDING-BOTTOM: 15px; BORDER-LEFT: #3399ff 1px solid; PADDING-TOP: 0px; BORDER-BOTTOM: #3399ff 1px solid; BACKGROUND-COLOR: #e5f2ff +} +TD.sampleCodeTab { + BORDER-RIGHT: #3399ff 0px; PADDING-RIGHT: 3px; BORDER-TOP: #3399ff 0px solid; PADDING-LEFT: 3px; FONT-SIZE: 8pt; PADDING-BOTTOM: 3px; BORDER-LEFT: #3399ff 1px solid; WIDTH: 15%; PADDING-TOP: 3px; BORDER-BOTTOM: #3399ff 1px solid; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #99ccff; TEXT-ALIGN: center +} +TD.sampleCodeBacktab { + BORDER-RIGHT: #3399ff 0px; PADDING-RIGHT: 3px; BORDER-TOP: #3399ff 0px solid; PADDING-LEFT: 3px; FONT-SIZE: 8pt; PADDING-BOTTOM: 3px; BORDER-LEFT: #3399ff 1px solid; WIDTH: 15%; CURSOR: hand; PADDING-TOP: 3px; BORDER-BOTTOM: #3399ff 1px solid; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #ffffff; TEXT-ALIGN: center +} +TD.sampleCodeSpace { + BORDER-RIGHT: #cccccc 1px; PADDING-RIGHT: 0px; BORDER-TOP: #cccccc 0px solid; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; BORDER-LEFT: #3399ff 1px solid; WIDTH: 70%; PADDING-TOP: 0px; BORDER-BOTTOM: #cccccc 1px; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: white +} +A.lbclass { + BORDER-RIGHT: #336699 2px solid; PADDING-RIGHT: 2px; BORDER-TOP: #99ccff 2px solid; PADDING-LEFT: 2px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; BORDER-LEFT: #99ccff 2px solid; CURSOR: hand; COLOR: #ffffff; PADDING-TOP: 2px; BORDER-BOTTOM: #336699 2px solid; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #3399ff; TEXT-DECORATION: none +} +A.lbclass:hover { + BORDER-RIGHT: #336699 2px solid; PADDING-RIGHT: 2px; BORDER-TOP: #99ccff 2px solid; PADDING-LEFT: 2px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; BORDER-LEFT: #99ccff 2px solid; CURSOR: hand; COLOR: #ffffff; PADDING-TOP: 2px; BORDER-BOTTOM: #336699 2px solid; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #99ccff; TEXT-DECORATION: none +} +A.lbclass:active { + BORDER-RIGHT: #99ccff 2px solid; BORDER-TOP: #336699 2px solid; FONT-WEIGHT: bold; BORDER-LEFT: #336699 2px solid; CURSOR: hand; COLOR: #ffffff; BORDER-BOTTOM: #99ccff 2px solid; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #3399ff; TEXT-DECORATION: none +} +A.lbclass_down { + BORDER-RIGHT: #99ccff 2px solid; PADDING-RIGHT: 2px; BORDER-TOP: #336699 2px solid; PADDING-LEFT: 2px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; BORDER-LEFT: #336699 2px solid; CURSOR: hand; COLOR: #ffffff; PADDING-TOP: 2px; BORDER-BOTTOM: #99ccff 2px solid; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #3399ff; TEXT-DECORATION: none +} +A.lbclass_down:hover { + BORDER-RIGHT: #99ccff 2px solid; PADDING-RIGHT: 1px; BORDER-TOP: #336699 2px solid; PADDING-LEFT: 1px; FONT-WEIGHT: bold; PADDING-BOTTOM: 1px; BORDER-LEFT: #336699 2px solid; CURSOR: hand; COLOR: #ffffff; PADDING-TOP: 1px; BORDER-BOTTOM: #99ccff 2px solid; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #99ccff; TEXT-DECORATION: none +} +TABLE.dataview { + BORDER-RIGHT: #3399ff 1px solid; BORDER-TOP: #3399ff 1px solid; BORDER-LEFT: #3399ff 1px solid; BORDER-BOTTOM: #3399ff 1px solid +} +TH.headerbar { + BORDER-RIGHT: #3399ff 1px solid; BORDER-TOP: #3399ff 1px solid; BORDER-LEFT: #3399ff 1px solid; BORDER-BOTTOM: #3399ff 1px solid +} +TR.altrow { + BACKGROUND-COLOR: #bfdfff +} +TR.titlerow { + FONT-WEIGHT: bold; COLOR: #ffffff; BACKGROUND-COLOR: #3399ff +} +TD.titlerow { + FONT-WEIGHT: bold; COLOR: #ffffff; BACKGROUND-COLOR: #ff9900 +} +TD.title { + PADDING-RIGHT: 2px; PADDING-LEFT: 2px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; COLOR: #ffffff; PADDING-TOP: 2px; BACKGROUND-COLOR: #3399ff +} +TH.header { + FONT-WEIGHT: bold; FONT-SIZE: x-small; COLOR: #000000; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #99ccff; TEXT-ALIGN: left +} +TD.altrow { + +} +TH.dataview { + FONT-WEIGHT: bold; FONT-SIZE: x-small; COLOR: #000000; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #99ccff; TEXT-ALIGN: left +} +TH.headerbar { + FONT-WEIGHT: bold; FONT-SIZE: x-small; COLOR: #000000; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #99ccff; TEXT-ALIGN: left +} +.code { + FONT-SIZE: xx-small; FONT-FAMILY: courier new +} +.comment { + COLOR: green +} +.SearchDetail { + FONT-SIZE: xx-small; COLOR: dimgray +} +.SearchTitle { + FONT-WEIGHT: bold; FONT-SIZE: x-small; COLOR: #000099 +} +TD.SearchResult { + FONT-SIZE: x-small +} +.SearchBox { + FONT-SIZE: x-small +} +.SearchSummary { + FONT-SIZE: x-small +} +.navbucketheader { + FONT-WEIGHT: bold; FONT-SIZE: 11px; FILTER: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='#333333', Positive='true'); COLOR: #ffff99; FONT-FAMILY: Verdana, Sans-Serif; HEIGHT: 10px; TEXT-DECORATION: none +} +.Abstract { + FONT-SIZE: xx-small +} +TABLE.controlbox { + COLOR: #000000; TEXT-ALIGN: left +} +TABLE.controlbox2 { + BORDER-RIGHT: #3399ff 1px solid; BORDER-TOP: #3399ff 1px solid; BORDER-LEFT: #3399ff 1px solid; COLOR: #000000; TEXT-ALIGN: left +} +TABLE.controlbox3 { + COLOR: #000000; BORDER-BOTTOM: #3399ff 1px solid; TEXT-ALIGN: left +} +TD.controlboxcell { + BORDER-RIGHT: #3399ff 1px solid; BORDER-TOP: #3399ff 1px solid; BORDER-LEFT: #3399ff 1px solid; BACKGROUND-COLOR: #99ccff +} +TABLE.results { + BORDER-BOTTOM: #3399ff 1px solid +} +TD.resultscell { + BORDER-RIGHT: #3399ff 1px solid; PADDING-RIGHT: 7px; BORDER-TOP: #3399ff 1px solid; PADDING-LEFT: 7px; PADDING-BOTTOM: 7px; BORDER-LEFT: #3399ff 1px solid; PADDING-TOP: 7px; BACKGROUND-COLOR: #ffffff +} +TD.resultscell_alter { + BORDER-RIGHT: #3399ff 1px solid; PADDING-RIGHT: 7px; BORDER-TOP: #3399ff 1px solid; PADDING-LEFT: 7px; PADDING-BOTTOM: 7px; BORDER-LEFT: #3399ff 1px solid; PADDING-TOP: 7px; BACKGROUND-COLOR: #e5f2ff +} +UL.resultsbulllet { + MARGIN-BOTTOM: 0px +} +TD.layout_ltblue { + BORDER-RIGHT: #3399ff 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #ffffff 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; BORDER-LEFT: #ffffff 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #3399ff 1px solid; BACKGROUND-COLOR: #99ccff +} +TD.layout_white { + PADDING-RIGHT: 5px; BORDER-TOP: #ffffff 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; BORDER-LEFT: #ffffff 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #3399ff 1px solid; BACKGROUND-COLOR: #ffffff +} +.errormsg { + FONT-WEIGHT: bold; FONT-SIZE: x-small; COLOR: #ff0000 +} +.green_bold { + FONT-WEIGHT: bold; COLOR: #339933 +} +TABLE.TL { + BORDER-TOP: #3399ff 1px solid; BORDER-LEFT: #3399ff 1px solid +} +TD.dkblue_tableheader { + BORDER-RIGHT: #3399ff 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: #ffffff 1px solid; PADDING-LEFT: 4px; FONT-WEIGHT: bold; PADDING-BOTTOM: 4px; BORDER-LEFT: #ffffff 1px solid; COLOR: #ffffff; PADDING-TOP: 4px; BORDER-BOTTOM: #3399ff 1px solid; BACKGROUND-COLOR: #3399ff +} +TD.ltblue_columnheader { + BORDER-RIGHT: #3399ff 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: #ffffff 1px solid; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; BORDER-LEFT: #ffffff 1px solid; PADDING-TOP: 4px; BORDER-BOTTOM: #3399ff 1px solid; BACKGROUND-COLOR: #99ccff +} +TD.white_tablecontent { + BORDER-RIGHT: #3399ff 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: #ffffff 1px solid; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; BORDER-LEFT: #ffffff 1px solid; COLOR: #000000; PADDING-TOP: 4px; BORDER-BOTTOM: #3399ff 1px solid; BACKGROUND-COLOR: #ffffff +} +TD.ltblue_tablecontent { + BORDER-RIGHT: #3399ff 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: #ffffff 1px solid; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; BORDER-LEFT: #ffffff 1px solid; COLOR: #000000; PADDING-TOP: 4px; BORDER-BOTTOM: #3399ff 1px solid; BACKGROUND-COLOR: #e5f2ff +} +TD.nocolor_tablecontent { + BORDER-RIGHT: #3399ff 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: #ffffff 1px solid; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; BORDER-LEFT: #ffffff 1px solid; PADDING-TOP: 4px; BORDER-BOTTOM: #3399ff 1px solid +} +.fontstyle { + FONT-SIZE: x-small; FONT-FAMILY: Verdana, Sans-Serif +} +.EditTextBox { + FONT-SIZE: x-small; FONT-FAMILY: Verdana, Sans-Serif +} +.EditTextBox_grayout { + FONT-SIZE: x-small; COLOR: #999999; FONT-FAMILY: Verdana, Sans-Serif +} +.pagingRepeater_Message { + FONT-SIZE: xx-small; COLOR: #ff0000 +} +.FileInfoGridRow { + BORDER-RIGHT: medium none; BORDER-TOP: #3399ff 1px solid; FONT-SIZE: 8pt; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; FONT-FAMILY: Verdana, Sans-Serif, Tahoma +} +.FileInfoHeader { + BORDER-RIGHT: medium none; BORDER-TOP: medium none; FONT-SIZE: 8pt; BORDER-LEFT: medium none; COLOR: #ffffff; BORDER-BOTTOM: medium none; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #0066cc +} +.FileInfoGridHeader { + BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-SIZE: 8pt; BORDER-LEFT: #000000 1px solid; COLOR: #ffffff; BORDER-BOTTOM: #000000 1px solid; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #3399ff +} +.FileHistoryPanelRow { + BORDER-TOP: #3399ff 1px solid; FONT-SIZE: 8pt; FONT-FAMILY: Verdana, Sans-Serif, Tahoma +} +.FileHistoryPanelHeader { + FONT-SIZE: 8pt; COLOR: #ffffff; FONT-FAMILY: Verdana, Sans-Serif, Tahoma; BACKGROUND-COLOR: #0066cc +} +.verdana11 { + BORDER-TOP: #ffffff 1px solid; FONT-SIZE: 11px; BORDER-LEFT: #ffffff 1px solid; BORDER-BOTTOM: #3399ff 1px solid; FONT-FAMILY: Verdana, Sans-Serif +} +.FS-fullborder { + BORDER-RIGHT: #3399ff 1px solid; PADDING-RIGHT: 3px; BORDER-TOP: #3399ff 1px solid; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; BORDER-LEFT: #3399ff 1px solid; PADDING-TOP: 3px; BORDER-BOTTOM: #3399ff 1px solid; BACKGROUND-COLOR: #e5f2ff +} +.FS-dkblueheader { + PADDING-RIGHT: 2px; PADDING-LEFT: 2px; FONT-WEIGHT: bold; FONT-SIZE: x-small; PADDING-BOTTOM: 2px; COLOR: #ffffff; PADDING-TOP: 2px; BACKGROUND-COLOR: #3399ff +} +.NB-3sides-nobottom { + BORDER-RIGHT: #3399ff 1px solid; PADDING-RIGHT: 3px; BORDER-TOP: #3399ff 1px solid; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; BORDER-LEFT: #3399ff 1px solid; PADDING-TOP: 3px +} +.NB-3sides-noright { + PADDING-RIGHT: 3px; BORDER-TOP: #3399ff 1px solid; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; BORDER-LEFT: #3399ff 1px solid; PADDING-TOP: 3px; BORDER-BOTTOM: #3399ff 1px solid +} +.NB-4sides { + BORDER-RIGHT: #3399ff 1px solid; PADDING-RIGHT: 3px; BORDER-TOP: #3399ff 1px solid; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; BORDER-LEFT: #3399ff 1px solid; PADDING-TOP: 3px; BORDER-BOTTOM: #3399ff 1px solid +} +.NB-LtBlueHeader { + BORDER-RIGHT: #3399ff 1px solid; BORDER-TOP: #3399ff 1px solid; FONT-WEIGHT: bold; FONT-SIZE: x-small; BORDER-LEFT: #3399ff 1px solid; COLOR: #3366cc; TEXT-INDENT: 4px; BORDER-BOTTOM: #3399ff 1px solid; FONT-FAMILY: verdana; BACKGROUND-COLOR: #e5f2ff +} +.lnav_bg { + PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BACKGROUND-IMAGE: url(/images/leftnav_bg_new.gif); PADDING-BOTTOM: 0px; PADDING-TOP: 0px +} +.lnav_header { + PADDING-LEFT: 11px; CURSOR: hand +} +.lnav_headertext { + FONT-WEIGHT: bold; FONT-SIZE: 11px; FILTER: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='#333333', Positive='true'); COLOR: #ffff99; FONT-FAMILY: Verdana, Sans-Serif; HEIGHT: 10px; TEXT-DECORATION: none +} +.lnav_container { + PADDING-TOP: 5px +} +.lnav_2ndheader { + PADDING-LEFT: 11px; FONT-WEIGHT: bold; FONT-SIZE: 10px; PADDING-BOTTOM: 5px; COLOR: #ffff99; FONT-FAMILY: Verdana, Sans-Serif +} +.lnav_links { + PADDING-RIGHT: 24px; PADDING-LEFT: 17px; PADDING-BOTTOM: 5px +} +.tables_table { + BORDER-TOP: #3399ff 1px solid; BORDER-LEFT: #3399ff 1px solid +} +.tables_headercell { + BORDER-RIGHT: #3399ff 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #ffffff 1px solid; PADDING-LEFT: 5px; FONT-WEIGHT: bold; PADDING-BOTTOM: 5px; BORDER-LEFT: #ffffff 1px solid; COLOR: #ffffff; PADDING-TOP: 5px; BORDER-BOTTOM: #3399ff 1px solid; BACKGROUND-COLOR: #3399ff +} +.tables_2ndheadercell { + BORDER-RIGHT: #3399ff 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #ffffff 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; BORDER-LEFT: #ffffff 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #3399ff 1px solid; BACKGROUND-COLOR: #99ccff +} +.tables_contentcell { + BORDER-RIGHT: #3399ff 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #ffffff 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; BORDER-LEFT: #ffffff 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #3399ff 1px solid; BACKGROUND-COLOR: #ffffff +} +.tables_contentcellnor { + PADDING-RIGHT: 5px; BORDER-TOP: #ffffff 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; BORDER-LEFT: #ffffff 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #3399ff 1px solid; BACKGROUND-COLOR: #ffffff +} +.tables_contentcell_altern { + BORDER-RIGHT: #3399ff 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #ffffff 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; BORDER-LEFT: #ffffff 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #3399ff 1px solid; BACKGROUND-COLOR: #e5f2ff +} +.tables_contentcellnor_altern { + PADDING-RIGHT: 5px; BORDER-TOP: #ffffff 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; BORDER-LEFT: #ffffff 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #3399ff 1px solid; BACKGROUND-COLOR: #e5f2ff +} +HR.black { + MARGIN-TOP: 15px; MARGIN-BOTTOM: 15px; WIDTH: 94%; COLOR: #000000; HEIGHT: 1px +} +A.HeaderSmall { + FONT-SIZE: small; COLOR: #ffffff +} +A.HeaderSmall:hover { + COLOR: #000000 +} +A.HeaderSmall:active { + COLOR: #ffff99 +} +A.HeaderXXSmall { + FONT-WEIGHT: normal; FONT-SIZE: xx-small; COLOR: #ffffff +} +A.HeaderXXSmall:hover { + COLOR: #000000 +} +A.HeaderXXSmall:active { + COLOR: #ffff99 +} diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/topbar_bg.gif b/Ch2 - Updater Component/Dot Net Updater Component_files/topbar_bg.gif new file mode 100644 index 0000000..0772433 Binary files /dev/null and b/Ch2 - Updater Component/Dot Net Updater Component_files/topbar_bg.gif differ diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/topbar_r.gif b/Ch2 - Updater Component/Dot Net Updater Component_files/topbar_r.gif new file mode 100644 index 0000000..6384189 Binary files /dev/null and b/Ch2 - Updater Component/Dot Net Updater Component_files/topbar_r.gif differ diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/topbar_title.gif b/Ch2 - Updater Component/Dot Net Updater Component_files/topbar_title.gif new file mode 100644 index 0000000..4e4f8da Binary files /dev/null and b/Ch2 - Updater Component/Dot Net Updater Component_files/topbar_title.gif differ diff --git a/Ch2 - Updater Component/Dot Net Updater Component_files/windowsforms b/Ch2 - Updater Component/Dot Net Updater Component_files/windowsforms new file mode 100644 index 0000000..28b30b8 --- /dev/null +++ b/Ch2 - Updater Component/Dot Net Updater Component_files/windowsforms @@ -0,0 +1,428 @@ + + + + + About Windows Forms + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + +
Search  + +
+ + + +
Sign in with your Passport.
+
+
+ + + + + + + +
+ + + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + +
+ + + + + + + +
+ + About Windows Forms
+
+ + + + + + +Windows Forms is a rich programming framework for building Win32 client applications. + It offers great support for Win32 developers, providing improved ease-of-use, superb tool support, + rock solid reliability, much lower deployment costs and associated reductions in total cost of ownership. + + +

Get Answers

+Stumped by a development problem? Don't like the feel of an API? Let the experts know. The Windows Forms team will be available on the following Microsoft public newsgroup: +dotnet.framework.windowsforms +

+Also look for us on the ASPlists Windows Forms lists
+ + + +

Code Heroes

+Windows Forms Coding Heroes
+Kenny Kerr works over icons and unmanged inter-op.
+3/07/02 +

+More Code Heroes... + + + +

Features

+.Net Application Updater Component
+Want to make your application smart enough to update itself? This article describes how to do just that. The .NET Application Updater component included with this article is the same one used to make the .Net Terrarium game automatically updatable. +
+by Jamie Cool
+Program Manager - Microsoft .NET Framework
+

+ +GDI+ Text, Resolution Independence, and Rendering Methods
+by David C. Brown
+Lead Developer - GDI+
+

+ +Using Windows XP Themed Controls in Windows Forms
+by Mike Harsh
+Program Manager - Microsoft .NET Framework
+

+ +.NET Licensing
+by Mike Harsh
+Program Manager - Microsoft .NET Framework
+

+ +Providing Custom Layout Engines for Windows Forms
+by Chris Anderson
+Developer - Microsoft .NET Framework
+

+ +More Features... + + +

Articles

+Writing Custom Designers for .NET Components  
+by Shawn Burke +

+ +Windows Forms: A Modern-Day Programming Model for Writing GUI Applications
+by Jeff Prosise +

+ +More Articles... + + + + + + + + + +
+[Printer friendly version] +


+ + © Copyright 2003 Microsoft Corporation. All Rights Reserved.
+ Terms of Use + | + Privacy Statement + | + Code of Conduct + | + About the team + | + Contact Us +

+

+ +
+
+ \ No newline at end of file diff --git a/Ch2 - Updater Component/DotNetUpdater.zip b/Ch2 - Updater Component/DotNetUpdater.zip new file mode 100644 index 0000000..89d1fac Binary files /dev/null and b/Ch2 - Updater Component/DotNetUpdater.zip differ diff --git a/Ch2 - Win XP Themes/AssemblyInfo.vb b/Ch2 - Win XP Themes/AssemblyInfo.vb new file mode 100644 index 0000000..7cb12f6 --- /dev/null +++ b/Ch2 - Win XP Themes/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch2 - Win XP Themes/Ch2 - Win XP Themes.exe.manifest b/Ch2 - Win XP Themes/Ch2 - Win XP Themes.exe.manifest new file mode 100644 index 0000000..436aa42 --- /dev/null +++ b/Ch2 - Win XP Themes/Ch2 - Win XP Themes.exe.manifest @@ -0,0 +1,22 @@ + + + +Description of Application + + + + + + \ No newline at end of file diff --git a/Ch2 - Win XP Themes/Ch2 - Win XP Themes.sln b/Ch2 - Win XP Themes/Ch2 - Win XP Themes.sln new file mode 100644 index 0000000..176f2d2 --- /dev/null +++ b/Ch2 - Win XP Themes/Ch2 - Win XP Themes.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch2 - Win XP Themes", "Ch2 - Win XP Themes.vbproj", "{FC1BCB16-55A2-43E2-8741-95B539B6BE05}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {FC1BCB16-55A2-43E2-8741-95B539B6BE05}.Debug.ActiveCfg = Debug|.NET + {FC1BCB16-55A2-43E2-8741-95B539B6BE05}.Debug.Build.0 = Debug|.NET + {FC1BCB16-55A2-43E2-8741-95B539B6BE05}.Release.ActiveCfg = Release|.NET + {FC1BCB16-55A2-43E2-8741-95B539B6BE05}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch2 - Win XP Themes/Ch2 - Win XP Themes.suo b/Ch2 - Win XP Themes/Ch2 - Win XP Themes.suo new file mode 100644 index 0000000..e507ea2 Binary files /dev/null and b/Ch2 - Win XP Themes/Ch2 - Win XP Themes.suo differ diff --git a/Ch2 - Win XP Themes/Ch2 - Win XP Themes.vbproj b/Ch2 - Win XP Themes/Ch2 - Win XP Themes.vbproj new file mode 100644 index 0000000..03a1d48 --- /dev/null +++ b/Ch2 - Win XP Themes/Ch2 - Win XP Themes.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch2 - Win XP Themes/Ch2 - Win XP Themes.vbproj.user b/Ch2 - Win XP Themes/Ch2 - Win XP Themes.vbproj.user new file mode 100644 index 0000000..a6e254a --- /dev/null +++ b/Ch2 - Win XP Themes/Ch2 - Win XP Themes.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch2 - Win XP Themes/Form1.resx b/Ch2 - Win XP Themes/Form1.resx new file mode 100644 index 0000000..f53a933 --- /dev/null +++ b/Ch2 - Win XP Themes/Form1.resx @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch2 - Win XP Themes/Form1.vb b/Ch2 - Win XP Themes/Form1.vb new file mode 100644 index 0000000..6249f66 --- /dev/null +++ b/Ch2 - Win XP Themes/Form1.vb @@ -0,0 +1,179 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents TabControl1 As System.Windows.Forms.TabControl + Friend WithEvents TabPage1 As System.Windows.Forms.TabPage + Friend WithEvents TabPage2 As System.Windows.Forms.TabPage + Friend WithEvents ProgressBar1 As System.Windows.Forms.ProgressBar + Friend WithEvents VScrollBar1 As System.Windows.Forms.VScrollBar + Friend WithEvents HScrollBar1 As System.Windows.Forms.HScrollBar + Friend WithEvents TrackBar1 As System.Windows.Forms.TrackBar + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox + Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents Label2 As System.Windows.Forms.Label + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.TabControl1 = New System.Windows.Forms.TabControl() + Me.TabPage1 = New System.Windows.Forms.TabPage() + Me.TabPage2 = New System.Windows.Forms.TabPage() + Me.ProgressBar1 = New System.Windows.Forms.ProgressBar() + Me.VScrollBar1 = New System.Windows.Forms.VScrollBar() + Me.HScrollBar1 = New System.Windows.Forms.HScrollBar() + Me.TrackBar1 = New System.Windows.Forms.TrackBar() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.CheckBox1 = New System.Windows.Forms.CheckBox() + Me.RadioButton1 = New System.Windows.Forms.RadioButton() + Me.Label1 = New System.Windows.Forms.Label() + Me.Label2 = New System.Windows.Forms.Label() + Me.TabControl1.SuspendLayout() + CType(Me.TrackBar1, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.System + Me.Button1.Location = New System.Drawing.Point(312, 184) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(136, 48) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Button1" + ' + 'TabControl1 + ' + Me.TabControl1.Controls.AddRange(New System.Windows.Forms.Control() {Me.TabPage1, Me.TabPage2}) + Me.TabControl1.Location = New System.Drawing.Point(24, 24) + Me.TabControl1.Name = "TabControl1" + Me.TabControl1.SelectedIndex = 0 + Me.TabControl1.Size = New System.Drawing.Size(216, 112) + Me.TabControl1.TabIndex = 1 + ' + 'TabPage1 + ' + Me.TabPage1.Location = New System.Drawing.Point(4, 22) + Me.TabPage1.Name = "TabPage1" + Me.TabPage1.Size = New System.Drawing.Size(208, 86) + Me.TabPage1.TabIndex = 0 + Me.TabPage1.Text = "TabPage1" + ' + 'TabPage2 + ' + Me.TabPage2.Location = New System.Drawing.Point(4, 22) + Me.TabPage2.Name = "TabPage2" + Me.TabPage2.Size = New System.Drawing.Size(208, 86) + Me.TabPage2.TabIndex = 1 + Me.TabPage2.Text = "TabPage2" + ' + 'ProgressBar1 + ' + Me.ProgressBar1.Location = New System.Drawing.Point(24, 208) + Me.ProgressBar1.Name = "ProgressBar1" + Me.ProgressBar1.Size = New System.Drawing.Size(216, 23) + Me.ProgressBar1.TabIndex = 2 + Me.ProgressBar1.Value = 29 + ' + 'VScrollBar1 + ' + Me.VScrollBar1.Location = New System.Drawing.Point(432, 32) + Me.VScrollBar1.Name = "VScrollBar1" + Me.VScrollBar1.TabIndex = 3 + ' + 'HScrollBar1 + ' + Me.HScrollBar1.Location = New System.Drawing.Point(328, 104) + Me.HScrollBar1.Name = "HScrollBar1" + Me.HScrollBar1.TabIndex = 4 + ' + 'TrackBar1 + ' + Me.TrackBar1.Location = New System.Drawing.Point(24, 152) + Me.TrackBar1.Name = "TrackBar1" + Me.TrackBar1.Size = New System.Drawing.Size(208, 45) + Me.TrackBar1.TabIndex = 5 + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(312, 144) + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(128, 20) + Me.TextBox1.TabIndex = 6 + Me.TextBox1.Text = "TextBox1" + ' + 'CheckBox1 + ' + Me.CheckBox1.FlatStyle = System.Windows.Forms.FlatStyle.System + Me.CheckBox1.Location = New System.Drawing.Point(312, 32) + Me.CheckBox1.Name = "CheckBox1" + Me.CheckBox1.TabIndex = 7 + Me.CheckBox1.Text = "CheckBox1" + ' + 'RadioButton1 + ' + Me.RadioButton1.FlatStyle = System.Windows.Forms.FlatStyle.System + Me.RadioButton1.Location = New System.Drawing.Point(312, 64) + Me.RadioButton1.Name = "RadioButton1" + Me.RadioButton1.TabIndex = 8 + Me.RadioButton1.Text = "RadioButton1" + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(24, 248) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(416, 23) + Me.Label1.TabIndex = 9 + Me.Label1.Text = "To test this application, do not recompile!" + ' + 'Label2 + ' + Me.Label2.Location = New System.Drawing.Point(24, 264) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(416, 23) + Me.Label2.TabIndex = 10 + Me.Label2.Text = "Go to the Bin folder and run the modified ""Ch2 - Win XP Themes.exe""" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(464, 286) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label2, Me.Label1, Me.RadioButton1, Me.CheckBox1, Me.TextBox1, Me.TrackBar1, Me.HScrollBar1, Me.VScrollBar1, Me.ProgressBar1, Me.TabControl1, Me.Button1}) + Me.Name = "Form1" + Me.Text = "Example Windows XP Theming" + Me.TabControl1.ResumeLayout(False) + CType(Me.TrackBar1, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + + End Sub + +#End Region + +End Class diff --git a/Ch2 - Win XP Themes/Read Me First.txt b/Ch2 - Win XP Themes/Read Me First.txt new file mode 100644 index 0000000..ee3e6cb --- /dev/null +++ b/Ch2 - Win XP Themes/Read Me First.txt @@ -0,0 +1,8 @@ +Important Note +=============== + +Run the .EXE in the /Bin directory first to view the Windows XP themed application. + +Opening in Visual Studio .NET and running the application will overwrite this .EXE and the changes made to it from steps four onward in the book. + +Remember: each time you overwrite the file, you will need to follow steps four onwards, altering the XML file to match the latest version number. \ No newline at end of file diff --git a/Ch2 - Win XP Themes/bin/Ch2 - Win XP Themes.exe b/Ch2 - Win XP Themes/bin/Ch2 - Win XP Themes.exe new file mode 100644 index 0000000..7bd72ee Binary files /dev/null and b/Ch2 - Win XP Themes/bin/Ch2 - Win XP Themes.exe differ diff --git a/Ch2 - Win XP Themes/obj/Debug/Ch2 - Win XP Themes.exe b/Ch2 - Win XP Themes/obj/Debug/Ch2 - Win XP Themes.exe new file mode 100644 index 0000000..c831b54 Binary files /dev/null and b/Ch2 - Win XP Themes/obj/Debug/Ch2 - Win XP Themes.exe differ diff --git a/Ch2 - Win XP Themes/obj/Debug/Ch2 - Win XP Themes.pdb b/Ch2 - Win XP Themes/obj/Debug/Ch2 - Win XP Themes.pdb new file mode 100644 index 0000000..6416f54 Binary files /dev/null and b/Ch2 - Win XP Themes/obj/Debug/Ch2 - Win XP Themes.pdb differ diff --git a/Ch2 - Win XP Themes/obj/Release/Ch2 - Win XP Themes.exe b/Ch2 - Win XP Themes/obj/Release/Ch2 - Win XP Themes.exe new file mode 100644 index 0000000..8f97379 Binary files /dev/null and b/Ch2 - Win XP Themes/obj/Release/Ch2 - Win XP Themes.exe differ diff --git a/Ch2 - Win XP Themes/obj/Release/Ch2___Win_XP_Themes.Form1.resources b/Ch2 - Win XP Themes/obj/Release/Ch2___Win_XP_Themes.Form1.resources new file mode 100644 index 0000000..a88a003 Binary files /dev/null and b/Ch2 - Win XP Themes/obj/Release/Ch2___Win_XP_Themes.Form1.resources differ diff --git a/Ch2 - XtraNavBar/Read Me First.txt b/Ch2 - XtraNavBar/Read Me First.txt new file mode 100644 index 0000000..f7eaf49 --- /dev/null +++ b/Ch2 - XtraNavBar/Read Me First.txt @@ -0,0 +1,3 @@ +Visit www.devexpress.com/free to download and register your copy. + +Alternatively, run the XtraNavBarFree.exe application in this directory and use the installation password: UESTYBXCSKDGHRY. \ No newline at end of file diff --git a/Ch2 - XtraNavBar/XtraNavBarFree.exe b/Ch2 - XtraNavBar/XtraNavBarFree.exe new file mode 100644 index 0000000..8e56d5f Binary files /dev/null and b/Ch2 - XtraNavBar/XtraNavBarFree.exe differ diff --git a/Ch3 - Authentication/AssemblyInfo.vb b/Ch3 - Authentication/AssemblyInfo.vb new file mode 100644 index 0000000..d1823c8 --- /dev/null +++ b/Ch3 - Authentication/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch3 - Authentication/Ch3 - Authentication.sln b/Ch3 - Authentication/Ch3 - Authentication.sln new file mode 100644 index 0000000..b48941f --- /dev/null +++ b/Ch3 - Authentication/Ch3 - Authentication.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch3 - Authentication", "http://localhost/Ch3 - Authentication/Ch3 - Authentication.vbproj", "{83C020FA-D704-4E90-8E91-BBAFF634461D}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {83C020FA-D704-4E90-8E91-BBAFF634461D}.Debug.ActiveCfg = Debug|.NET + {83C020FA-D704-4E90-8E91-BBAFF634461D}.Debug.Build.0 = Debug|.NET + {83C020FA-D704-4E90-8E91-BBAFF634461D}.Release.ActiveCfg = Release|.NET + {83C020FA-D704-4E90-8E91-BBAFF634461D}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch3 - Authentication/Ch3 - Authentication.suo b/Ch3 - Authentication/Ch3 - Authentication.suo new file mode 100644 index 0000000..3c8521a Binary files /dev/null and b/Ch3 - Authentication/Ch3 - Authentication.suo differ diff --git a/Ch3 - Authentication/Ch3 - Authentication.vbproj b/Ch3 - Authentication/Ch3 - Authentication.vbproj new file mode 100644 index 0000000..650b6b1 --- /dev/null +++ b/Ch3 - Authentication/Ch3 - Authentication.vbproj @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Authentication/Ch3 - Authentication.vbproj.webinfo b/Ch3 - Authentication/Ch3 - Authentication.vbproj.webinfo new file mode 100644 index 0000000..3bfe768 --- /dev/null +++ b/Ch3 - Authentication/Ch3 - Authentication.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch3 - Authentication/Ch3 - Authentication.vsdisco b/Ch3 - Authentication/Ch3 - Authentication.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch3 - Authentication/Ch3 - Authentication.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch3 - Authentication/Global.asax b/Ch3 - Authentication/Global.asax new file mode 100644 index 0000000..d1930f7 --- /dev/null +++ b/Ch3 - Authentication/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch3___Authentication.Global" %> \ No newline at end of file diff --git a/Ch3 - Authentication/Global.asax.resx b/Ch3 - Authentication/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Authentication/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Authentication/Global.asax.vb b/Ch3 - Authentication/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch3 - Authentication/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch3 - Authentication/Read Me First.txt b/Ch3 - Authentication/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch3 - Authentication/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch3 - Authentication/Styles.css b/Ch3 - Authentication/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch3 - Authentication/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch3 - Authentication/Web.config b/Ch3 - Authentication/Web.config new file mode 100644 index 0000000..125accc --- /dev/null +++ b/Ch3 - Authentication/Web.config @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Authentication/_vti_pvt/access.cnf b/Ch3 - Authentication/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch3 - Authentication/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch3 - Authentication/_vti_pvt/deptodoc.btr b/Ch3 - Authentication/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..65ea3b9 Binary files /dev/null and b/Ch3 - Authentication/_vti_pvt/deptodoc.btr differ diff --git a/Ch3 - Authentication/_vti_pvt/doctodep.btr b/Ch3 - Authentication/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch3 - Authentication/_vti_pvt/doctodep.btr differ diff --git a/Ch3 - Authentication/_vti_pvt/service.cnf b/Ch3 - Authentication/_vti_pvt/service.cnf new file mode 100644 index 0000000..8a953d7 --- /dev/null +++ b/Ch3 - Authentication/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|06 Nov 2002 14:31:08 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch3 - Authentication/_vti_pvt/service.lck b/Ch3 - Authentication/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch3 - Authentication/_vti_pvt/services.cnf b/Ch3 - Authentication/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch3 - Authentication/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch3 - Authentication/bin/Ch3 - Authentication.dll b/Ch3 - Authentication/bin/Ch3 - Authentication.dll new file mode 100644 index 0000000..589fd42 Binary files /dev/null and b/Ch3 - Authentication/bin/Ch3 - Authentication.dll differ diff --git a/Ch3 - Authentication/bin/Ch3 - Authentication.pdb b/Ch3 - Authentication/bin/Ch3 - Authentication.pdb new file mode 100644 index 0000000..03afb77 Binary files /dev/null and b/Ch3 - Authentication/bin/Ch3 - Authentication.pdb differ diff --git a/Ch3 - Authentication/login.aspx b/Ch3 - Authentication/login.aspx new file mode 100644 index 0000000..cc0fce9 --- /dev/null +++ b/Ch3 - Authentication/login.aspx @@ -0,0 +1,24 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="login.aspx.vb" Inherits="Ch3___Authentication.login"%> + + + + login + + + + + + +
+ Login Example + + Password + Use "test1" and "password" as your credentials. + Username + + + + +
+ + diff --git a/Ch3 - Authentication/login.aspx.resx b/Ch3 - Authentication/login.aspx.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Authentication/login.aspx.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Authentication/login.aspx.vb b/Ch3 - Authentication/login.aspx.vb new file mode 100644 index 0000000..9fa99af --- /dev/null +++ b/Ch3 - Authentication/login.aspx.vb @@ -0,0 +1,41 @@ +Public Class login + Inherits System.Web.UI.Page + Protected WithEvents Label1 As System.Web.UI.WebControls.Label + Protected WithEvents Label3 As System.Web.UI.WebControls.Label + Protected WithEvents Label4 As System.Web.UI.WebControls.Label + Protected WithEvents txtUsername As System.Web.UI.WebControls.TextBox + Protected WithEvents txtPassword As System.Web.UI.WebControls.TextBox + Protected WithEvents Button1 As System.Web.UI.WebControls.Button + Protected WithEvents chkPersist As System.Web.UI.WebControls.CheckBox + Protected WithEvents lblError As System.Web.UI.WebControls.Label + Protected WithEvents Label2 As System.Web.UI.WebControls.Label + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + 'Put user code to initialize the page here + End Sub + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + If System.Web.Security.FormsAuthentication.Authenticate( _ + txtUsername.Text, txtPassword.Text) = True Then + System.Web.Security.FormsAuthentication.RedirectFromLoginPage( _ + txtUsername.Text, chkPersist.Checked) + Else + lblError.Text = "Invalid credentials – go back and try again!" + End If + End Sub +End Class diff --git a/Ch3 - Authentication/sample.aspx b/Ch3 - Authentication/sample.aspx new file mode 100644 index 0000000..1d84cc2 --- /dev/null +++ b/Ch3 - Authentication/sample.aspx @@ -0,0 +1,17 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="sample.aspx.vb" Inherits="Ch3___Authentication.sample"%> + + + + sample + + + + + + +
+ This is a sample Web page. You cannot access it until you are authenticated. + +
+ + diff --git a/Ch3 - Authentication/sample.aspx.resx b/Ch3 - Authentication/sample.aspx.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Authentication/sample.aspx.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Authentication/sample.aspx.vb b/Ch3 - Authentication/sample.aspx.vb new file mode 100644 index 0000000..295b553 --- /dev/null +++ b/Ch3 - Authentication/sample.aspx.vb @@ -0,0 +1,29 @@ +Public Class sample + Inherits System.Web.UI.Page + Protected WithEvents Label1 As System.Web.UI.WebControls.Label + Protected WithEvents Button1 As System.Web.UI.WebControls.Button + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + 'Put user code to initialize the page here + End Sub + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + System.Web.Security.FormsAuthentication.SignOut() + Response.Redirect("login.aspx") + End Sub +End Class diff --git a/Ch3 - Caching/AssemblyInfo.vb b/Ch3 - Caching/AssemblyInfo.vb new file mode 100644 index 0000000..a7399e3 --- /dev/null +++ b/Ch3 - Caching/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch3 - Caching/Ch3 - Caching.vbproj b/Ch3 - Caching/Ch3 - Caching.vbproj new file mode 100644 index 0000000..a3855b9 --- /dev/null +++ b/Ch3 - Caching/Ch3 - Caching.vbproj @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Caching/Ch3 - Caching.vbproj.webinfo b/Ch3 - Caching/Ch3 - Caching.vbproj.webinfo new file mode 100644 index 0000000..3d638f3 --- /dev/null +++ b/Ch3 - Caching/Ch3 - Caching.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch3 - Caching/Ch3 - Caching.vsdisco b/Ch3 - Caching/Ch3 - Caching.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch3 - Caching/Ch3 - Caching.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch3 - Caching/Global.asax b/Ch3 - Caching/Global.asax new file mode 100644 index 0000000..61945a3 --- /dev/null +++ b/Ch3 - Caching/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch3___Caching.Global" %> \ No newline at end of file diff --git a/Ch3 - Caching/Global.asax.resx b/Ch3 - Caching/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Caching/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Caching/Global.asax.vb b/Ch3 - Caching/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch3 - Caching/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch3 - Caching/Read Me First.txt b/Ch3 - Caching/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch3 - Caching/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch3 - Caching/Styles.css b/Ch3 - Caching/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch3 - Caching/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch3 - Caching/Web.config b/Ch3 - Caching/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch3 - Caching/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Caching/WebForm1.aspx b/Ch3 - Caching/WebForm1.aspx new file mode 100644 index 0000000..cc93a01 --- /dev/null +++ b/Ch3 - Caching/WebForm1.aspx @@ -0,0 +1,17 @@ +<%@ OutputCache Duration="10" VaryByParam="None" %> +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch3___Caching.WebForm1"%> + + + + WebForm1 + + + + + + +
+ Run this page to see caching in action. +
+ + diff --git a/Ch3 - Caching/WebForm1.aspx.resx b/Ch3 - Caching/WebForm1.aspx.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Caching/WebForm1.aspx.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Caching/WebForm1.aspx.vb b/Ch3 - Caching/WebForm1.aspx.vb new file mode 100644 index 0000000..e4eaacb --- /dev/null +++ b/Ch3 - Caching/WebForm1.aspx.vb @@ -0,0 +1,25 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents Label1 As System.Web.UI.WebControls.Label + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + Label1.Text = "This page is cached and expires every ten seconds. " & _ + "Last time page was generated: " & System.DateTime.Now.ToLongTimeString + End Sub + +End Class diff --git a/Ch3 - Caching/_vti_pvt/access.cnf b/Ch3 - Caching/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch3 - Caching/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch3 - Caching/_vti_pvt/deptodoc.btr b/Ch3 - Caching/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..65ea3b9 Binary files /dev/null and b/Ch3 - Caching/_vti_pvt/deptodoc.btr differ diff --git a/Ch3 - Caching/_vti_pvt/doctodep.btr b/Ch3 - Caching/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch3 - Caching/_vti_pvt/doctodep.btr differ diff --git a/Ch3 - Caching/_vti_pvt/service.cnf b/Ch3 - Caching/_vti_pvt/service.cnf new file mode 100644 index 0000000..d034a2e --- /dev/null +++ b/Ch3 - Caching/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|06 Nov 2002 14:48:57 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch3 - Caching/_vti_pvt/service.lck b/Ch3 - Caching/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch3 - Caching/_vti_pvt/services.cnf b/Ch3 - Caching/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch3 - Caching/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch3 - Caching/bin/Ch3 - Caching.dll b/Ch3 - Caching/bin/Ch3 - Caching.dll new file mode 100644 index 0000000..451647d Binary files /dev/null and b/Ch3 - Caching/bin/Ch3 - Caching.dll differ diff --git a/Ch3 - Caching/bin/Ch3 - Caching.pdb b/Ch3 - Caching/bin/Ch3 - Caching.pdb new file mode 100644 index 0000000..f3c8b72 Binary files /dev/null and b/Ch3 - Caching/bin/Ch3 - Caching.pdb differ diff --git a/Ch3 - Dynamically Create Images/AssemblyInfo.vb b/Ch3 - Dynamically Create Images/AssemblyInfo.vb new file mode 100644 index 0000000..2f89413 --- /dev/null +++ b/Ch3 - Dynamically Create Images/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch3 - Dynamically Create Images/Ch3 - Dynamically Create Images.sln b/Ch3 - Dynamically Create Images/Ch3 - Dynamically Create Images.sln new file mode 100644 index 0000000..a3192fc --- /dev/null +++ b/Ch3 - Dynamically Create Images/Ch3 - Dynamically Create Images.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch3 - Dynamically Create Images", "http://localhost/Ch3 - Dynamically Create Images/Ch3 - Dynamically Create Images.vbproj", "{A29C2870-34F3-49DB-BD64-9197BF11AB96}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {A29C2870-34F3-49DB-BD64-9197BF11AB96}.Debug.ActiveCfg = Debug|.NET + {A29C2870-34F3-49DB-BD64-9197BF11AB96}.Debug.Build.0 = Debug|.NET + {A29C2870-34F3-49DB-BD64-9197BF11AB96}.Release.ActiveCfg = Release|.NET + {A29C2870-34F3-49DB-BD64-9197BF11AB96}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch3 - Dynamically Create Images/Ch3 - Dynamically Create Images.suo b/Ch3 - Dynamically Create Images/Ch3 - Dynamically Create Images.suo new file mode 100644 index 0000000..de52d6a Binary files /dev/null and b/Ch3 - Dynamically Create Images/Ch3 - Dynamically Create Images.suo differ diff --git a/Ch3 - Dynamically Create Images/Ch3 - Dynamically Create Images.vbproj b/Ch3 - Dynamically Create Images/Ch3 - Dynamically Create Images.vbproj new file mode 100644 index 0000000..50e9769 --- /dev/null +++ b/Ch3 - Dynamically Create Images/Ch3 - Dynamically Create Images.vbproj @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Dynamically Create Images/Ch3 - Dynamically Create Images.vbproj.webinfo b/Ch3 - Dynamically Create Images/Ch3 - Dynamically Create Images.vbproj.webinfo new file mode 100644 index 0000000..61e8714 --- /dev/null +++ b/Ch3 - Dynamically Create Images/Ch3 - Dynamically Create Images.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch3 - Dynamically Create Images/Ch3 - Dynamically Create Images.vsdisco b/Ch3 - Dynamically Create Images/Ch3 - Dynamically Create Images.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch3 - Dynamically Create Images/Ch3 - Dynamically Create Images.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch3 - Dynamically Create Images/Global.asax b/Ch3 - Dynamically Create Images/Global.asax new file mode 100644 index 0000000..a17f6bb --- /dev/null +++ b/Ch3 - Dynamically Create Images/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch3___Dynamically_Create_Images.Global" %> \ No newline at end of file diff --git a/Ch3 - Dynamically Create Images/Global.asax.resx b/Ch3 - Dynamically Create Images/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Dynamically Create Images/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Dynamically Create Images/Global.asax.vb b/Ch3 - Dynamically Create Images/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch3 - Dynamically Create Images/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch3 - Dynamically Create Images/Read Me First.txt b/Ch3 - Dynamically Create Images/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch3 - Dynamically Create Images/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch3 - Dynamically Create Images/Styles.css b/Ch3 - Dynamically Create Images/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch3 - Dynamically Create Images/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch3 - Dynamically Create Images/Web.config b/Ch3 - Dynamically Create Images/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch3 - Dynamically Create Images/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Dynamically Create Images/WebForm1.aspx b/Ch3 - Dynamically Create Images/WebForm1.aspx new file mode 100644 index 0000000..5501789 --- /dev/null +++ b/Ch3 - Dynamically Create Images/WebForm1.aspx @@ -0,0 +1,16 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch3___Dynamically_Create_Images.WebForm1"%> + + + + WebForm1 + + + + + + +
+ How to Dynamically Create Images - just hit F5 and watch! +
+ + diff --git a/Ch3 - Dynamically Create Images/WebForm1.aspx.resx b/Ch3 - Dynamically Create Images/WebForm1.aspx.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Dynamically Create Images/WebForm1.aspx.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Dynamically Create Images/WebForm1.aspx.vb b/Ch3 - Dynamically Create Images/WebForm1.aspx.vb new file mode 100644 index 0000000..d0beed5 --- /dev/null +++ b/Ch3 - Dynamically Create Images/WebForm1.aspx.vb @@ -0,0 +1,44 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents Label1 As System.Web.UI.WebControls.Label + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + ' Create image - you could even load an image + ' from a file and edit it in code + Dim objBitmap As Bitmap = New Bitmap(120, 30) + Dim objGraphics As Graphics = Graphics.FromImage(objBitmap) + ' Fill background + objGraphics.FillRectangle(New SolidBrush(Color.LightBlue), _ + 0, 0, 120, 30) + ' Create blue-yellow bullet point + objGraphics.FillEllipse(New SolidBrush(Color.Blue), 3, 9, 10, 10) + objGraphics.FillEllipse(New SolidBrush(Color.Yellow), 4, 10, 8, 8) + ' Draw text next to bullet point + objGraphics.DrawString("Empty Karl's Basket", _ + New Font("Tahoma", 8), New SolidBrush(Color.Green), 16, 8) + ' Send down to client + Response.Clear() + Response.ContentType = "image/jpeg" + objBitmap.Save(Response.OutputStream, _ + System.Drawing.Imaging.ImageFormat.Jpeg) + ' Tidy up + objGraphics.Dispose() + objBitmap.Dispose() + End Sub + +End Class diff --git a/Ch3 - Dynamically Create Images/_vti_pvt/access.cnf b/Ch3 - Dynamically Create Images/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch3 - Dynamically Create Images/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch3 - Dynamically Create Images/_vti_pvt/deptodoc.btr b/Ch3 - Dynamically Create Images/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch3 - Dynamically Create Images/_vti_pvt/deptodoc.btr differ diff --git a/Ch3 - Dynamically Create Images/_vti_pvt/doctodep.btr b/Ch3 - Dynamically Create Images/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..2ac3a56 Binary files /dev/null and b/Ch3 - Dynamically Create Images/_vti_pvt/doctodep.btr differ diff --git a/Ch3 - Dynamically Create Images/_vti_pvt/service.cnf b/Ch3 - Dynamically Create Images/_vti_pvt/service.cnf new file mode 100644 index 0000000..80d9416 --- /dev/null +++ b/Ch3 - Dynamically Create Images/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|06 Nov 2002 14:09:35 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch3 - Dynamically Create Images/_vti_pvt/service.lck b/Ch3 - Dynamically Create Images/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch3 - Dynamically Create Images/_vti_pvt/services.cnf b/Ch3 - Dynamically Create Images/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch3 - Dynamically Create Images/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch3 - Dynamically Create Images/bin/Ch3 - Dynamically Create Images.dll b/Ch3 - Dynamically Create Images/bin/Ch3 - Dynamically Create Images.dll new file mode 100644 index 0000000..491249c Binary files /dev/null and b/Ch3 - Dynamically Create Images/bin/Ch3 - Dynamically Create Images.dll differ diff --git a/Ch3 - Dynamically Create Images/bin/Ch3 - Dynamically Create Images.pdb b/Ch3 - Dynamically Create Images/bin/Ch3 - Dynamically Create Images.pdb new file mode 100644 index 0000000..cdba41e Binary files /dev/null and b/Ch3 - Dynamically Create Images/bin/Ch3 - Dynamically Create Images.pdb differ diff --git a/Ch3 - Move List Items/AssemblyInfo.vb b/Ch3 - Move List Items/AssemblyInfo.vb new file mode 100644 index 0000000..f08e5ad --- /dev/null +++ b/Ch3 - Move List Items/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch3 - Move List Items/Ch3 - Move List Items.vbproj b/Ch3 - Move List Items/Ch3 - Move List Items.vbproj new file mode 100644 index 0000000..d6936ce --- /dev/null +++ b/Ch3 - Move List Items/Ch3 - Move List Items.vbproj @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Move List Items/Ch3 - Move List Items.vbproj.webinfo b/Ch3 - Move List Items/Ch3 - Move List Items.vbproj.webinfo new file mode 100644 index 0000000..a3cbad0 --- /dev/null +++ b/Ch3 - Move List Items/Ch3 - Move List Items.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch3 - Move List Items/Ch3 - Move List Items.vsdisco b/Ch3 - Move List Items/Ch3 - Move List Items.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch3 - Move List Items/Ch3 - Move List Items.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch3 - Move List Items/Global.asax b/Ch3 - Move List Items/Global.asax new file mode 100644 index 0000000..822fe90 --- /dev/null +++ b/Ch3 - Move List Items/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch3___Move_List_Items.Global" %> \ No newline at end of file diff --git a/Ch3 - Move List Items/Global.asax.resx b/Ch3 - Move List Items/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Move List Items/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Move List Items/Global.asax.vb b/Ch3 - Move List Items/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch3 - Move List Items/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch3 - Move List Items/Read Me First.txt b/Ch3 - Move List Items/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch3 - Move List Items/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch3 - Move List Items/Styles.css b/Ch3 - Move List Items/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch3 - Move List Items/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch3 - Move List Items/Web.config b/Ch3 - Move List Items/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch3 - Move List Items/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Move List Items/WebForm1.aspx b/Ch3 - Move List Items/WebForm1.aspx new file mode 100644 index 0000000..48b88c2 --- /dev/null +++ b/Ch3 - Move List Items/WebForm1.aspx @@ -0,0 +1,26 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch3___Move_List_Items.WebForm1"%> + + + + WebForm1 + + + + + + +
+ + Ken Strauss + Lisa Root + Jamie Plenderleith + Mark Sandler + Jackie Roberts + Katrina Bunker + + + Click on the buttons to move items up and down in the list. + +
+ + diff --git a/Ch3 - Move List Items/WebForm1.aspx.resx b/Ch3 - Move List Items/WebForm1.aspx.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Move List Items/WebForm1.aspx.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Move List Items/WebForm1.aspx.vb b/Ch3 - Move List Items/WebForm1.aspx.vb new file mode 100644 index 0000000..abde613 --- /dev/null +++ b/Ch3 - Move List Items/WebForm1.aspx.vb @@ -0,0 +1,61 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents ListBox1 As System.Web.UI.WebControls.ListBox + Protected WithEvents Label1 As System.Web.UI.WebControls.Label + Protected WithEvents Button1 As System.Web.UI.WebControls.Button + Protected WithEvents Button2 As System.Web.UI.WebControls.Button + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Public Sub MoveSelectedItemUp(ByVal List As _ + System.Web.UI.WebControls.ListControl) + ' Move the selected item in the passed ListBox + ' up one, if possible. Sample usage: + ' - MoveSelectedItemUp(ListBox1) + If Not List.SelectedItem Is Nothing Then + Dim objListItem As System.Web.UI.WebControls.ListItem, _ + intPosition As Integer + objListItem = List.SelectedItem + intPosition = List.Items.IndexOf(objListItem) + List.Items.Remove(objListItem) + List.Items.Insert(IIf(intPosition = 0, 0, intPosition - 1), objListItem) + End If + End Sub + + Public Sub MoveSelectedItemDown(ByVal List As _ + System.Web.UI.WebControls.ListControl) + ' Move the selected item in the passed ListBox + ' down one, if possible + If Not List.SelectedItem Is Nothing Then + Dim objListItem As System.Web.UI.WebControls.ListItem, _ + intPosition As Integer + objListItem = List.SelectedItem + intPosition = List.Items.IndexOf(objListItem) + If intPosition = List.Items.Count - 1 Then Exit Sub + List.Items.Remove(objListItem) + List.Items.Insert(intPosition + 1, objListItem) + End If + End Sub + + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + MoveSelectedItemUp(ListBox1) + End Sub + + Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click + MoveSelectedItemDown(ListBox1) + End Sub +End Class diff --git a/Ch3 - Move List Items/_vti_pvt/access.cnf b/Ch3 - Move List Items/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch3 - Move List Items/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch3 - Move List Items/_vti_pvt/deptodoc.btr b/Ch3 - Move List Items/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch3 - Move List Items/_vti_pvt/deptodoc.btr differ diff --git a/Ch3 - Move List Items/_vti_pvt/doctodep.btr b/Ch3 - Move List Items/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch3 - Move List Items/_vti_pvt/doctodep.btr differ diff --git a/Ch3 - Move List Items/_vti_pvt/service.cnf b/Ch3 - Move List Items/_vti_pvt/service.cnf new file mode 100644 index 0000000..d4e85a7 --- /dev/null +++ b/Ch3 - Move List Items/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|05 Nov 2002 17:22:08 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch3 - Move List Items/_vti_pvt/service.lck b/Ch3 - Move List Items/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch3 - Move List Items/_vti_pvt/services.cnf b/Ch3 - Move List Items/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch3 - Move List Items/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch3 - Move List Items/bin/Ch3 - Move List Items.dll b/Ch3 - Move List Items/bin/Ch3 - Move List Items.dll new file mode 100644 index 0000000..ee5c303 Binary files /dev/null and b/Ch3 - Move List Items/bin/Ch3 - Move List Items.dll differ diff --git a/Ch3 - Move List Items/bin/Ch3 - Move List Items.pdb b/Ch3 - Move List Items/bin/Ch3 - Move List Items.pdb new file mode 100644 index 0000000..0e29596 Binary files /dev/null and b/Ch3 - Move List Items/bin/Ch3 - Move List Items.pdb differ diff --git a/Ch3 - Page Not Found/403.aspx b/Ch3 - Page Not Found/403.aspx new file mode 100644 index 0000000..f2b1ff2 --- /dev/null +++ b/Ch3 - Page Not Found/403.aspx @@ -0,0 +1,16 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="403.aspx.vb" Inherits="Ch3___Page_Not_Found._403"%> + + + + _403 + + + + + + +
+ 403: Permission denied. Sorry! +
+ + diff --git a/Ch3 - Page Not Found/403.aspx.resx b/Ch3 - Page Not Found/403.aspx.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Page Not Found/403.aspx.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Page Not Found/403.aspx.vb b/Ch3 - Page Not Found/403.aspx.vb new file mode 100644 index 0000000..de2acbe --- /dev/null +++ b/Ch3 - Page Not Found/403.aspx.vb @@ -0,0 +1,24 @@ +Public Class _403 + Inherits System.Web.UI.Page + Protected WithEvents Label1 As System.Web.UI.WebControls.Label + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + 'Put user code to initialize the page here + End Sub + +End Class diff --git a/Ch3 - Page Not Found/404.aspx b/Ch3 - Page Not Found/404.aspx new file mode 100644 index 0000000..3867668 --- /dev/null +++ b/Ch3 - Page Not Found/404.aspx @@ -0,0 +1,18 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="404.aspx.vb" Inherits="Ch3___Page_Not_Found._404"%> + + + + _404 + + + + + + +
+ You were looking for + ... but you know something? I couldn't find it! Error 404. + Label +
+ + diff --git a/Ch3 - Page Not Found/404.aspx.resx b/Ch3 - Page Not Found/404.aspx.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Page Not Found/404.aspx.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Page Not Found/404.aspx.vb b/Ch3 - Page Not Found/404.aspx.vb new file mode 100644 index 0000000..302783c --- /dev/null +++ b/Ch3 - Page Not Found/404.aspx.vb @@ -0,0 +1,26 @@ +Public Class _404 + Inherits System.Web.UI.Page + Protected WithEvents Label1 As System.Web.UI.WebControls.Label + Protected WithEvents lblLocation As System.Web.UI.WebControls.Label + Protected WithEvents Label2 As System.Web.UI.WebControls.Label + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + lblLocation.Text = Request.QueryString("aspxerrorpath") + End Sub + +End Class diff --git a/Ch3 - Page Not Found/AssemblyInfo.vb b/Ch3 - Page Not Found/AssemblyInfo.vb new file mode 100644 index 0000000..89e39b5 --- /dev/null +++ b/Ch3 - Page Not Found/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch3 - Page Not Found/Ch3 - Page Not Found.vbproj b/Ch3 - Page Not Found/Ch3 - Page Not Found.vbproj new file mode 100644 index 0000000..4e342f9 --- /dev/null +++ b/Ch3 - Page Not Found/Ch3 - Page Not Found.vbproj @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Page Not Found/Ch3 - Page Not Found.vbproj.webinfo b/Ch3 - Page Not Found/Ch3 - Page Not Found.vbproj.webinfo new file mode 100644 index 0000000..1094212 --- /dev/null +++ b/Ch3 - Page Not Found/Ch3 - Page Not Found.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch3 - Page Not Found/Ch3 - Page Not Found.vsdisco b/Ch3 - Page Not Found/Ch3 - Page Not Found.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch3 - Page Not Found/Ch3 - Page Not Found.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch3 - Page Not Found/Global.asax b/Ch3 - Page Not Found/Global.asax new file mode 100644 index 0000000..02bbf2a --- /dev/null +++ b/Ch3 - Page Not Found/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch3___Page_Not_Found.Global" %> \ No newline at end of file diff --git a/Ch3 - Page Not Found/Global.asax.resx b/Ch3 - Page Not Found/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Page Not Found/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Page Not Found/Global.asax.vb b/Ch3 - Page Not Found/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch3 - Page Not Found/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch3 - Page Not Found/Read Me First.txt b/Ch3 - Page Not Found/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch3 - Page Not Found/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch3 - Page Not Found/Styles.css b/Ch3 - Page Not Found/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch3 - Page Not Found/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch3 - Page Not Found/Web.config b/Ch3 - Page Not Found/Web.config new file mode 100644 index 0000000..77aaf47 --- /dev/null +++ b/Ch3 - Page Not Found/Web.config @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Page Not Found/_vti_pvt/access.cnf b/Ch3 - Page Not Found/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch3 - Page Not Found/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch3 - Page Not Found/_vti_pvt/deptodoc.btr b/Ch3 - Page Not Found/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..65ea3b9 Binary files /dev/null and b/Ch3 - Page Not Found/_vti_pvt/deptodoc.btr differ diff --git a/Ch3 - Page Not Found/_vti_pvt/doctodep.btr b/Ch3 - Page Not Found/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch3 - Page Not Found/_vti_pvt/doctodep.btr differ diff --git a/Ch3 - Page Not Found/_vti_pvt/service.cnf b/Ch3 - Page Not Found/_vti_pvt/service.cnf new file mode 100644 index 0000000..db65a28 --- /dev/null +++ b/Ch3 - Page Not Found/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|06 Nov 2002 14:53:18 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch3 - Page Not Found/_vti_pvt/service.lck b/Ch3 - Page Not Found/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch3 - Page Not Found/_vti_pvt/services.cnf b/Ch3 - Page Not Found/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch3 - Page Not Found/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch3 - Page Not Found/bin/Ch3 - Page Not Found.dll b/Ch3 - Page Not Found/bin/Ch3 - Page Not Found.dll new file mode 100644 index 0000000..6d3a550 Binary files /dev/null and b/Ch3 - Page Not Found/bin/Ch3 - Page Not Found.dll differ diff --git a/Ch3 - Page Not Found/bin/Ch3 - Page Not Found.pdb b/Ch3 - Page Not Found/bin/Ch3 - Page Not Found.pdb new file mode 100644 index 0000000..1415a57 Binary files /dev/null and b/Ch3 - Page Not Found/bin/Ch3 - Page Not Found.pdb differ diff --git a/Ch3 - Page Not Found/genericerror.aspx b/Ch3 - Page Not Found/genericerror.aspx new file mode 100644 index 0000000..9e3a15b --- /dev/null +++ b/Ch3 - Page Not Found/genericerror.aspx @@ -0,0 +1,16 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="genericerror.aspx.vb" Inherits="Ch3___Page_Not_Found.genericerror"%> + + + + genericerror + + + + + + +
+ Something bad happened. Error or something. Eugh. +
+ + diff --git a/Ch3 - Page Not Found/genericerror.aspx.resx b/Ch3 - Page Not Found/genericerror.aspx.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Page Not Found/genericerror.aspx.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Page Not Found/genericerror.aspx.vb b/Ch3 - Page Not Found/genericerror.aspx.vb new file mode 100644 index 0000000..63fdacc --- /dev/null +++ b/Ch3 - Page Not Found/genericerror.aspx.vb @@ -0,0 +1,24 @@ +Public Class genericerror + Inherits System.Web.UI.Page + Protected WithEvents Label1 As System.Web.UI.WebControls.Label + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + 'Put user code to initialize the page here + End Sub + +End Class diff --git a/Ch3 - Page Not Found/readme.aspx b/Ch3 - Page Not Found/readme.aspx new file mode 100644 index 0000000..6fb3dc2 --- /dev/null +++ b/Ch3 - Page Not Found/readme.aspx @@ -0,0 +1,17 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="readme.aspx.vb" Inherits="Ch3___Page_Not_Found.readme"%> + + + + readme + + + + + + +
+ Click the following link to generate a 404 Page Not Found error: + Test the 404 by visiting an invalid page +
+ + diff --git a/Ch3 - Page Not Found/readme.aspx.resx b/Ch3 - Page Not Found/readme.aspx.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Page Not Found/readme.aspx.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Page Not Found/readme.aspx.vb b/Ch3 - Page Not Found/readme.aspx.vb new file mode 100644 index 0000000..c02b4c0 --- /dev/null +++ b/Ch3 - Page Not Found/readme.aspx.vb @@ -0,0 +1,25 @@ +Public Class readme + Inherits System.Web.UI.Page + Protected WithEvents Label1 As System.Web.UI.WebControls.Label + Protected WithEvents HyperLink1 As System.Web.UI.WebControls.HyperLink + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + 'Put user code to initialize the page here + End Sub + +End Class diff --git a/Ch3 - PayPal/readme.htm b/Ch3 - PayPal/readme.htm new file mode 100644 index 0000000..304242f --- /dev/null +++ b/Ch3 - PayPal/readme.htm @@ -0,0 +1,194 @@ + + + + + + +How to Implement PayPal IPN Techniques + + + + +
+ + + + +
+ + + + +
+ + + + +
+
+ +
+ Implement PayPal's Instant Payment Notification IPN with .NET

+ PayPal's Instant Payment Notification (IPN) allows you to + program your back-end operations to automate transactions when + you receive payments from your customers. As of this initial + writing, no samples on the entire searchable Internet have + illustrated how this simple task can be done with the .NET + Framework. If you are already familiar with the background of + PayPal, then jump right to the .NET code.

+

Background

+

Whenever purchases are made through PayPal by a customer, + PayPal uses IPN to post the transaction information to a + resource that you specify:

+

Example (Fake Url): + + https://www.myserver.com/PayPal/PaymentNotification.aspx

+

Once your resource receives the post, you must complete 4 + steps:

+
    +
  1. Notification Validation
    + In this step, your job is to post the data that was posted to + you back to PayPal. This ensures that the original post indeed + came from PayPal, and is not sort of fraud. In the data that + you post back, you must append the "cmd=_notify-validate" + value to the POST string. Once the data is posted back to + PayPal, PayPal will respond with a string of either "VERIFIED" + or "INVALID". "VERIFIED" means that PayPal sent the original + post, and that you should continue your automation process as + part of the transaction. "INVALID" means that PayPal did not + send the original post, and it should probably belogged and + investigated for possible fraud.
  2. +
  3. Payment Status Check
    + In this step, you should check that the "payment_status" form + field is "Completed". This ensures that the customer's payment + has been processed by PayPal, and it has been added to the + seller's account.
  4. +
  5. Transaction Duplication Check
    + In this step, you should check that the "txn_id" form field, + transaction ID, has not already been processed by your + automation system. A good thing to do is to store the + transaction ID in a database or file for duplication checking. + If the transaction ID posted by PayPal is a duplicate, you + should not continue your automation process for this + transaction. Otherwise, this could result in sending the same + product to a customer twice.
  6. +
  7. Seller Email Validation
    + In this step, you simply make sure that the transaction is for + your account. Your account will have specific email addresses + assigned to it. You should verify that the "receiver_email" + field has a value that corresponds to an email associated with + your account.
  8. +
  9. Payment Validation
    + As of now, this step is not listed on other sites as a + requirement, but it is very important. Because any + customer who is familiar with query strings can modify the + cost of a seller's product, you should verify that the "payment_gross" + field corresponds with the actual price of the item that the + customer is purchasing. It is up to you to determine the exact + price of the item the customer is purchasing using the form + fields. Some common fields you may use to lookup the item + being purchased include "item_name" and "item_number". To see + for yourself, follow these steps:
  10. +
+
    +
  • Click on a button used to purchase one of your products. +
  • +
  • Locate the "payment_gross" field in the query string and + change its value.
  • +
  • Use the changed URL and perform a re-request, typically by + hitting [ENTER] in the browser Address Bar.
  • +
  • Notice the changed price for your product on the PayPal + order page.
  • +
+

 

+

Posting Back with .NET

+
public class PaymentNotification : System.Web.UI.Page
+{
+  // This helper method encodes a string correctly for an HTTP POST
+  private string Encode(string oldValue)
+  {
+    string newValue = oldValue.Replace("\"", "'");
+    newValue = System.Web.HttpUtility.UrlEncode(newValue);
+    newValue = newValue.Replace("%2f", "/");
+    return newValue;
+  }
+  
+  private void Page_Load(object sender, System.EventArgs e)
+  {
+    // Step 1a: Modify the POST string.
+    string formPostData = "cmd = _notify-validate";
+    foreach (String postKey in Request.Form)
+    {
+      string postValue = Encode(Request.Form[postKey]);
+      formPostData += string.Format("&{0}={1}", postKey, postValue);
+    }
+    
+    // Step 1b: POST the data back to PayPal.
+    WebClient client = new WebClient();
+    client.Headers.Add("Content-Type","application/x-www-form-urlencoded");
+    byte[] postByteArray = Encoding.ASCII.GetBytes(formPostData);
+    byte[] responseArray = client.UploadData("https://www.paypal.com/cgi-bin/webscr", "POST", postByteArray);
+    string response = Encoding.ASCII.GetString(responseArray);
+    
+    // Step 1c: Process the response from PayPal.
+    switch (response)
+    {
+      case "VERIFIED":
+      {
+        // Perform steps 2-5 above. 
+        // Continue with automation processing if all steps succeeded.
+        break
+        ;
+      }
+      default:
+      {
+        // Possible fraud. Log for investigation.
+        break;
+      }
+    }
+  }
+}
+		
+
+		
+ +

Posting Back With COM and + IXmlHttpRequest

+

And for the .NET developers who still want to use COM and + IXmlHttpRequest, here is the equivalent code for Step 1b:

+
    object msxml = Server.CreateObject("Msxml2.XMLHTTP");
+    Type type = msxml.GetType();
+    object[] args = {"POST", "https://www.paypal.com/cgi-bin/webscr", false};
+    object[] args2 = {formPostData};
+    type.InvokeMember("Open", System.Reflection.BindingFlags.InvokeMethod, null, msxml, args);
+    type.InvokeMember("Send", System.Reflection.BindingFlags.InvokeMethod, null, msxml, args2);
+    object responseObj = type.InvokeMember("responseText", 
+	                                   System.Reflection.BindingFlags.GetProperty, 
+	                                   null, 
+	                                   msxml, 
+	                                   null);
+    string response = (string) responseObj;
+			
+


+ When using Server.CreateObject in ASP.NET, + however, you must add aspcompat=true to the Page + directive, as shown:
+
+ + <%@ Page aspcompat=true language="c#" Codebehind="PaymentNotification.aspx.cs" + AutoEventWireup="false" Inherits="PaymentNotification" %> +

+
+
+
+
+ + + + diff --git a/Ch3 - Send Mail/AssemblyInfo.vb b/Ch3 - Send Mail/AssemblyInfo.vb new file mode 100644 index 0000000..c8ac1fd --- /dev/null +++ b/Ch3 - Send Mail/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch3 - Send Mail/Ch3 - Send Mail.vbproj b/Ch3 - Send Mail/Ch3 - Send Mail.vbproj new file mode 100644 index 0000000..514b64e --- /dev/null +++ b/Ch3 - Send Mail/Ch3 - Send Mail.vbproj @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Send Mail/Ch3 - Send Mail.vbproj.webinfo b/Ch3 - Send Mail/Ch3 - Send Mail.vbproj.webinfo new file mode 100644 index 0000000..a438f65 --- /dev/null +++ b/Ch3 - Send Mail/Ch3 - Send Mail.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch3 - Send Mail/Ch3 - Send Mail.vsdisco b/Ch3 - Send Mail/Ch3 - Send Mail.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch3 - Send Mail/Ch3 - Send Mail.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch3 - Send Mail/Global.asax b/Ch3 - Send Mail/Global.asax new file mode 100644 index 0000000..6853273 --- /dev/null +++ b/Ch3 - Send Mail/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch3___Send_Mail.Global" %> \ No newline at end of file diff --git a/Ch3 - Send Mail/Global.asax.resx b/Ch3 - Send Mail/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Send Mail/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Send Mail/Global.asax.vb b/Ch3 - Send Mail/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch3 - Send Mail/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch3 - Send Mail/Read Me First.txt b/Ch3 - Send Mail/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch3 - Send Mail/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch3 - Send Mail/Styles.css b/Ch3 - Send Mail/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch3 - Send Mail/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch3 - Send Mail/Web.config b/Ch3 - Send Mail/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch3 - Send Mail/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Send Mail/WebForm1.aspx b/Ch3 - Send Mail/WebForm1.aspx new file mode 100644 index 0000000..838f093 --- /dev/null +++ b/Ch3 - Send Mail/WebForm1.aspx @@ -0,0 +1,26 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch3___Send_Mail.WebForm1"%> + + + + WebForm1 + + + + + + +
+ + + Body: + Bo + From: + + + To: + Compose Message + To: + +
+ + diff --git a/Ch3 - Send Mail/WebForm1.aspx.resx b/Ch3 - Send Mail/WebForm1.aspx.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Send Mail/WebForm1.aspx.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Send Mail/WebForm1.aspx.vb b/Ch3 - Send Mail/WebForm1.aspx.vb new file mode 100644 index 0000000..6d39d2d --- /dev/null +++ b/Ch3 - Send Mail/WebForm1.aspx.vb @@ -0,0 +1,69 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents Button1 As System.Web.UI.WebControls.Button + Protected WithEvents Label2 As System.Web.UI.WebControls.Label + Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox + Protected WithEvents Label3 As System.Web.UI.WebControls.Label + Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox + Protected WithEvents TextBox3 As System.Web.UI.WebControls.TextBox + Protected WithEvents Label4 As System.Web.UI.WebControls.Label + Protected WithEvents Label5 As System.Web.UI.WebControls.Label + Protected WithEvents Label6 As System.Web.UI.WebControls.Label + Protected WithEvents TextBox4 As System.Web.UI.WebControls.TextBox + Protected WithEvents Label1 As System.Web.UI.WebControls.Label + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + 'Put user code to initialize the page here + End Sub + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + If SendMail(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text, False, "karlmoore.com") Then + Response.Write("Message sent!") + Else + Response.Write("Unsuccessful: message not sent. Check the e-mail address and SMTP server argument.") + End If + End Sub + + Public Function SendMail(ByVal [To] As String, _ + ByVal From As String, ByVal Subject As String, _ + ByVal Body As String, ByVal IsHTML As Boolean, _ + Optional ByVal SmtpServer As String = "domain.com") As Boolean + ' Sends a mail message using the specified details + ' - returns a False if delivery fails + Try + Dim objMsg As New System.Web.Mail.MailMessage() + SendMail = True + With objMsg + .To = [To] + .From = From + .Subject = Subject + .Body = Body + ' .BodyFormat specifies whether the Body is + ' in plain text or HTML format + .BodyFormat = IIf(IsHTML = True, _ + System.Web.Mail.MailFormat.Html, _ + System.Web.Mail.MailFormat.Text) + End With + System.Web.Mail.SmtpMail.SmtpServer = SmtpServer + System.Web.Mail.SmtpMail.Send(objMsg) + Catch + SendMail = False + End Try + End Function + +End Class diff --git a/Ch3 - Send Mail/_vti_pvt/access.cnf b/Ch3 - Send Mail/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch3 - Send Mail/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch3 - Send Mail/_vti_pvt/deptodoc.btr b/Ch3 - Send Mail/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..65ea3b9 Binary files /dev/null and b/Ch3 - Send Mail/_vti_pvt/deptodoc.btr differ diff --git a/Ch3 - Send Mail/_vti_pvt/doctodep.btr b/Ch3 - Send Mail/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch3 - Send Mail/_vti_pvt/doctodep.btr differ diff --git a/Ch3 - Send Mail/_vti_pvt/service.cnf b/Ch3 - Send Mail/_vti_pvt/service.cnf new file mode 100644 index 0000000..dc1be11 --- /dev/null +++ b/Ch3 - Send Mail/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|05 Nov 2002 17:26:48 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch3 - Send Mail/_vti_pvt/service.lck b/Ch3 - Send Mail/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch3 - Send Mail/_vti_pvt/services.cnf b/Ch3 - Send Mail/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch3 - Send Mail/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch3 - Send Mail/bin/Ch3 - Send Mail.dll b/Ch3 - Send Mail/bin/Ch3 - Send Mail.dll new file mode 100644 index 0000000..13ca5f4 Binary files /dev/null and b/Ch3 - Send Mail/bin/Ch3 - Send Mail.dll differ diff --git a/Ch3 - Send Mail/bin/Ch3 - Send Mail.pdb b/Ch3 - Send Mail/bin/Ch3 - Send Mail.pdb new file mode 100644 index 0000000..e97c7fb Binary files /dev/null and b/Ch3 - Send Mail/bin/Ch3 - Send Mail.pdb differ diff --git a/Ch3 - Settings/AssemblyInfo.vb b/Ch3 - Settings/AssemblyInfo.vb new file mode 100644 index 0000000..fa5ce71 --- /dev/null +++ b/Ch3 - Settings/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch3 - Settings/Ch3 - Settings.vbproj b/Ch3 - Settings/Ch3 - Settings.vbproj new file mode 100644 index 0000000..0165cd9 --- /dev/null +++ b/Ch3 - Settings/Ch3 - Settings.vbproj @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Settings/Ch3 - Settings.vbproj.webinfo b/Ch3 - Settings/Ch3 - Settings.vbproj.webinfo new file mode 100644 index 0000000..4109d78 --- /dev/null +++ b/Ch3 - Settings/Ch3 - Settings.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch3 - Settings/Ch3 - Settings.vsdisco b/Ch3 - Settings/Ch3 - Settings.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch3 - Settings/Ch3 - Settings.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch3 - Settings/Global.asax b/Ch3 - Settings/Global.asax new file mode 100644 index 0000000..05e9107 --- /dev/null +++ b/Ch3 - Settings/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch3___Settings.Global" %> \ No newline at end of file diff --git a/Ch3 - Settings/Global.asax.resx b/Ch3 - Settings/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Settings/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Settings/Global.asax.vb b/Ch3 - Settings/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch3 - Settings/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch3 - Settings/Read Me First.txt b/Ch3 - Settings/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch3 - Settings/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch3 - Settings/Styles.css b/Ch3 - Settings/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch3 - Settings/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch3 - Settings/Web.config b/Ch3 - Settings/Web.config new file mode 100644 index 0000000..fa248f5 --- /dev/null +++ b/Ch3 - Settings/Web.config @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Settings/WebForm1.aspx b/Ch3 - Settings/WebForm1.aspx new file mode 100644 index 0000000..e148ac0 --- /dev/null +++ b/Ch3 - Settings/WebForm1.aspx @@ -0,0 +1,17 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch3___Settings.WebForm1"%> + + + + WebForm1 + + + + + + +
+ + +
+ + diff --git a/Ch3 - Settings/WebForm1.aspx.resx b/Ch3 - Settings/WebForm1.aspx.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Settings/WebForm1.aspx.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Settings/WebForm1.aspx.vb b/Ch3 - Settings/WebForm1.aspx.vb new file mode 100644 index 0000000..156632b --- /dev/null +++ b/Ch3 - Settings/WebForm1.aspx.vb @@ -0,0 +1,29 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents Button1 As System.Web.UI.WebControls.Button + Protected WithEvents Label1 As System.Web.UI.WebControls.Label + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + 'Put user code to initialize the page here + End Sub + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + Label1.Text = "The value of 'serverName' in Web.config is: " & _ + System.Configuration.ConfigurationSettings.AppSettings("serverName") + End Sub +End Class diff --git a/Ch3 - Settings/_vti_pvt/access.cnf b/Ch3 - Settings/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch3 - Settings/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch3 - Settings/_vti_pvt/deptodoc.btr b/Ch3 - Settings/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..65ea3b9 Binary files /dev/null and b/Ch3 - Settings/_vti_pvt/deptodoc.btr differ diff --git a/Ch3 - Settings/_vti_pvt/doctodep.btr b/Ch3 - Settings/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch3 - Settings/_vti_pvt/doctodep.btr differ diff --git a/Ch3 - Settings/_vti_pvt/service.cnf b/Ch3 - Settings/_vti_pvt/service.cnf new file mode 100644 index 0000000..f732418 --- /dev/null +++ b/Ch3 - Settings/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|06 Nov 2002 14:39:12 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch3 - Settings/_vti_pvt/service.lck b/Ch3 - Settings/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch3 - Settings/_vti_pvt/services.cnf b/Ch3 - Settings/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch3 - Settings/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch3 - Settings/bin/Ch3 - Settings.dll b/Ch3 - Settings/bin/Ch3 - Settings.dll new file mode 100644 index 0000000..efd4b7b Binary files /dev/null and b/Ch3 - Settings/bin/Ch3 - Settings.dll differ diff --git a/Ch3 - Settings/bin/Ch3 - Settings.pdb b/Ch3 - Settings/bin/Ch3 - Settings.pdb new file mode 100644 index 0000000..4096dd2 Binary files /dev/null and b/Ch3 - Settings/bin/Ch3 - Settings.pdb differ diff --git a/Ch3 - Spy on Web Host/AssemblyInfo.vb b/Ch3 - Spy on Web Host/AssemblyInfo.vb new file mode 100644 index 0000000..3872695 --- /dev/null +++ b/Ch3 - Spy on Web Host/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch3 - Spy on Web Host/Ch3 - Spy on Web Host.sln b/Ch3 - Spy on Web Host/Ch3 - Spy on Web Host.sln new file mode 100644 index 0000000..b867d21 --- /dev/null +++ b/Ch3 - Spy on Web Host/Ch3 - Spy on Web Host.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch3 - Spy on Web Host", "http://localhost/Ch3 - Spy on Web Host/Ch3 - Spy on Web Host.vbproj", "{955186A0-5019-4D7F-8911-BC8D2BBE5E72}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {955186A0-5019-4D7F-8911-BC8D2BBE5E72}.Debug.ActiveCfg = Debug|.NET + {955186A0-5019-4D7F-8911-BC8D2BBE5E72}.Debug.Build.0 = Debug|.NET + {955186A0-5019-4D7F-8911-BC8D2BBE5E72}.Release.ActiveCfg = Release|.NET + {955186A0-5019-4D7F-8911-BC8D2BBE5E72}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch3 - Spy on Web Host/Ch3 - Spy on Web Host.suo b/Ch3 - Spy on Web Host/Ch3 - Spy on Web Host.suo new file mode 100644 index 0000000..08f61c0 Binary files /dev/null and b/Ch3 - Spy on Web Host/Ch3 - Spy on Web Host.suo differ diff --git a/Ch3 - Spy on Web Host/Ch3 - Spy on Web Host.vbproj b/Ch3 - Spy on Web Host/Ch3 - Spy on Web Host.vbproj new file mode 100644 index 0000000..775a79c --- /dev/null +++ b/Ch3 - Spy on Web Host/Ch3 - Spy on Web Host.vbproj @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Spy on Web Host/Ch3 - Spy on Web Host.vbproj.webinfo b/Ch3 - Spy on Web Host/Ch3 - Spy on Web Host.vbproj.webinfo new file mode 100644 index 0000000..12476bf --- /dev/null +++ b/Ch3 - Spy on Web Host/Ch3 - Spy on Web Host.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch3 - Spy on Web Host/Ch3 - Spy on Web Host.vsdisco b/Ch3 - Spy on Web Host/Ch3 - Spy on Web Host.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch3 - Spy on Web Host/Ch3 - Spy on Web Host.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch3 - Spy on Web Host/Global.asax b/Ch3 - Spy on Web Host/Global.asax new file mode 100644 index 0000000..a6baaaf --- /dev/null +++ b/Ch3 - Spy on Web Host/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch3___Spy_on_Web_Host.Global" %> \ No newline at end of file diff --git a/Ch3 - Spy on Web Host/Global.asax.resx b/Ch3 - Spy on Web Host/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Spy on Web Host/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Spy on Web Host/Global.asax.vb b/Ch3 - Spy on Web Host/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch3 - Spy on Web Host/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch3 - Spy on Web Host/Read Me First.txt b/Ch3 - Spy on Web Host/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch3 - Spy on Web Host/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch3 - Spy on Web Host/Styles.css b/Ch3 - Spy on Web Host/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch3 - Spy on Web Host/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch3 - Spy on Web Host/Web.config b/Ch3 - Spy on Web Host/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch3 - Spy on Web Host/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Spy on Web Host/WebForm1.aspx b/Ch3 - Spy on Web Host/WebForm1.aspx new file mode 100644 index 0000000..a9eeac0 --- /dev/null +++ b/Ch3 - Spy on Web Host/WebForm1.aspx @@ -0,0 +1,16 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch3___Spy_on_Web_Host.WebForm1"%> + + + + Spy on your Web Host: Checking Uptime in .NET + + + + + + +
+ Run this page to spy on your Web host! +
+ + diff --git a/Ch3 - Spy on Web Host/WebForm1.aspx.resx b/Ch3 - Spy on Web Host/WebForm1.aspx.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Spy on Web Host/WebForm1.aspx.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Spy on Web Host/WebForm1.aspx.vb b/Ch3 - Spy on Web Host/WebForm1.aspx.vb new file mode 100644 index 0000000..a5fa943 --- /dev/null +++ b/Ch3 - Spy on Web Host/WebForm1.aspx.vb @@ -0,0 +1,43 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents Label1 As System.Web.UI.WebControls.Label + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + Dim strReport As String + Dim objInfo As ProcessInfo = ProcessModelInfo.GetCurrentProcessInfo + ' Get time information + strReport = "ASP.NET was started at " & _ + objInfo.StartTime.ToString & ". " & _ + "It has been running for " & _ + objInfo.Age.Days & " days, " & _ + objInfo.Age.Hours & " hours and " & _ + objInfo.Age.Minutes & " minutes. " + Response.Write(strReport) + ' Get other info + strReport = "The process ID is " & _ + objInfo.ProcessID & ". " & _ + "Current status is " & _ + objInfo.Status.ToString & ". " & _ + "Peak memory used was " & _ + objInfo.PeakMemoryUsed & ". " & _ + "Request count is currently " & _ + objInfo.RequestCount & "." + Response.Write(strReport) + End Sub + +End Class diff --git a/Ch3 - Spy on Web Host/_vti_pvt/access.cnf b/Ch3 - Spy on Web Host/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch3 - Spy on Web Host/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch3 - Spy on Web Host/_vti_pvt/deptodoc.btr b/Ch3 - Spy on Web Host/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch3 - Spy on Web Host/_vti_pvt/deptodoc.btr differ diff --git a/Ch3 - Spy on Web Host/_vti_pvt/doctodep.btr b/Ch3 - Spy on Web Host/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch3 - Spy on Web Host/_vti_pvt/doctodep.btr differ diff --git a/Ch3 - Spy on Web Host/_vti_pvt/service.cnf b/Ch3 - Spy on Web Host/_vti_pvt/service.cnf new file mode 100644 index 0000000..d729e0b --- /dev/null +++ b/Ch3 - Spy on Web Host/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|06 Nov 2002 15:08:43 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch3 - Spy on Web Host/_vti_pvt/service.lck b/Ch3 - Spy on Web Host/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch3 - Spy on Web Host/_vti_pvt/services.cnf b/Ch3 - Spy on Web Host/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch3 - Spy on Web Host/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch3 - Spy on Web Host/bin/Ch3 - Spy on Web Host.dll b/Ch3 - Spy on Web Host/bin/Ch3 - Spy on Web Host.dll new file mode 100644 index 0000000..1d3d03c Binary files /dev/null and b/Ch3 - Spy on Web Host/bin/Ch3 - Spy on Web Host.dll differ diff --git a/Ch3 - Spy on Web Host/bin/Ch3 - Spy on Web Host.pdb b/Ch3 - Spy on Web Host/bin/Ch3 - Spy on Web Host.pdb new file mode 100644 index 0000000..2c5a7a1 Binary files /dev/null and b/Ch3 - Spy on Web Host/bin/Ch3 - Spy on Web Host.pdb differ diff --git a/Ch3 - Storing Files in Database/Read Me First.txt b/Ch3 - Storing Files in Database/Read Me First.txt new file mode 100644 index 0000000..37d2db4 --- /dev/null +++ b/Ch3 - Storing Files in Database/Read Me First.txt @@ -0,0 +1,64 @@ +Storing Uploaded Files in your Database +======================================== + +Due to the database setup required, there is no VS.NET example included with this tip - however all of the code functions from the book can be found below, ready for you to use straight away with your own file-storing database solution: + + Public Function GetByteArrayFromFileField( _ + ByVal FileField As System.Web.UI.HtmlControls.HtmlInputFile) _ + As Byte() + ' Returns a byte array from the passed + ' file field controls file + Dim intFileLength As Integer, bytData() As Byte + Dim objStream As System.IO.Stream + If FileFieldSelected(FileField) Then + intFileLength = FileField.PostedFile.ContentLength + ReDim bytData(intFileLength) + objStream = FileField.PostedFile.InputStream + objStream.Read(bytData, 0, intFileLength) + Return bytData + End If + End Function + + Public Function FileFieldType(ByVal FileField As _ + System.Web.UI.HtmlControls.HtmlInputFile) As String + ' Returns the type of the posted file + If Not FileField.PostedFile Is Nothing Then _ + Return FileField.PostedFile.ContentType + End Function + + Public Function FileFieldLength(ByVal FileField As _ + System.Web.UI.HtmlControls.HtmlInputFile) As Integer + ' Returns the length of the posted file + If Not FileField.PostedFile Is Nothing Then _ + Return FileField.PostedFile.ContentLength + End Function + + Public Function FileFieldFilename(ByVal FileField As _ + System.Web.UI.HtmlControls.HtmlInputFile) As String + ' Returns the core filename of the posted file + If Not FileField.PostedFile Is Nothing Then _ + Return Replace(FileField.PostedFile.FileName, _ + StrReverse(Mid(StrReverse(FileField.PostedFile.FileName), _ + InStr(1, StrReverse(FileField.PostedFile.FileName), "\"))), "") + End Function + + + Public Sub DeliverFile(ByVal Page As System.Web.UI.Page, _ + ByVal Data() As Byte, ByVal Type As String, _ + ByVal Length As Integer, _ + Optional ByVal DownloadFileName As String = "") + ' Delivers a file, such as an image or PDF file, + ' back through the Response object + ' Sample usage from within an ASP.NET page: + ' - DeliverFile(Me, bytFile(), strType, intLength, strDownloadName) + With Page.Response + .Clear() + .ContentType = Type + If DownloadFileName <> "" Then + Page.Response.AddHeader("content-disposition", _ + "filename=" & DownloadFileName) + End If + .OutputStream.Write(Data, 0, Length) + .End() + End With + End Sub diff --git a/Ch3 - Thumbnails/AssemblyInfo.vb b/Ch3 - Thumbnails/AssemblyInfo.vb new file mode 100644 index 0000000..c47766a --- /dev/null +++ b/Ch3 - Thumbnails/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch3 - Thumbnails/Ch3 - Thumbnails.sln b/Ch3 - Thumbnails/Ch3 - Thumbnails.sln new file mode 100644 index 0000000..74febc4 --- /dev/null +++ b/Ch3 - Thumbnails/Ch3 - Thumbnails.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch3 - Thumbnails", "http://localhost/Ch3 - Thumbnails/Ch3 - Thumbnails.vbproj", "{B04445B9-9E5E-4391-9E99-470C3FCBDE27}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {B04445B9-9E5E-4391-9E99-470C3FCBDE27}.Debug.ActiveCfg = Debug|.NET + {B04445B9-9E5E-4391-9E99-470C3FCBDE27}.Debug.Build.0 = Debug|.NET + {B04445B9-9E5E-4391-9E99-470C3FCBDE27}.Release.ActiveCfg = Release|.NET + {B04445B9-9E5E-4391-9E99-470C3FCBDE27}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch3 - Thumbnails/Ch3 - Thumbnails.suo b/Ch3 - Thumbnails/Ch3 - Thumbnails.suo new file mode 100644 index 0000000..26e7952 Binary files /dev/null and b/Ch3 - Thumbnails/Ch3 - Thumbnails.suo differ diff --git a/Ch3 - Thumbnails/Ch3 - Thumbnails.vbproj b/Ch3 - Thumbnails/Ch3 - Thumbnails.vbproj new file mode 100644 index 0000000..10d764c --- /dev/null +++ b/Ch3 - Thumbnails/Ch3 - Thumbnails.vbproj @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Thumbnails/Ch3 - Thumbnails.vbproj.webinfo b/Ch3 - Thumbnails/Ch3 - Thumbnails.vbproj.webinfo new file mode 100644 index 0000000..50626bd --- /dev/null +++ b/Ch3 - Thumbnails/Ch3 - Thumbnails.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch3 - Thumbnails/Ch3 - Thumbnails.vsdisco b/Ch3 - Thumbnails/Ch3 - Thumbnails.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch3 - Thumbnails/Ch3 - Thumbnails.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch3 - Thumbnails/Global.asax b/Ch3 - Thumbnails/Global.asax new file mode 100644 index 0000000..e53fbf6 --- /dev/null +++ b/Ch3 - Thumbnails/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch3___Thumbnails.Global" %> \ No newline at end of file diff --git a/Ch3 - Thumbnails/Global.asax.resx b/Ch3 - Thumbnails/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Thumbnails/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Thumbnails/Global.asax.vb b/Ch3 - Thumbnails/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch3 - Thumbnails/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch3 - Thumbnails/Read Me First.txt b/Ch3 - Thumbnails/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch3 - Thumbnails/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch3 - Thumbnails/Styles.css b/Ch3 - Thumbnails/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch3 - Thumbnails/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch3 - Thumbnails/Web.config b/Ch3 - Thumbnails/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch3 - Thumbnails/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Thumbnails/WebForm1.aspx b/Ch3 - Thumbnails/WebForm1.aspx new file mode 100644 index 0000000..9e4d901 --- /dev/null +++ b/Ch3 - Thumbnails/WebForm1.aspx @@ -0,0 +1,15 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch3___Thumbnails.WebForm1"%> + + + + WebForm1 + + + + + + +
+
+ + diff --git a/Ch3 - Thumbnails/WebForm1.aspx.resx b/Ch3 - Thumbnails/WebForm1.aspx.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Thumbnails/WebForm1.aspx.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Thumbnails/WebForm1.aspx.vb b/Ch3 - Thumbnails/WebForm1.aspx.vb new file mode 100644 index 0000000..4af5e81 --- /dev/null +++ b/Ch3 - Thumbnails/WebForm1.aspx.vb @@ -0,0 +1,59 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + ' EXAMPLE: try visiting + ' http://localhost/Ch3%20-%20Thumbnails/WebForm1.aspx?filename=whitecliff.bmp&width=400 + + ' Initialise objects + Dim objImage, objThumbnail As System.Drawing.Image + Dim strServerPath, strFilename As String + Dim shtWidth, shtHeight As Short + ' Get core path on server - use an empty string if root + strServerPath = Server.MapPath("images\") + ' Retrieve name of file to resize from query string + strFilename = strServerPath & Request.QueryString("filename") + ' Retrieve file, or error.gif if not available + Try + objImage = objImage.FromFile(strFilename) + Catch + objImage = objImage.FromFile(strServerPath & "error.gif") + End Try + ' Retrieve width from query string + If Request.QueryString("width") = Nothing Then + shtWidth = objImage.Width + ElseIf Request.QueryString("width") < 1 Then + shtWidth = 100 + Else + shtWidth = Request.QueryString("width") + End If + ' Work out a proportionate height from width + shtHeight = objImage.Height / (objImage.Width / shtWidth) + ' Create thumbnail + objThumbnail = objImage.GetThumbnailImage(shtWidth, _ + shtHeight, Nothing, System.IntPtr.Zero) + ' Send down to client + Response.ContentType = "image/jpeg" + objThumbnail.Save(Response.OutputStream, Imaging.ImageFormat.Jpeg) + ' Tidy up + objImage.Dispose() + objThumbnail.Dispose() + End Sub + +End Class diff --git a/Ch3 - Thumbnails/_vti_pvt/access.cnf b/Ch3 - Thumbnails/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch3 - Thumbnails/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch3 - Thumbnails/_vti_pvt/deptodoc.btr b/Ch3 - Thumbnails/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..65ea3b9 Binary files /dev/null and b/Ch3 - Thumbnails/_vti_pvt/deptodoc.btr differ diff --git a/Ch3 - Thumbnails/_vti_pvt/doctodep.btr b/Ch3 - Thumbnails/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch3 - Thumbnails/_vti_pvt/doctodep.btr differ diff --git a/Ch3 - Thumbnails/_vti_pvt/service.cnf b/Ch3 - Thumbnails/_vti_pvt/service.cnf new file mode 100644 index 0000000..6039cc6 --- /dev/null +++ b/Ch3 - Thumbnails/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|06 Nov 2002 14:11:35 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch3 - Thumbnails/_vti_pvt/service.lck b/Ch3 - Thumbnails/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch3 - Thumbnails/_vti_pvt/services.cnf b/Ch3 - Thumbnails/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch3 - Thumbnails/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch3 - Thumbnails/bin/Ch3 - Thumbnails.dll b/Ch3 - Thumbnails/bin/Ch3 - Thumbnails.dll new file mode 100644 index 0000000..b6c4edf Binary files /dev/null and b/Ch3 - Thumbnails/bin/Ch3 - Thumbnails.dll differ diff --git a/Ch3 - Thumbnails/bin/Ch3 - Thumbnails.pdb b/Ch3 - Thumbnails/bin/Ch3 - Thumbnails.pdb new file mode 100644 index 0000000..bdd2b17 Binary files /dev/null and b/Ch3 - Thumbnails/bin/Ch3 - Thumbnails.pdb differ diff --git a/Ch3 - Thumbnails/images/Thumbs.db b/Ch3 - Thumbnails/images/Thumbs.db new file mode 100644 index 0000000..0bf0fba Binary files /dev/null and b/Ch3 - Thumbnails/images/Thumbs.db differ diff --git a/Ch3 - Thumbnails/images/error.gif b/Ch3 - Thumbnails/images/error.gif new file mode 100644 index 0000000..913b468 Binary files /dev/null and b/Ch3 - Thumbnails/images/error.gif differ diff --git a/Ch3 - Thumbnails/images/whitecliff.bmp b/Ch3 - Thumbnails/images/whitecliff.bmp new file mode 100644 index 0000000..1fcb1a1 Binary files /dev/null and b/Ch3 - Thumbnails/images/whitecliff.bmp differ diff --git a/Ch3 - Uploading Files/AssemblyInfo.vb b/Ch3 - Uploading Files/AssemblyInfo.vb new file mode 100644 index 0000000..195fea0 --- /dev/null +++ b/Ch3 - Uploading Files/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch3 - Uploading Files/Ch3 - Uploading Files.sln b/Ch3 - Uploading Files/Ch3 - Uploading Files.sln new file mode 100644 index 0000000..2626d4b --- /dev/null +++ b/Ch3 - Uploading Files/Ch3 - Uploading Files.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch3 - Uploading Files", "http://localhost/Ch3 - Uploading Files/Ch3 - Uploading Files.vbproj", "{A4CFF7B6-C355-427F-94C1-A7AEBB288A59}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {A4CFF7B6-C355-427F-94C1-A7AEBB288A59}.Debug.ActiveCfg = Debug|.NET + {A4CFF7B6-C355-427F-94C1-A7AEBB288A59}.Debug.Build.0 = Debug|.NET + {A4CFF7B6-C355-427F-94C1-A7AEBB288A59}.Release.ActiveCfg = Release|.NET + {A4CFF7B6-C355-427F-94C1-A7AEBB288A59}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch3 - Uploading Files/Ch3 - Uploading Files.suo b/Ch3 - Uploading Files/Ch3 - Uploading Files.suo new file mode 100644 index 0000000..e4b141b Binary files /dev/null and b/Ch3 - Uploading Files/Ch3 - Uploading Files.suo differ diff --git a/Ch3 - Uploading Files/Ch3 - Uploading Files.vbproj b/Ch3 - Uploading Files/Ch3 - Uploading Files.vbproj new file mode 100644 index 0000000..123369c --- /dev/null +++ b/Ch3 - Uploading Files/Ch3 - Uploading Files.vbproj @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Uploading Files/Ch3 - Uploading Files.vbproj.webinfo b/Ch3 - Uploading Files/Ch3 - Uploading Files.vbproj.webinfo new file mode 100644 index 0000000..cd7f19e --- /dev/null +++ b/Ch3 - Uploading Files/Ch3 - Uploading Files.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch3 - Uploading Files/Ch3 - Uploading Files.vsdisco b/Ch3 - Uploading Files/Ch3 - Uploading Files.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch3 - Uploading Files/Ch3 - Uploading Files.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch3 - Uploading Files/Global.asax b/Ch3 - Uploading Files/Global.asax new file mode 100644 index 0000000..c6f8a67 --- /dev/null +++ b/Ch3 - Uploading Files/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch3___Uploading_Files.Global" %> \ No newline at end of file diff --git a/Ch3 - Uploading Files/Global.asax.resx b/Ch3 - Uploading Files/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Uploading Files/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Uploading Files/Global.asax.vb b/Ch3 - Uploading Files/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch3 - Uploading Files/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch3 - Uploading Files/Read Me First.txt b/Ch3 - Uploading Files/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch3 - Uploading Files/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch3 - Uploading Files/Styles.css b/Ch3 - Uploading Files/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch3 - Uploading Files/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch3 - Uploading Files/Web.config b/Ch3 - Uploading Files/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch3 - Uploading Files/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Uploading Files/WebForm1.aspx b/Ch3 - Uploading Files/WebForm1.aspx new file mode 100644 index 0000000..bdb7c8e --- /dev/null +++ b/Ch3 - Uploading Files/WebForm1.aspx @@ -0,0 +1,17 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch3___Uploading_Files.WebForm1"%> + + + + The Secrets to Uploading Files with Ease + + + + + + +
+ + File Upload DemonstrationSelect an Access database to upload to the server. +
+ + diff --git a/Ch3 - Uploading Files/WebForm1.aspx.resx b/Ch3 - Uploading Files/WebForm1.aspx.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Uploading Files/WebForm1.aspx.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Uploading Files/WebForm1.aspx.vb b/Ch3 - Uploading Files/WebForm1.aspx.vb new file mode 100644 index 0000000..3f5893b --- /dev/null +++ b/Ch3 - Uploading Files/WebForm1.aspx.vb @@ -0,0 +1,47 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents fileUpload As System.Web.UI.HtmlControls.HtmlInputFile + Protected WithEvents Button1 As System.Web.UI.WebControls.Button + Protected WithEvents Label2 As System.Web.UI.WebControls.Label + Protected WithEvents lblError As System.Web.UI.WebControls.Label + Protected WithEvents Label1 As System.Web.UI.WebControls.Label + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + 'Put user code to initialize the page here + End Sub + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + If FileFieldSelected(fileUpload) Then + fileUpload.PostedFile.SaveAs(Server.MapPath("uploaded.mdb")) + lblError.Text = "
File uploaded!
" + Else + lblError.Text = "
No file selected.
" + End If + End Sub + + Public Function FileFieldSelected(ByVal FileField As _ + System.Web.UI.HtmlControls.HtmlInputFile) As Boolean + ' Returns a True if the passed + ' FileField has had a user post a file + Dim intFileLength As Integer + If FileField.PostedFile Is Nothing Then Return False + If FileField.PostedFile.ContentLength = 0 Then Return False + Return True + End Function + +End Class diff --git a/Ch3 - Uploading Files/_vti_pvt/access.cnf b/Ch3 - Uploading Files/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch3 - Uploading Files/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch3 - Uploading Files/_vti_pvt/deptodoc.btr b/Ch3 - Uploading Files/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..3fcc9eb Binary files /dev/null and b/Ch3 - Uploading Files/_vti_pvt/deptodoc.btr differ diff --git a/Ch3 - Uploading Files/_vti_pvt/doctodep.btr b/Ch3 - Uploading Files/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch3 - Uploading Files/_vti_pvt/doctodep.btr differ diff --git a/Ch3 - Uploading Files/_vti_pvt/service.cnf b/Ch3 - Uploading Files/_vti_pvt/service.cnf new file mode 100644 index 0000000..07b2b44 --- /dev/null +++ b/Ch3 - Uploading Files/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|06 Nov 2002 12:40:06 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch3 - Uploading Files/_vti_pvt/service.lck b/Ch3 - Uploading Files/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch3 - Uploading Files/_vti_pvt/services.cnf b/Ch3 - Uploading Files/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch3 - Uploading Files/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch3 - Uploading Files/bin/Ch3 - Uploading Files.dll b/Ch3 - Uploading Files/bin/Ch3 - Uploading Files.dll new file mode 100644 index 0000000..f424449 Binary files /dev/null and b/Ch3 - Uploading Files/bin/Ch3 - Uploading Files.dll differ diff --git a/Ch3 - Uploading Files/bin/Ch3 - Uploading Files.pdb b/Ch3 - Uploading Files/bin/Ch3 - Uploading Files.pdb new file mode 100644 index 0000000..6c552bf Binary files /dev/null and b/Ch3 - Uploading Files/bin/Ch3 - Uploading Files.pdb differ diff --git a/Ch3 - Warning 1/AssemblyInfo.vb b/Ch3 - Warning 1/AssemblyInfo.vb new file mode 100644 index 0000000..3b2425b --- /dev/null +++ b/Ch3 - Warning 1/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch3 - Warning 1/Ch3 - Warning 1.sln b/Ch3 - Warning 1/Ch3 - Warning 1.sln new file mode 100644 index 0000000..81e3c43 --- /dev/null +++ b/Ch3 - Warning 1/Ch3 - Warning 1.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch3 - Warning 1", "http://localhost/Ch3 - Warning 1/Ch3 - Warning 1.vbproj", "{FC284AED-E92A-435A-AE37-6E156F1C7261}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {FC284AED-E92A-435A-AE37-6E156F1C7261}.Debug.ActiveCfg = Debug|.NET + {FC284AED-E92A-435A-AE37-6E156F1C7261}.Debug.Build.0 = Debug|.NET + {FC284AED-E92A-435A-AE37-6E156F1C7261}.Release.ActiveCfg = Release|.NET + {FC284AED-E92A-435A-AE37-6E156F1C7261}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch3 - Warning 1/Ch3 - Warning 1.suo b/Ch3 - Warning 1/Ch3 - Warning 1.suo new file mode 100644 index 0000000..0e5fda3 Binary files /dev/null and b/Ch3 - Warning 1/Ch3 - Warning 1.suo differ diff --git a/Ch3 - Warning 1/Ch3 - Warning 1.vbproj b/Ch3 - Warning 1/Ch3 - Warning 1.vbproj new file mode 100644 index 0000000..783a522 --- /dev/null +++ b/Ch3 - Warning 1/Ch3 - Warning 1.vbproj @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Warning 1/Ch3 - Warning 1.vbproj.webinfo b/Ch3 - Warning 1/Ch3 - Warning 1.vbproj.webinfo new file mode 100644 index 0000000..2b426a4 --- /dev/null +++ b/Ch3 - Warning 1/Ch3 - Warning 1.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch3 - Warning 1/Ch3 - Warning 1.vsdisco b/Ch3 - Warning 1/Ch3 - Warning 1.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch3 - Warning 1/Ch3 - Warning 1.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch3 - Warning 1/Global.asax b/Ch3 - Warning 1/Global.asax new file mode 100644 index 0000000..7ff8d78 --- /dev/null +++ b/Ch3 - Warning 1/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch3___Warning_1.Global" %> \ No newline at end of file diff --git a/Ch3 - Warning 1/Global.asax.resx b/Ch3 - Warning 1/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Warning 1/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Warning 1/Global.asax.vb b/Ch3 - Warning 1/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch3 - Warning 1/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch3 - Warning 1/Read Me First.txt b/Ch3 - Warning 1/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch3 - Warning 1/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch3 - Warning 1/Styles.css b/Ch3 - Warning 1/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch3 - Warning 1/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch3 - Warning 1/Web.config b/Ch3 - Warning 1/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch3 - Warning 1/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Warning 1/WebForm1.aspx b/Ch3 - Warning 1/WebForm1.aspx new file mode 100644 index 0000000..401ebc5 --- /dev/null +++ b/Ch3 - Warning 1/WebForm1.aspx @@ -0,0 +1,20 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch3___Warning_1.WebForm1"%> + + + + Displaying Web Warning Messages: Technique 1 + + + + + + +
+ +
+ + + diff --git a/Ch3 - Warning 1/WebForm1.aspx.resx b/Ch3 - Warning 1/WebForm1.aspx.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Warning 1/WebForm1.aspx.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Warning 1/WebForm1.aspx.vb b/Ch3 - Warning 1/WebForm1.aspx.vb new file mode 100644 index 0000000..9396b9f --- /dev/null +++ b/Ch3 - Warning 1/WebForm1.aspx.vb @@ -0,0 +1,35 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents Button1 As System.Web.UI.WebControls.Button + Protected WithEvents ltlAlert As System.Web.UI.WebControls.Literal + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Say(ByVal Message As String) + ' Format string properly + Message = Message.Replace("'", "\'") + Message = Message.Replace(Convert.ToChar(10), "\n") + Message = Message.Replace(Convert.ToChar(13), "") + ' Display as JavaScript alert + ltlAlert.Text = "alert('" & Message & "')" + End Sub + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + Say("Sorry, your password is invalid! " & _ + Microsoft.VisualBasic.vbNewLine & _ + "Please try again, or click the Signup button to register now.") + End Sub +End Class diff --git a/Ch3 - Warning 1/_vti_pvt/access.cnf b/Ch3 - Warning 1/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch3 - Warning 1/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch3 - Warning 1/_vti_pvt/deptodoc.btr b/Ch3 - Warning 1/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..4762cd9 Binary files /dev/null and b/Ch3 - Warning 1/_vti_pvt/deptodoc.btr differ diff --git a/Ch3 - Warning 1/_vti_pvt/doctodep.btr b/Ch3 - Warning 1/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch3 - Warning 1/_vti_pvt/doctodep.btr differ diff --git a/Ch3 - Warning 1/_vti_pvt/service.cnf b/Ch3 - Warning 1/_vti_pvt/service.cnf new file mode 100644 index 0000000..ab6e11d --- /dev/null +++ b/Ch3 - Warning 1/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|05 Nov 2002 17:14:54 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch3 - Warning 1/_vti_pvt/service.lck b/Ch3 - Warning 1/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch3 - Warning 1/_vti_pvt/services.cnf b/Ch3 - Warning 1/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch3 - Warning 1/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch3 - Warning 1/bin/Ch3 - Warning 1.dll b/Ch3 - Warning 1/bin/Ch3 - Warning 1.dll new file mode 100644 index 0000000..5cf3b55 Binary files /dev/null and b/Ch3 - Warning 1/bin/Ch3 - Warning 1.dll differ diff --git a/Ch3 - Warning 1/bin/Ch3 - Warning 1.pdb b/Ch3 - Warning 1/bin/Ch3 - Warning 1.pdb new file mode 100644 index 0000000..1f76e10 Binary files /dev/null and b/Ch3 - Warning 1/bin/Ch3 - Warning 1.pdb differ diff --git a/Ch3 - Warning 2/AssemblyInfo.vb b/Ch3 - Warning 2/AssemblyInfo.vb new file mode 100644 index 0000000..0a99d65 --- /dev/null +++ b/Ch3 - Warning 2/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch3 - Warning 2/Ch3 - Warning 2.sln b/Ch3 - Warning 2/Ch3 - Warning 2.sln new file mode 100644 index 0000000..48d6acd --- /dev/null +++ b/Ch3 - Warning 2/Ch3 - Warning 2.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch3 - Warning 2", "http://localhost/Ch3 - Warning 2/Ch3 - Warning 2.vbproj", "{A1020C0E-8B04-4DCF-83C9-9F52337E1AFC}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {A1020C0E-8B04-4DCF-83C9-9F52337E1AFC}.Debug.ActiveCfg = Debug|.NET + {A1020C0E-8B04-4DCF-83C9-9F52337E1AFC}.Debug.Build.0 = Debug|.NET + {A1020C0E-8B04-4DCF-83C9-9F52337E1AFC}.Release.ActiveCfg = Release|.NET + {A1020C0E-8B04-4DCF-83C9-9F52337E1AFC}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch3 - Warning 2/Ch3 - Warning 2.suo b/Ch3 - Warning 2/Ch3 - Warning 2.suo new file mode 100644 index 0000000..7ae4ff1 Binary files /dev/null and b/Ch3 - Warning 2/Ch3 - Warning 2.suo differ diff --git a/Ch3 - Warning 2/Ch3 - Warning 2.vbproj b/Ch3 - Warning 2/Ch3 - Warning 2.vbproj new file mode 100644 index 0000000..3179f35 --- /dev/null +++ b/Ch3 - Warning 2/Ch3 - Warning 2.vbproj @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Warning 2/Ch3 - Warning 2.vbproj.webinfo b/Ch3 - Warning 2/Ch3 - Warning 2.vbproj.webinfo new file mode 100644 index 0000000..89f3f03 --- /dev/null +++ b/Ch3 - Warning 2/Ch3 - Warning 2.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch3 - Warning 2/Ch3 - Warning 2.vsdisco b/Ch3 - Warning 2/Ch3 - Warning 2.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch3 - Warning 2/Ch3 - Warning 2.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch3 - Warning 2/Global.asax b/Ch3 - Warning 2/Global.asax new file mode 100644 index 0000000..6047d51 --- /dev/null +++ b/Ch3 - Warning 2/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch3___Warning_2.Global" %> \ No newline at end of file diff --git a/Ch3 - Warning 2/Global.asax.resx b/Ch3 - Warning 2/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Warning 2/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Warning 2/Global.asax.vb b/Ch3 - Warning 2/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch3 - Warning 2/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch3 - Warning 2/Read Me First.txt b/Ch3 - Warning 2/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch3 - Warning 2/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch3 - Warning 2/Styles.css b/Ch3 - Warning 2/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch3 - Warning 2/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch3 - Warning 2/Web.config b/Ch3 - Warning 2/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch3 - Warning 2/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Warning 2/WebForm1.aspx b/Ch3 - Warning 2/WebForm1.aspx new file mode 100644 index 0000000..6196193 --- /dev/null +++ b/Ch3 - Warning 2/WebForm1.aspx @@ -0,0 +1,16 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch3___Warning_2.WebForm1"%> + + + + WebForm1 + + + + + + +
+ +
+ + diff --git a/Ch3 - Warning 2/WebForm1.aspx.resx b/Ch3 - Warning 2/WebForm1.aspx.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Warning 2/WebForm1.aspx.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Warning 2/WebForm1.aspx.vb b/Ch3 - Warning 2/WebForm1.aspx.vb new file mode 100644 index 0000000..e9c046c --- /dev/null +++ b/Ch3 - Warning 2/WebForm1.aspx.vb @@ -0,0 +1,52 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents Button1 As System.Web.UI.WebControls.Button + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Public Sub DisplayMessage(ByVal MessageTitle As String, _ + ByVal MessageDetails As String, _ + Optional ByVal PageTitle As String = "Attention!", _ + Optional ByVal DelayInSeconds As Integer = 2) + ' Core HTML, with refresh + Dim strResponse As String = "" & _ + "%page-title%" & _ + "
" & _ + "
" & _ + "

" & _ + "%message-title%

" & _ + "%message-details%" & _ + "

" + ' Replace defaults + strResponse = strResponse.Replace("%page-title%", PageTitle) + strResponse = strResponse.Replace("%message-title%", MessageTitle) + strResponse = strResponse.Replace("%message-details%", _ + MessageDetails) + strResponse = strResponse.Replace("%delay%", _ + DelayInSeconds.ToString) + ' Display response + Response.Clear() + Response.Write(strResponse) + Response.End() + End Sub + + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + DisplayMessage("Sorry!", "That username already exists. Please choose another.", "White Cliff - Error", 2) + End Sub +End Class diff --git a/Ch3 - Warning 2/_vti_pvt/access.cnf b/Ch3 - Warning 2/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch3 - Warning 2/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch3 - Warning 2/_vti_pvt/deptodoc.btr b/Ch3 - Warning 2/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..10a761c Binary files /dev/null and b/Ch3 - Warning 2/_vti_pvt/deptodoc.btr differ diff --git a/Ch3 - Warning 2/_vti_pvt/doctodep.btr b/Ch3 - Warning 2/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch3 - Warning 2/_vti_pvt/doctodep.btr differ diff --git a/Ch3 - Warning 2/_vti_pvt/service.cnf b/Ch3 - Warning 2/_vti_pvt/service.cnf new file mode 100644 index 0000000..437a554 --- /dev/null +++ b/Ch3 - Warning 2/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|05 Nov 2002 17:18:22 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch3 - Warning 2/_vti_pvt/service.lck b/Ch3 - Warning 2/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch3 - Warning 2/_vti_pvt/services.cnf b/Ch3 - Warning 2/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch3 - Warning 2/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch3 - Warning 2/bin/Ch3 - Warning 2.dll b/Ch3 - Warning 2/bin/Ch3 - Warning 2.dll new file mode 100644 index 0000000..561a0bc Binary files /dev/null and b/Ch3 - Warning 2/bin/Ch3 - Warning 2.dll differ diff --git a/Ch3 - Warning 2/bin/Ch3 - Warning 2.pdb b/Ch3 - Warning 2/bin/Ch3 - Warning 2.pdb new file mode 100644 index 0000000..899d3c5 Binary files /dev/null and b/Ch3 - Warning 2/bin/Ch3 - Warning 2.pdb differ diff --git a/Ch3 - Working with Images/AssemblyInfo.vb b/Ch3 - Working with Images/AssemblyInfo.vb new file mode 100644 index 0000000..440894d --- /dev/null +++ b/Ch3 - Working with Images/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch3 - Working with Images/Ch3 - Working with Images.vbproj b/Ch3 - Working with Images/Ch3 - Working with Images.vbproj new file mode 100644 index 0000000..f2840d2 --- /dev/null +++ b/Ch3 - Working with Images/Ch3 - Working with Images.vbproj @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Working with Images/Ch3 - Working with Images.vbproj.webinfo b/Ch3 - Working with Images/Ch3 - Working with Images.vbproj.webinfo new file mode 100644 index 0000000..6e44dc4 --- /dev/null +++ b/Ch3 - Working with Images/Ch3 - Working with Images.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch3 - Working with Images/Ch3 - Working with Images.vsdisco b/Ch3 - Working with Images/Ch3 - Working with Images.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch3 - Working with Images/Ch3 - Working with Images.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch3 - Working with Images/Global.asax b/Ch3 - Working with Images/Global.asax new file mode 100644 index 0000000..5afca17 --- /dev/null +++ b/Ch3 - Working with Images/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch3___Working_with_Images.Global" %> \ No newline at end of file diff --git a/Ch3 - Working with Images/Global.asax.resx b/Ch3 - Working with Images/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Working with Images/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Working with Images/Global.asax.vb b/Ch3 - Working with Images/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch3 - Working with Images/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch3 - Working with Images/Read Me First.txt b/Ch3 - Working with Images/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch3 - Working with Images/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch3 - Working with Images/Styles.css b/Ch3 - Working with Images/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch3 - Working with Images/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch3 - Working with Images/Web.config b/Ch3 - Working with Images/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch3 - Working with Images/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch3 - Working with Images/WebForm1.aspx b/Ch3 - Working with Images/WebForm1.aspx new file mode 100644 index 0000000..1bc5cba --- /dev/null +++ b/Ch3 - Working with Images/WebForm1.aspx @@ -0,0 +1,17 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch3___Working_with_Images.WebForm1"%> + + + + Working with Uploaded Images + + + + + + +
+ + +
+ + diff --git a/Ch3 - Working with Images/WebForm1.aspx.resx b/Ch3 - Working with Images/WebForm1.aspx.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch3 - Working with Images/WebForm1.aspx.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch3 - Working with Images/WebForm1.aspx.vb b/Ch3 - Working with Images/WebForm1.aspx.vb new file mode 100644 index 0000000..5005e47 --- /dev/null +++ b/Ch3 - Working with Images/WebForm1.aspx.vb @@ -0,0 +1,65 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents MyFileField As System.Web.UI.HtmlControls.HtmlInputFile + Protected WithEvents Button1 As System.Web.UI.WebControls.Button + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + 'Put user code to initialize the page here + End Sub + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + ' Get data into image format + Dim objStream As System.IO.Stream = _ + MyFileField.PostedFile.InputStream + Dim objImage As System.Drawing.Image + Try + ' Get the image stream + objImage = System.Drawing.Image.FromStream(objStream) + Catch + ' This is not an image, exit the method (presuming code is in one!) + Exit Sub + End Try + ' Filename + Dim strOriginalFilename As String = MyFileField.PostedFile.FileName + ' Type of image + Dim strImageType + If objImage.RawFormat.Equals(objImage.RawFormat.Gif) Then + strImageType = "This is a GIF image" + ElseIf objImage.RawFormat.Equals(objImage.RawFormat.Bmp) Then + strImageType = "This is a Bitmap image" + ElseIf objImage.RawFormat.Equals(objImage.RawFormat.Jpeg) Then + strImageType = "This is a JPEG image" + ElseIf objImage.RawFormat.Equals(objImage.RawFormat.Icon) Then + strImageType = "This is an icon file" + ElseIf objImage.RawFormat.Equals(objImage.RawFormat.Tiff) Then + strImageType = "This is a TIFF file" + Else + strImageType = "Other" + End If + ' Dimensions + Dim strDimensions As String + strDimensions = "Width in pixels: " & objImage.Width & _ + ", Height in pixels: " & objImage.Height + ' Send raw output to browser + Response.Clear() + Response.Write(strOriginalFilename & "

" & strImageType & _ + "

" & strDimensions) + Response.End() + + End Sub +End Class diff --git a/Ch3 - Working with Images/_vti_pvt/access.cnf b/Ch3 - Working with Images/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch3 - Working with Images/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch3 - Working with Images/_vti_pvt/deptodoc.btr b/Ch3 - Working with Images/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..1ec6888 Binary files /dev/null and b/Ch3 - Working with Images/_vti_pvt/deptodoc.btr differ diff --git a/Ch3 - Working with Images/_vti_pvt/doctodep.btr b/Ch3 - Working with Images/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..10a761c Binary files /dev/null and b/Ch3 - Working with Images/_vti_pvt/doctodep.btr differ diff --git a/Ch3 - Working with Images/_vti_pvt/service.cnf b/Ch3 - Working with Images/_vti_pvt/service.cnf new file mode 100644 index 0000000..5c704c8 --- /dev/null +++ b/Ch3 - Working with Images/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|06 Nov 2002 14:00:59 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch3 - Working with Images/_vti_pvt/service.lck b/Ch3 - Working with Images/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch3 - Working with Images/_vti_pvt/services.cnf b/Ch3 - Working with Images/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch3 - Working with Images/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch3 - Working with Images/bin/Ch3 - Working with Images.dll b/Ch3 - Working with Images/bin/Ch3 - Working with Images.dll new file mode 100644 index 0000000..03a5094 Binary files /dev/null and b/Ch3 - Working with Images/bin/Ch3 - Working with Images.dll differ diff --git a/Ch3 - Working with Images/bin/Ch3 - Working with Images.pdb b/Ch3 - Working with Images/bin/Ch3 - Working with Images.pdb new file mode 100644 index 0000000..1d28092 Binary files /dev/null and b/Ch3 - Working with Images/bin/Ch3 - Working with Images.pdb differ diff --git a/Ch4 - Click Anywhere/AssemblyInfo.vb b/Ch4 - Click Anywhere/AssemblyInfo.vb new file mode 100644 index 0000000..e963430 --- /dev/null +++ b/Ch4 - Click Anywhere/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch4 - Click Anywhere/Ch4 - Click Anywhere.sln b/Ch4 - Click Anywhere/Ch4 - Click Anywhere.sln new file mode 100644 index 0000000..6ab0d19 --- /dev/null +++ b/Ch4 - Click Anywhere/Ch4 - Click Anywhere.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch4 - Click Anywhere", "http://localhost/Ch4 - Click Anywhere/Ch4 - Click Anywhere.vbproj", "{598A3D60-7308-4F52-8E45-3B29FF2BA43D}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {598A3D60-7308-4F52-8E45-3B29FF2BA43D}.Debug.ActiveCfg = Debug|.NET + {598A3D60-7308-4F52-8E45-3B29FF2BA43D}.Debug.Build.0 = Debug|.NET + {598A3D60-7308-4F52-8E45-3B29FF2BA43D}.Release.ActiveCfg = Release|.NET + {598A3D60-7308-4F52-8E45-3B29FF2BA43D}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch4 - Click Anywhere/Ch4 - Click Anywhere.suo b/Ch4 - Click Anywhere/Ch4 - Click Anywhere.suo new file mode 100644 index 0000000..0499e82 Binary files /dev/null and b/Ch4 - Click Anywhere/Ch4 - Click Anywhere.suo differ diff --git a/Ch4 - Click Anywhere/Ch4 - Click Anywhere.vbproj b/Ch4 - Click Anywhere/Ch4 - Click Anywhere.vbproj new file mode 100644 index 0000000..1c90b75 --- /dev/null +++ b/Ch4 - Click Anywhere/Ch4 - Click Anywhere.vbproj @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Click Anywhere/Ch4 - Click Anywhere.vbproj.webinfo b/Ch4 - Click Anywhere/Ch4 - Click Anywhere.vbproj.webinfo new file mode 100644 index 0000000..2a50907 --- /dev/null +++ b/Ch4 - Click Anywhere/Ch4 - Click Anywhere.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch4 - Click Anywhere/Ch4 - Click Anywhere.vsdisco b/Ch4 - Click Anywhere/Ch4 - Click Anywhere.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch4 - Click Anywhere/Ch4 - Click Anywhere.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch4 - Click Anywhere/DataSet1.vb b/Ch4 - Click Anywhere/DataSet1.vb new file mode 100644 index 0000000..ae2c350 --- /dev/null +++ b/Ch4 - Click Anywhere/DataSet1.vb @@ -0,0 +1,455 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version: 1.0.3705.288 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict Off +Option Explicit On + +Imports System +Imports System.Data +Imports System.Runtime.Serialization +Imports System.Xml + + + _ +Public Class DataSet1 + Inherits DataSet + + Private tablepublishers As publishersDataTable + + Public Sub New() + MyBase.New + Me.InitClass + Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged + AddHandler Me.Tables.CollectionChanged, schemaChangedHandler + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler + End Sub + + Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext) + MyBase.New + Dim strSchema As String = CType(info.GetValue("XmlSchema", GetType(System.String)),String) + If (Not (strSchema) Is Nothing) Then + Dim ds As DataSet = New DataSet + ds.ReadXmlSchema(New XmlTextReader(New System.IO.StringReader(strSchema))) + If (Not (ds.Tables("publishers")) Is Nothing) Then + Me.Tables.Add(New publishersDataTable(ds.Tables("publishers"))) + End If + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.Namespace = ds.Namespace + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) + Me.InitVars + Else + Me.InitClass + End If + Me.GetSerializationData(info, context) + Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged + AddHandler Me.Tables.CollectionChanged, schemaChangedHandler + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler + End Sub + + _ + Public ReadOnly Property publishers As publishersDataTable + Get + Return Me.tablepublishers + End Get + End Property + + Public Overrides Function Clone() As DataSet + Dim cln As DataSet1 = CType(MyBase.Clone,DataSet1) + cln.InitVars + Return cln + End Function + + Protected Overrides Function ShouldSerializeTables() As Boolean + Return false + End Function + + Protected Overrides Function ShouldSerializeRelations() As Boolean + Return false + End Function + + Protected Overrides Sub ReadXmlSerializable(ByVal reader As XmlReader) + Me.Reset + Dim ds As DataSet = New DataSet + ds.ReadXml(reader) + If (Not (ds.Tables("publishers")) Is Nothing) Then + Me.Tables.Add(New publishersDataTable(ds.Tables("publishers"))) + End If + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.Namespace = ds.Namespace + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) + Me.InitVars + End Sub + + Protected Overrides Function GetSchemaSerializable() As System.Xml.Schema.XmlSchema + Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream + Me.WriteXmlSchema(New XmlTextWriter(stream, Nothing)) + stream.Position = 0 + Return System.Xml.Schema.XmlSchema.Read(New XmlTextReader(stream), Nothing) + End Function + + Friend Sub InitVars() + Me.tablepublishers = CType(Me.Tables("publishers"),publishersDataTable) + If (Not (Me.tablepublishers) Is Nothing) Then + Me.tablepublishers.InitVars + End If + End Sub + + Private Sub InitClass() + Me.DataSetName = "DataSet1" + Me.Prefix = "" + Me.Namespace = "http://www.tempuri.org/DataSet1.xsd" + Me.Locale = New System.Globalization.CultureInfo("en-GB") + Me.CaseSensitive = false + Me.EnforceConstraints = true + Me.tablepublishers = New publishersDataTable + Me.Tables.Add(Me.tablepublishers) + End Sub + + Private Function ShouldSerializepublishers() As Boolean + Return false + End Function + + Private Sub SchemaChanged(ByVal sender As Object, ByVal e As System.ComponentModel.CollectionChangeEventArgs) + If (e.Action = System.ComponentModel.CollectionChangeAction.Remove) Then + Me.InitVars + End If + End Sub + + Public Delegate Sub publishersRowChangeEventHandler(ByVal sender As Object, ByVal e As publishersRowChangeEvent) + + _ + Public Class publishersDataTable + Inherits DataTable + Implements System.Collections.IEnumerable + + Private columnpub_id As DataColumn + + Private columnpub_name As DataColumn + + Private columncity As DataColumn + + Private columnstate As DataColumn + + Private columncountry As DataColumn + + Friend Sub New() + MyBase.New("publishers") + Me.InitClass + End Sub + + Friend Sub New(ByVal table As DataTable) + MyBase.New(table.TableName) + If (table.CaseSensitive <> table.DataSet.CaseSensitive) Then + Me.CaseSensitive = table.CaseSensitive + End If + If (table.Locale.ToString <> table.DataSet.Locale.ToString) Then + Me.Locale = table.Locale + End If + If (table.Namespace <> table.DataSet.Namespace) Then + Me.Namespace = table.Namespace + End If + Me.Prefix = table.Prefix + Me.MinimumCapacity = table.MinimumCapacity + Me.DisplayExpression = table.DisplayExpression + End Sub + + _ + Public ReadOnly Property Count As Integer + Get + Return Me.Rows.Count + End Get + End Property + + Friend ReadOnly Property pub_idColumn As DataColumn + Get + Return Me.columnpub_id + End Get + End Property + + Friend ReadOnly Property pub_nameColumn As DataColumn + Get + Return Me.columnpub_name + End Get + End Property + + Friend ReadOnly Property cityColumn As DataColumn + Get + Return Me.columncity + End Get + End Property + + Friend ReadOnly Property stateColumn As DataColumn + Get + Return Me.columnstate + End Get + End Property + + Friend ReadOnly Property countryColumn As DataColumn + Get + Return Me.columncountry + End Get + End Property + + Public Default ReadOnly Property Item(ByVal index As Integer) As publishersRow + Get + Return CType(Me.Rows(index),publishersRow) + End Get + End Property + + Public Event publishersRowChanged As publishersRowChangeEventHandler + + Public Event publishersRowChanging As publishersRowChangeEventHandler + + Public Event publishersRowDeleted As publishersRowChangeEventHandler + + Public Event publishersRowDeleting As publishersRowChangeEventHandler + + Public Overloads Sub AddpublishersRow(ByVal row As publishersRow) + Me.Rows.Add(row) + End Sub + + Public Overloads Function AddpublishersRow(ByVal pub_id As String, ByVal pub_name As String, ByVal city As String, ByVal state As String, ByVal country As String) As publishersRow + Dim rowpublishersRow As publishersRow = CType(Me.NewRow,publishersRow) + rowpublishersRow.ItemArray = New Object() {pub_id, pub_name, city, state, country} + Me.Rows.Add(rowpublishersRow) + Return rowpublishersRow + End Function + + Public Function FindBypub_id(ByVal pub_id As String) As publishersRow + Return CType(Me.Rows.Find(New Object() {pub_id}),publishersRow) + End Function + + Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator + Return Me.Rows.GetEnumerator + End Function + + Public Overrides Function Clone() As DataTable + Dim cln As publishersDataTable = CType(MyBase.Clone,publishersDataTable) + cln.InitVars + Return cln + End Function + + Protected Overrides Function CreateInstance() As DataTable + Return New publishersDataTable + End Function + + Friend Sub InitVars() + Me.columnpub_id = Me.Columns("pub_id") + Me.columnpub_name = Me.Columns("pub_name") + Me.columncity = Me.Columns("city") + Me.columnstate = Me.Columns("state") + Me.columncountry = Me.Columns("country") + End Sub + + Private Sub InitClass() + Me.columnpub_id = New DataColumn("pub_id", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnpub_id) + Me.columnpub_name = New DataColumn("pub_name", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnpub_name) + Me.columncity = New DataColumn("city", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columncity) + Me.columnstate = New DataColumn("state", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnstate) + Me.columncountry = New DataColumn("country", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columncountry) + Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnpub_id}, true)) + Me.columnpub_id.AllowDBNull = false + Me.columnpub_id.Unique = true + End Sub + + Public Function NewpublishersRow() As publishersRow + Return CType(Me.NewRow,publishersRow) + End Function + + Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow + Return New publishersRow(builder) + End Function + + Protected Overrides Function GetRowType() As System.Type + Return GetType(publishersRow) + End Function + + Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanged(e) + If (Not (Me.publishersRowChangedEvent) Is Nothing) Then + RaiseEvent publishersRowChanged(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanging(e) + If (Not (Me.publishersRowChangingEvent) Is Nothing) Then + RaiseEvent publishersRowChanging(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleted(e) + If (Not (Me.publishersRowDeletedEvent) Is Nothing) Then + RaiseEvent publishersRowDeleted(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleting(e) + If (Not (Me.publishersRowDeletingEvent) Is Nothing) Then + RaiseEvent publishersRowDeleting(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Public Sub RemovepublishersRow(ByVal row As publishersRow) + Me.Rows.Remove(row) + End Sub + End Class + + _ + Public Class publishersRow + Inherits DataRow + + Private tablepublishers As publishersDataTable + + Friend Sub New(ByVal rb As DataRowBuilder) + MyBase.New(rb) + Me.tablepublishers = CType(Me.Table,publishersDataTable) + End Sub + + Public Property pub_id As String + Get + Return CType(Me(Me.tablepublishers.pub_idColumn),String) + End Get + Set + Me(Me.tablepublishers.pub_idColumn) = value + End Set + End Property + + Public Property pub_name As String + Get + Try + Return CType(Me(Me.tablepublishers.pub_nameColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.pub_nameColumn) = value + End Set + End Property + + Public Property city As String + Get + Try + Return CType(Me(Me.tablepublishers.cityColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.cityColumn) = value + End Set + End Property + + Public Property state As String + Get + Try + Return CType(Me(Me.tablepublishers.stateColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.stateColumn) = value + End Set + End Property + + Public Property country As String + Get + Try + Return CType(Me(Me.tablepublishers.countryColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.countryColumn) = value + End Set + End Property + + Public Function Ispub_nameNull() As Boolean + Return Me.IsNull(Me.tablepublishers.pub_nameColumn) + End Function + + Public Sub Setpub_nameNull() + Me(Me.tablepublishers.pub_nameColumn) = System.Convert.DBNull + End Sub + + Public Function IscityNull() As Boolean + Return Me.IsNull(Me.tablepublishers.cityColumn) + End Function + + Public Sub SetcityNull() + Me(Me.tablepublishers.cityColumn) = System.Convert.DBNull + End Sub + + Public Function IsstateNull() As Boolean + Return Me.IsNull(Me.tablepublishers.stateColumn) + End Function + + Public Sub SetstateNull() + Me(Me.tablepublishers.stateColumn) = System.Convert.DBNull + End Sub + + Public Function IscountryNull() As Boolean + Return Me.IsNull(Me.tablepublishers.countryColumn) + End Function + + Public Sub SetcountryNull() + Me(Me.tablepublishers.countryColumn) = System.Convert.DBNull + End Sub + End Class + + _ + Public Class publishersRowChangeEvent + Inherits EventArgs + + Private eventRow As publishersRow + + Private eventAction As DataRowAction + + Public Sub New(ByVal row As publishersRow, ByVal action As DataRowAction) + MyBase.New + Me.eventRow = row + Me.eventAction = action + End Sub + + Public ReadOnly Property Row As publishersRow + Get + Return Me.eventRow + End Get + End Property + + Public ReadOnly Property Action As DataRowAction + Get + Return Me.eventAction + End Get + End Property + End Class +End Class diff --git a/Ch4 - Click Anywhere/DataSet1.xsd b/Ch4 - Click Anywhere/DataSet1.xsd new file mode 100644 index 0000000..651872e --- /dev/null +++ b/Ch4 - Click Anywhere/DataSet1.xsd @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ch4 - Click Anywhere/Global.asax b/Ch4 - Click Anywhere/Global.asax new file mode 100644 index 0000000..d9e7e64 --- /dev/null +++ b/Ch4 - Click Anywhere/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch4___Click_Anywhere.Global" %> \ No newline at end of file diff --git a/Ch4 - Click Anywhere/Global.asax.resx b/Ch4 - Click Anywhere/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch4 - Click Anywhere/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch4 - Click Anywhere/Global.asax.vb b/Ch4 - Click Anywhere/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch4 - Click Anywhere/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch4 - Click Anywhere/Read Me First.txt b/Ch4 - Click Anywhere/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch4 - Click Anywhere/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch4 - Click Anywhere/Styles.css b/Ch4 - Click Anywhere/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch4 - Click Anywhere/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch4 - Click Anywhere/Web.config b/Ch4 - Click Anywhere/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch4 - Click Anywhere/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Click Anywhere/WebForm1.aspx b/Ch4 - Click Anywhere/WebForm1.aspx new file mode 100644 index 0000000..5f6a6eb --- /dev/null +++ b/Ch4 - Click Anywhere/WebForm1.aspx @@ -0,0 +1,26 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch4___Click_Anywhere.WebForm1"%> + + + + WebForm1 + + + + + + +

+ + + + + + + + + + + +
+ + diff --git a/Ch4 - Click Anywhere/WebForm1.aspx.resx b/Ch4 - Click Anywhere/WebForm1.aspx.resx new file mode 100644 index 0000000..2ada03c --- /dev/null +++ b/Ch4 - Click Anywhere/WebForm1.aspx.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + 17, 17 + + + False + + + 152, 17 + + + False + + + 17, 17 + + + False + + + False + + + 17, 17 + + + False + + + False + + + 17, 17 + + + False + + + 17, 17 + + + 280, 17 + + \ No newline at end of file diff --git a/Ch4 - Click Anywhere/WebForm1.aspx.vb b/Ch4 - Click Anywhere/WebForm1.aspx.vb new file mode 100644 index 0000000..7232b8d --- /dev/null +++ b/Ch4 - Click Anywhere/WebForm1.aspx.vb @@ -0,0 +1,130 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlUpdateCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlDeleteCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection + Protected WithEvents SqlDataAdapter1 As System.Data.SqlClient.SqlDataAdapter + Protected WithEvents DataSet11 As Ch4___Click_Anywhere.DataSet1 + Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox + Protected WithEvents MyDataGrid As System.Web.UI.WebControls.DataGrid + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection() + Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter() + Me.DataSet11 = New Ch4___Click_Anywhere.DataSet1() + CType(Me.DataSet11, System.ComponentModel.ISupportInitialize).BeginInit() + ' + 'SqlSelectCommand1 + ' + Me.SqlSelectCommand1.CommandText = "SELECT pub_id, pub_name, city, state, country FROM publishers" + Me.SqlSelectCommand1.Connection = Me.SqlConnection1 + ' + 'SqlConnection1 + ' + Me.SqlConnection1.ConnectionString = "data source=.;initial catalog=pubs;persist security info=False;user id=sa;packet " & _ + "size=4096;password=;" + ' + 'SqlInsertCommand1 + ' + Me.SqlInsertCommand1.CommandText = "INSERT INTO publishers(pub_id, pub_name, city, state, country) VALUES (@pub_id, @" & _ + "pub_name, @city, @state, @country); SELECT pub_id, pub_name, city, state, countr" & _ + "y FROM publishers WHERE (pub_id = @pub_id)" + Me.SqlInsertCommand1.Connection = Me.SqlConnection1 + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_id", System.Data.SqlDbType.VarChar, 4, "pub_id")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_name", System.Data.SqlDbType.VarChar, 40, "pub_name")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@city", System.Data.SqlDbType.VarChar, 20, "city")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@state", System.Data.SqlDbType.VarChar, 2, "state")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@country", System.Data.SqlDbType.VarChar, 30, "country")) + ' + 'SqlUpdateCommand1 + ' + Me.SqlUpdateCommand1.CommandText = "UPDATE publishers SET pub_id = @pub_id, pub_name = @pub_name, city = @city, state" & _ + " = @state, country = @country WHERE (pub_id = @Original_pub_id) AND (city = @Ori" & _ + "ginal_city OR @Original_city IS NULL AND city IS NULL) AND (country = @Original_" & _ + "country OR @Original_country IS NULL AND country IS NULL) AND (pub_name = @Origi" & _ + "nal_pub_name OR @Original_pub_name IS NULL AND pub_name IS NULL) AND (state = @O" & _ + "riginal_state OR @Original_state IS NULL AND state IS NULL); SELECT pub_id, pub_" & _ + "name, city, state, country FROM publishers WHERE (pub_id = @pub_id)" + Me.SqlUpdateCommand1.Connection = Me.SqlConnection1 + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_id", System.Data.SqlDbType.VarChar, 4, "pub_id")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_name", System.Data.SqlDbType.VarChar, 40, "pub_name")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@city", System.Data.SqlDbType.VarChar, 20, "city")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@state", System.Data.SqlDbType.VarChar, 2, "state")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@country", System.Data.SqlDbType.VarChar, 30, "country")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_id", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_city", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "city", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_country", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "country", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_name", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_name", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_state", System.Data.SqlDbType.VarChar, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "state", System.Data.DataRowVersion.Original, Nothing)) + ' + 'SqlDeleteCommand1 + ' + Me.SqlDeleteCommand1.CommandText = "DELETE FROM publishers WHERE (pub_id = @Original_pub_id) AND (city = @Original_ci" & _ + "ty OR @Original_city IS NULL AND city IS NULL) AND (country = @Original_country " & _ + "OR @Original_country IS NULL AND country IS NULL) AND (pub_name = @Original_pub_" & _ + "name OR @Original_pub_name IS NULL AND pub_name IS NULL) AND (state = @Original_" & _ + "state OR @Original_state IS NULL AND state IS NULL)" + Me.SqlDeleteCommand1.Connection = Me.SqlConnection1 + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_id", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_city", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "city", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_country", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "country", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_name", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_name", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_state", System.Data.SqlDbType.VarChar, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "state", System.Data.DataRowVersion.Original, Nothing)) + ' + 'SqlDataAdapter1 + ' + Me.SqlDataAdapter1.DeleteCommand = Me.SqlDeleteCommand1 + Me.SqlDataAdapter1.InsertCommand = Me.SqlInsertCommand1 + Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1 + Me.SqlDataAdapter1.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "publishers", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("pub_id", "pub_id"), New System.Data.Common.DataColumnMapping("pub_name", "pub_name"), New System.Data.Common.DataColumnMapping("city", "city"), New System.Data.Common.DataColumnMapping("state", "state"), New System.Data.Common.DataColumnMapping("country", "country")})}) + Me.SqlDataAdapter1.UpdateCommand = Me.SqlUpdateCommand1 + ' + 'DataSet11 + ' + Me.DataSet11.DataSetName = "DataSet1" + Me.DataSet11.Locale = New System.Globalization.CultureInfo("en-GB") + Me.DataSet11.Namespace = "http://www.tempuri.org/DataSet1.xsd" + CType(Me.DataSet11, System.ComponentModel.ISupportInitialize).EndInit() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + SqlDataAdapter1.Fill(DataSet11) + MyDataGrid.DataBind() + End Sub + + Private Sub MyDataGrid_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyDataGrid.SelectedIndexChanged + TextBox1.Text = "You selected " & MyDataGrid.SelectedItem.Cells(2).Text + End Sub + + Private Sub MyDataGrid_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles MyDataGrid.ItemDataBound + If e.Item.ItemType = ListItemType.Footer Or _ + e.Item.ItemType = ListItemType.Footer Or _ + e.Item.ItemType = ListItemType.Pager Then Exit Sub + If e.Item.Cells(0).Controls.Count > 0 Then + If TypeOf (e.Item.Cells(0).Controls(0)) Is Button Then + Dim btnSelect As Button = CType(e.Item.Cells(0).Controls(0), _ + Button) + e.Item.Attributes("onclick") = _ + Page.GetPostBackClientHyperlink(btnSelect, "") + End If + End If + End Sub +End Class diff --git a/Ch4 - Click Anywhere/_vti_pvt/access.cnf b/Ch4 - Click Anywhere/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch4 - Click Anywhere/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch4 - Click Anywhere/_vti_pvt/deptodoc.btr b/Ch4 - Click Anywhere/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..65ea3b9 Binary files /dev/null and b/Ch4 - Click Anywhere/_vti_pvt/deptodoc.btr differ diff --git a/Ch4 - Click Anywhere/_vti_pvt/doctodep.btr b/Ch4 - Click Anywhere/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch4 - Click Anywhere/_vti_pvt/doctodep.btr differ diff --git a/Ch4 - Click Anywhere/_vti_pvt/service.cnf b/Ch4 - Click Anywhere/_vti_pvt/service.cnf new file mode 100644 index 0000000..76a6c91 --- /dev/null +++ b/Ch4 - Click Anywhere/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|06 Nov 2002 18:37:41 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch4 - Click Anywhere/_vti_pvt/service.lck b/Ch4 - Click Anywhere/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch4 - Click Anywhere/_vti_pvt/services.cnf b/Ch4 - Click Anywhere/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch4 - Click Anywhere/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch4 - Click Anywhere/bin/Ch4 - Click Anywhere.dll b/Ch4 - Click Anywhere/bin/Ch4 - Click Anywhere.dll new file mode 100644 index 0000000..2f236ce Binary files /dev/null and b/Ch4 - Click Anywhere/bin/Ch4 - Click Anywhere.dll differ diff --git a/Ch4 - Click Anywhere/bin/Ch4 - Click Anywhere.pdb b/Ch4 - Click Anywhere/bin/Ch4 - Click Anywhere.pdb new file mode 100644 index 0000000..bcefc86 Binary files /dev/null and b/Ch4 - Click Anywhere/bin/Ch4 - Click Anywhere.pdb differ diff --git a/Ch4 - Color Coding Grids/AssemblyInfo.vb b/Ch4 - Color Coding Grids/AssemblyInfo.vb new file mode 100644 index 0000000..56b54a6 --- /dev/null +++ b/Ch4 - Color Coding Grids/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch4 - Color Coding Grids/Ch4 - Color Coding Grids.sln b/Ch4 - Color Coding Grids/Ch4 - Color Coding Grids.sln new file mode 100644 index 0000000..fc4d08a --- /dev/null +++ b/Ch4 - Color Coding Grids/Ch4 - Color Coding Grids.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch4 - Color Coding Grids", "http://localhost/Ch4 - Color Coding Grids/Ch4 - Color Coding Grids.vbproj", "{3AA25972-899B-4D4D-AFB5-BD341BFC4586}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {3AA25972-899B-4D4D-AFB5-BD341BFC4586}.Debug.ActiveCfg = Debug|.NET + {3AA25972-899B-4D4D-AFB5-BD341BFC4586}.Debug.Build.0 = Debug|.NET + {3AA25972-899B-4D4D-AFB5-BD341BFC4586}.Release.ActiveCfg = Release|.NET + {3AA25972-899B-4D4D-AFB5-BD341BFC4586}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch4 - Color Coding Grids/Ch4 - Color Coding Grids.suo b/Ch4 - Color Coding Grids/Ch4 - Color Coding Grids.suo new file mode 100644 index 0000000..41c7fa4 Binary files /dev/null and b/Ch4 - Color Coding Grids/Ch4 - Color Coding Grids.suo differ diff --git a/Ch4 - Color Coding Grids/Ch4 - Color Coding Grids.vbproj b/Ch4 - Color Coding Grids/Ch4 - Color Coding Grids.vbproj new file mode 100644 index 0000000..0060507 --- /dev/null +++ b/Ch4 - Color Coding Grids/Ch4 - Color Coding Grids.vbproj @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Color Coding Grids/Ch4 - Color Coding Grids.vbproj.webinfo b/Ch4 - Color Coding Grids/Ch4 - Color Coding Grids.vbproj.webinfo new file mode 100644 index 0000000..424b942 --- /dev/null +++ b/Ch4 - Color Coding Grids/Ch4 - Color Coding Grids.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch4 - Color Coding Grids/Ch4 - Color Coding Grids.vsdisco b/Ch4 - Color Coding Grids/Ch4 - Color Coding Grids.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch4 - Color Coding Grids/Ch4 - Color Coding Grids.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch4 - Color Coding Grids/DataSet1.vb b/Ch4 - Color Coding Grids/DataSet1.vb new file mode 100644 index 0000000..3136ed3 --- /dev/null +++ b/Ch4 - Color Coding Grids/DataSet1.vb @@ -0,0 +1,392 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version: 1.0.3705.288 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict Off +Option Explicit On + +Imports System +Imports System.Data +Imports System.Runtime.Serialization +Imports System.Xml + + + _ +Public Class DataSet1 + Inherits DataSet + + Private tablejobs As jobsDataTable + + Public Sub New() + MyBase.New + Me.InitClass + Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged + AddHandler Me.Tables.CollectionChanged, schemaChangedHandler + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler + End Sub + + Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext) + MyBase.New + Dim strSchema As String = CType(info.GetValue("XmlSchema", GetType(System.String)),String) + If (Not (strSchema) Is Nothing) Then + Dim ds As DataSet = New DataSet + ds.ReadXmlSchema(New XmlTextReader(New System.IO.StringReader(strSchema))) + If (Not (ds.Tables("jobs")) Is Nothing) Then + Me.Tables.Add(New jobsDataTable(ds.Tables("jobs"))) + End If + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.Namespace = ds.Namespace + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) + Me.InitVars + Else + Me.InitClass + End If + Me.GetSerializationData(info, context) + Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged + AddHandler Me.Tables.CollectionChanged, schemaChangedHandler + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler + End Sub + + _ + Public ReadOnly Property jobs As jobsDataTable + Get + Return Me.tablejobs + End Get + End Property + + Public Overrides Function Clone() As DataSet + Dim cln As DataSet1 = CType(MyBase.Clone,DataSet1) + cln.InitVars + Return cln + End Function + + Protected Overrides Function ShouldSerializeTables() As Boolean + Return false + End Function + + Protected Overrides Function ShouldSerializeRelations() As Boolean + Return false + End Function + + Protected Overrides Sub ReadXmlSerializable(ByVal reader As XmlReader) + Me.Reset + Dim ds As DataSet = New DataSet + ds.ReadXml(reader) + If (Not (ds.Tables("jobs")) Is Nothing) Then + Me.Tables.Add(New jobsDataTable(ds.Tables("jobs"))) + End If + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.Namespace = ds.Namespace + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) + Me.InitVars + End Sub + + Protected Overrides Function GetSchemaSerializable() As System.Xml.Schema.XmlSchema + Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream + Me.WriteXmlSchema(New XmlTextWriter(stream, Nothing)) + stream.Position = 0 + Return System.Xml.Schema.XmlSchema.Read(New XmlTextReader(stream), Nothing) + End Function + + Friend Sub InitVars() + Me.tablejobs = CType(Me.Tables("jobs"),jobsDataTable) + If (Not (Me.tablejobs) Is Nothing) Then + Me.tablejobs.InitVars + End If + End Sub + + Private Sub InitClass() + Me.DataSetName = "DataSet1" + Me.Prefix = "" + Me.Namespace = "http://www.tempuri.org/DataSet1.xsd" + Me.Locale = New System.Globalization.CultureInfo("en-GB") + Me.CaseSensitive = false + Me.EnforceConstraints = true + Me.tablejobs = New jobsDataTable + Me.Tables.Add(Me.tablejobs) + End Sub + + Private Function ShouldSerializejobs() As Boolean + Return false + End Function + + Private Sub SchemaChanged(ByVal sender As Object, ByVal e As System.ComponentModel.CollectionChangeEventArgs) + If (e.Action = System.ComponentModel.CollectionChangeAction.Remove) Then + Me.InitVars + End If + End Sub + + Public Delegate Sub jobsRowChangeEventHandler(ByVal sender As Object, ByVal e As jobsRowChangeEvent) + + _ + Public Class jobsDataTable + Inherits DataTable + Implements System.Collections.IEnumerable + + Private columnjob_id As DataColumn + + Private columnjob_desc As DataColumn + + Private columnmin_lvl As DataColumn + + Private columnmax_lvl As DataColumn + + Friend Sub New() + MyBase.New("jobs") + Me.InitClass + End Sub + + Friend Sub New(ByVal table As DataTable) + MyBase.New(table.TableName) + If (table.CaseSensitive <> table.DataSet.CaseSensitive) Then + Me.CaseSensitive = table.CaseSensitive + End If + If (table.Locale.ToString <> table.DataSet.Locale.ToString) Then + Me.Locale = table.Locale + End If + If (table.Namespace <> table.DataSet.Namespace) Then + Me.Namespace = table.Namespace + End If + Me.Prefix = table.Prefix + Me.MinimumCapacity = table.MinimumCapacity + Me.DisplayExpression = table.DisplayExpression + End Sub + + _ + Public ReadOnly Property Count As Integer + Get + Return Me.Rows.Count + End Get + End Property + + Friend ReadOnly Property job_idColumn As DataColumn + Get + Return Me.columnjob_id + End Get + End Property + + Friend ReadOnly Property job_descColumn As DataColumn + Get + Return Me.columnjob_desc + End Get + End Property + + Friend ReadOnly Property min_lvlColumn As DataColumn + Get + Return Me.columnmin_lvl + End Get + End Property + + Friend ReadOnly Property max_lvlColumn As DataColumn + Get + Return Me.columnmax_lvl + End Get + End Property + + Public Default ReadOnly Property Item(ByVal index As Integer) As jobsRow + Get + Return CType(Me.Rows(index),jobsRow) + End Get + End Property + + Public Event jobsRowChanged As jobsRowChangeEventHandler + + Public Event jobsRowChanging As jobsRowChangeEventHandler + + Public Event jobsRowDeleted As jobsRowChangeEventHandler + + Public Event jobsRowDeleting As jobsRowChangeEventHandler + + Public Overloads Sub AddjobsRow(ByVal row As jobsRow) + Me.Rows.Add(row) + End Sub + + Public Overloads Function AddjobsRow(ByVal job_desc As String, ByVal min_lvl As Byte, ByVal max_lvl As Byte) As jobsRow + Dim rowjobsRow As jobsRow = CType(Me.NewRow,jobsRow) + rowjobsRow.ItemArray = New Object() {Nothing, job_desc, min_lvl, max_lvl} + Me.Rows.Add(rowjobsRow) + Return rowjobsRow + End Function + + Public Function FindByjob_id(ByVal job_id As Short) As jobsRow + Return CType(Me.Rows.Find(New Object() {job_id}),jobsRow) + End Function + + Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator + Return Me.Rows.GetEnumerator + End Function + + Public Overrides Function Clone() As DataTable + Dim cln As jobsDataTable = CType(MyBase.Clone,jobsDataTable) + cln.InitVars + Return cln + End Function + + Protected Overrides Function CreateInstance() As DataTable + Return New jobsDataTable + End Function + + Friend Sub InitVars() + Me.columnjob_id = Me.Columns("job_id") + Me.columnjob_desc = Me.Columns("job_desc") + Me.columnmin_lvl = Me.Columns("min_lvl") + Me.columnmax_lvl = Me.Columns("max_lvl") + End Sub + + Private Sub InitClass() + Me.columnjob_id = New DataColumn("job_id", GetType(System.Int16), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnjob_id) + Me.columnjob_desc = New DataColumn("job_desc", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnjob_desc) + Me.columnmin_lvl = New DataColumn("min_lvl", GetType(System.Byte), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnmin_lvl) + Me.columnmax_lvl = New DataColumn("max_lvl", GetType(System.Byte), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnmax_lvl) + Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnjob_id}, true)) + Me.columnjob_id.AutoIncrement = true + Me.columnjob_id.AllowDBNull = false + Me.columnjob_id.ReadOnly = true + Me.columnjob_id.Unique = true + Me.columnjob_desc.AllowDBNull = false + Me.columnmin_lvl.AllowDBNull = false + Me.columnmax_lvl.AllowDBNull = false + End Sub + + Public Function NewjobsRow() As jobsRow + Return CType(Me.NewRow,jobsRow) + End Function + + Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow + Return New jobsRow(builder) + End Function + + Protected Overrides Function GetRowType() As System.Type + Return GetType(jobsRow) + End Function + + Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanged(e) + If (Not (Me.jobsRowChangedEvent) Is Nothing) Then + RaiseEvent jobsRowChanged(Me, New jobsRowChangeEvent(CType(e.Row,jobsRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanging(e) + If (Not (Me.jobsRowChangingEvent) Is Nothing) Then + RaiseEvent jobsRowChanging(Me, New jobsRowChangeEvent(CType(e.Row,jobsRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleted(e) + If (Not (Me.jobsRowDeletedEvent) Is Nothing) Then + RaiseEvent jobsRowDeleted(Me, New jobsRowChangeEvent(CType(e.Row,jobsRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleting(e) + If (Not (Me.jobsRowDeletingEvent) Is Nothing) Then + RaiseEvent jobsRowDeleting(Me, New jobsRowChangeEvent(CType(e.Row,jobsRow), e.Action)) + End If + End Sub + + Public Sub RemovejobsRow(ByVal row As jobsRow) + Me.Rows.Remove(row) + End Sub + End Class + + _ + Public Class jobsRow + Inherits DataRow + + Private tablejobs As jobsDataTable + + Friend Sub New(ByVal rb As DataRowBuilder) + MyBase.New(rb) + Me.tablejobs = CType(Me.Table,jobsDataTable) + End Sub + + Public Property job_id As Short + Get + Return CType(Me(Me.tablejobs.job_idColumn),Short) + End Get + Set + Me(Me.tablejobs.job_idColumn) = value + End Set + End Property + + Public Property job_desc As String + Get + Return CType(Me(Me.tablejobs.job_descColumn),String) + End Get + Set + Me(Me.tablejobs.job_descColumn) = value + End Set + End Property + + Public Property min_lvl As Byte + Get + Return CType(Me(Me.tablejobs.min_lvlColumn),Byte) + End Get + Set + Me(Me.tablejobs.min_lvlColumn) = value + End Set + End Property + + Public Property max_lvl As Byte + Get + Return CType(Me(Me.tablejobs.max_lvlColumn),Byte) + End Get + Set + Me(Me.tablejobs.max_lvlColumn) = value + End Set + End Property + End Class + + _ + Public Class jobsRowChangeEvent + Inherits EventArgs + + Private eventRow As jobsRow + + Private eventAction As DataRowAction + + Public Sub New(ByVal row As jobsRow, ByVal action As DataRowAction) + MyBase.New + Me.eventRow = row + Me.eventAction = action + End Sub + + Public ReadOnly Property Row As jobsRow + Get + Return Me.eventRow + End Get + End Property + + Public ReadOnly Property Action As DataRowAction + Get + Return Me.eventAction + End Get + End Property + End Class +End Class diff --git a/Ch4 - Color Coding Grids/DataSet1.xsd b/Ch4 - Color Coding Grids/DataSet1.xsd new file mode 100644 index 0000000..cf553fc --- /dev/null +++ b/Ch4 - Color Coding Grids/DataSet1.xsd @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ch4 - Color Coding Grids/Global.asax b/Ch4 - Color Coding Grids/Global.asax new file mode 100644 index 0000000..e58e5bc --- /dev/null +++ b/Ch4 - Color Coding Grids/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch4___Color_Coding_Grids.Global" %> \ No newline at end of file diff --git a/Ch4 - Color Coding Grids/Global.asax.resx b/Ch4 - Color Coding Grids/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch4 - Color Coding Grids/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch4 - Color Coding Grids/Global.asax.vb b/Ch4 - Color Coding Grids/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch4 - Color Coding Grids/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch4 - Color Coding Grids/Read Me First.txt b/Ch4 - Color Coding Grids/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch4 - Color Coding Grids/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch4 - Color Coding Grids/Styles.css b/Ch4 - Color Coding Grids/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch4 - Color Coding Grids/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch4 - Color Coding Grids/Web.config b/Ch4 - Color Coding Grids/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch4 - Color Coding Grids/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Color Coding Grids/WebForm1.aspx b/Ch4 - Color Coding Grids/WebForm1.aspx new file mode 100644 index 0000000..6537150 --- /dev/null +++ b/Ch4 - Color Coding Grids/WebForm1.aspx @@ -0,0 +1,22 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch4___Color_Coding_Grids.WebForm1"%> + + + + WebForm1 + + + + + + +
+ + + + + + + +
+ + diff --git a/Ch4 - Color Coding Grids/WebForm1.aspx.resx b/Ch4 - Color Coding Grids/WebForm1.aspx.resx new file mode 100644 index 0000000..be3c400 --- /dev/null +++ b/Ch4 - Color Coding Grids/WebForm1.aspx.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + False + + + False + + + False + + + False + + + False + + + False + + + False + + + 17, 17 + + + 145, 17 + + + 280, 17 + + \ No newline at end of file diff --git a/Ch4 - Color Coding Grids/WebForm1.aspx.vb b/Ch4 - Color Coding Grids/WebForm1.aspx.vb new file mode 100644 index 0000000..496bba0 --- /dev/null +++ b/Ch4 - Color Coding Grids/WebForm1.aspx.vb @@ -0,0 +1,118 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlUpdateCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlDeleteCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection + Protected WithEvents SqlDataAdapter1 As System.Data.SqlClient.SqlDataAdapter + Protected WithEvents DataSet11 As Ch4___Color_Coding_Grids.DataSet1 + Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection() + Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter() + Me.DataSet11 = New Ch4___Color_Coding_Grids.DataSet1() + CType(Me.DataSet11, System.ComponentModel.ISupportInitialize).BeginInit() + ' + 'SqlSelectCommand1 + ' + Me.SqlSelectCommand1.CommandText = "SELECT job_id, job_desc, min_lvl, max_lvl FROM jobs" + Me.SqlSelectCommand1.Connection = Me.SqlConnection1 + ' + 'SqlInsertCommand1 + ' + Me.SqlInsertCommand1.CommandText = "INSERT INTO jobs(job_desc, min_lvl, max_lvl) VALUES (@job_desc, @min_lvl, @max_lv" & _ + "l); SELECT job_id, job_desc, min_lvl, max_lvl FROM jobs WHERE (job_id = @@IDENTI" & _ + "TY)" + Me.SqlInsertCommand1.Connection = Me.SqlConnection1 + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@job_desc", System.Data.SqlDbType.VarChar, 50, "job_desc")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@min_lvl", System.Data.SqlDbType.TinyInt, 1, "min_lvl")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@max_lvl", System.Data.SqlDbType.TinyInt, 1, "max_lvl")) + ' + 'SqlUpdateCommand1 + ' + Me.SqlUpdateCommand1.CommandText = "UPDATE jobs SET job_desc = @job_desc, min_lvl = @min_lvl, max_lvl = @max_lvl WHER" & _ + "E (job_id = @Original_job_id) AND (job_desc = @Original_job_desc) AND (max_lvl =" & _ + " @Original_max_lvl) AND (min_lvl = @Original_min_lvl); SELECT job_id, job_desc, " & _ + "min_lvl, max_lvl FROM jobs WHERE (job_id = @job_id)" + Me.SqlUpdateCommand1.Connection = Me.SqlConnection1 + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@job_desc", System.Data.SqlDbType.VarChar, 50, "job_desc")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@min_lvl", System.Data.SqlDbType.TinyInt, 1, "min_lvl")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@max_lvl", System.Data.SqlDbType.TinyInt, 1, "max_lvl")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_job_id", System.Data.SqlDbType.SmallInt, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "job_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_job_desc", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "job_desc", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_max_lvl", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "max_lvl", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_min_lvl", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "min_lvl", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@job_id", System.Data.SqlDbType.SmallInt, 2, "job_id")) + ' + 'SqlDeleteCommand1 + ' + Me.SqlDeleteCommand1.CommandText = "DELETE FROM jobs WHERE (job_id = @Original_job_id) AND (job_desc = @Original_job_" & _ + "desc) AND (max_lvl = @Original_max_lvl) AND (min_lvl = @Original_min_lvl)" + Me.SqlDeleteCommand1.Connection = Me.SqlConnection1 + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_job_id", System.Data.SqlDbType.SmallInt, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "job_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_job_desc", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "job_desc", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_max_lvl", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "max_lvl", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_min_lvl", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "min_lvl", System.Data.DataRowVersion.Original, Nothing)) + ' + 'SqlConnection1 + ' + Me.SqlConnection1.ConnectionString = "data source=.;initial catalog=pubs;persist security info=False;user id=sa;packet " & _ + "size=4096;password=;" + ' + 'SqlDataAdapter1 + ' + Me.SqlDataAdapter1.DeleteCommand = Me.SqlDeleteCommand1 + Me.SqlDataAdapter1.InsertCommand = Me.SqlInsertCommand1 + Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1 + Me.SqlDataAdapter1.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "jobs", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("job_id", "job_id"), New System.Data.Common.DataColumnMapping("job_desc", "job_desc"), New System.Data.Common.DataColumnMapping("min_lvl", "min_lvl"), New System.Data.Common.DataColumnMapping("max_lvl", "max_lvl")})}) + Me.SqlDataAdapter1.UpdateCommand = Me.SqlUpdateCommand1 + ' + 'DataSet11 + ' + Me.DataSet11.DataSetName = "DataSet1" + Me.DataSet11.Locale = New System.Globalization.CultureInfo("en-GB") + Me.DataSet11.Namespace = "http://www.tempuri.org/DataSet1.xsd" + CType(Me.DataSet11, System.ComponentModel.ISupportInitialize).EndInit() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + SqlDataAdapter1.Fill(DataSet11) + DataGrid1.DataBind() + End Sub + + Private Sub DataGrid1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGrid1.SelectedIndexChanged + + End Sub + + Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound + If e.Item.ItemType = ListItemType.Item Or _ + e.Item.ItemType = ListItemType.AlternatingItem Then + If CType(e.Item.Cells(3).Text, Integer) > 230 Then + e.Item.Cells(3).BackColor = Color.Plum + e.Item.Cells(3).ForeColor = Color.White + e.Item.Cells(3).Font.Bold = True + Else + e.Item.BackColor = Color.WhiteSmoke + e.Item.BorderStyle = BorderStyle.Dotted + End If + End If + End Sub +End Class diff --git a/Ch4 - Color Coding Grids/_vti_pvt/access.cnf b/Ch4 - Color Coding Grids/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch4 - Color Coding Grids/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch4 - Color Coding Grids/_vti_pvt/deptodoc.btr b/Ch4 - Color Coding Grids/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch4 - Color Coding Grids/_vti_pvt/deptodoc.btr differ diff --git a/Ch4 - Color Coding Grids/_vti_pvt/doctodep.btr b/Ch4 - Color Coding Grids/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..59a41f4 Binary files /dev/null and b/Ch4 - Color Coding Grids/_vti_pvt/doctodep.btr differ diff --git a/Ch4 - Color Coding Grids/_vti_pvt/service.cnf b/Ch4 - Color Coding Grids/_vti_pvt/service.cnf new file mode 100644 index 0000000..5b50a49 --- /dev/null +++ b/Ch4 - Color Coding Grids/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|06 Nov 2002 16:32:09 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch4 - Color Coding Grids/_vti_pvt/service.lck b/Ch4 - Color Coding Grids/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch4 - Color Coding Grids/_vti_pvt/services.cnf b/Ch4 - Color Coding Grids/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch4 - Color Coding Grids/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch4 - Color Coding Grids/bin/Ch4 - Color Coding Grids.dll b/Ch4 - Color Coding Grids/bin/Ch4 - Color Coding Grids.dll new file mode 100644 index 0000000..940cf7f Binary files /dev/null and b/Ch4 - Color Coding Grids/bin/Ch4 - Color Coding Grids.dll differ diff --git a/Ch4 - Color Coding Grids/bin/Ch4 - Color Coding Grids.pdb b/Ch4 - Color Coding Grids/bin/Ch4 - Color Coding Grids.pdb new file mode 100644 index 0000000..d735ca1 Binary files /dev/null and b/Ch4 - Color Coding Grids/bin/Ch4 - Color Coding Grids.pdb differ diff --git a/Ch4 - Confirm Deletes/AssemblyInfo.vb b/Ch4 - Confirm Deletes/AssemblyInfo.vb new file mode 100644 index 0000000..6f450f4 --- /dev/null +++ b/Ch4 - Confirm Deletes/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch4 - Confirm Deletes/Ch4 - Confirm Deletes.sln b/Ch4 - Confirm Deletes/Ch4 - Confirm Deletes.sln new file mode 100644 index 0000000..70dbfd7 --- /dev/null +++ b/Ch4 - Confirm Deletes/Ch4 - Confirm Deletes.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch4 - Confirm Deletes", "http://localhost/Ch4 - Confirm Deletes/Ch4 - Confirm Deletes.vbproj", "{69E193B2-4526-4F2D-8A87-7875B3B2C865}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {69E193B2-4526-4F2D-8A87-7875B3B2C865}.Debug.ActiveCfg = Debug|.NET + {69E193B2-4526-4F2D-8A87-7875B3B2C865}.Debug.Build.0 = Debug|.NET + {69E193B2-4526-4F2D-8A87-7875B3B2C865}.Release.ActiveCfg = Release|.NET + {69E193B2-4526-4F2D-8A87-7875B3B2C865}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch4 - Confirm Deletes/Ch4 - Confirm Deletes.suo b/Ch4 - Confirm Deletes/Ch4 - Confirm Deletes.suo new file mode 100644 index 0000000..f565c62 Binary files /dev/null and b/Ch4 - Confirm Deletes/Ch4 - Confirm Deletes.suo differ diff --git a/Ch4 - Confirm Deletes/Ch4 - Confirm Deletes.vbproj b/Ch4 - Confirm Deletes/Ch4 - Confirm Deletes.vbproj new file mode 100644 index 0000000..6204998 --- /dev/null +++ b/Ch4 - Confirm Deletes/Ch4 - Confirm Deletes.vbproj @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Confirm Deletes/Ch4 - Confirm Deletes.vbproj.webinfo b/Ch4 - Confirm Deletes/Ch4 - Confirm Deletes.vbproj.webinfo new file mode 100644 index 0000000..712944c --- /dev/null +++ b/Ch4 - Confirm Deletes/Ch4 - Confirm Deletes.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch4 - Confirm Deletes/Ch4 - Confirm Deletes.vsdisco b/Ch4 - Confirm Deletes/Ch4 - Confirm Deletes.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch4 - Confirm Deletes/Ch4 - Confirm Deletes.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch4 - Confirm Deletes/DataSet1.vb b/Ch4 - Confirm Deletes/DataSet1.vb new file mode 100644 index 0000000..ae2c350 --- /dev/null +++ b/Ch4 - Confirm Deletes/DataSet1.vb @@ -0,0 +1,455 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version: 1.0.3705.288 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict Off +Option Explicit On + +Imports System +Imports System.Data +Imports System.Runtime.Serialization +Imports System.Xml + + + _ +Public Class DataSet1 + Inherits DataSet + + Private tablepublishers As publishersDataTable + + Public Sub New() + MyBase.New + Me.InitClass + Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged + AddHandler Me.Tables.CollectionChanged, schemaChangedHandler + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler + End Sub + + Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext) + MyBase.New + Dim strSchema As String = CType(info.GetValue("XmlSchema", GetType(System.String)),String) + If (Not (strSchema) Is Nothing) Then + Dim ds As DataSet = New DataSet + ds.ReadXmlSchema(New XmlTextReader(New System.IO.StringReader(strSchema))) + If (Not (ds.Tables("publishers")) Is Nothing) Then + Me.Tables.Add(New publishersDataTable(ds.Tables("publishers"))) + End If + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.Namespace = ds.Namespace + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) + Me.InitVars + Else + Me.InitClass + End If + Me.GetSerializationData(info, context) + Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged + AddHandler Me.Tables.CollectionChanged, schemaChangedHandler + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler + End Sub + + _ + Public ReadOnly Property publishers As publishersDataTable + Get + Return Me.tablepublishers + End Get + End Property + + Public Overrides Function Clone() As DataSet + Dim cln As DataSet1 = CType(MyBase.Clone,DataSet1) + cln.InitVars + Return cln + End Function + + Protected Overrides Function ShouldSerializeTables() As Boolean + Return false + End Function + + Protected Overrides Function ShouldSerializeRelations() As Boolean + Return false + End Function + + Protected Overrides Sub ReadXmlSerializable(ByVal reader As XmlReader) + Me.Reset + Dim ds As DataSet = New DataSet + ds.ReadXml(reader) + If (Not (ds.Tables("publishers")) Is Nothing) Then + Me.Tables.Add(New publishersDataTable(ds.Tables("publishers"))) + End If + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.Namespace = ds.Namespace + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) + Me.InitVars + End Sub + + Protected Overrides Function GetSchemaSerializable() As System.Xml.Schema.XmlSchema + Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream + Me.WriteXmlSchema(New XmlTextWriter(stream, Nothing)) + stream.Position = 0 + Return System.Xml.Schema.XmlSchema.Read(New XmlTextReader(stream), Nothing) + End Function + + Friend Sub InitVars() + Me.tablepublishers = CType(Me.Tables("publishers"),publishersDataTable) + If (Not (Me.tablepublishers) Is Nothing) Then + Me.tablepublishers.InitVars + End If + End Sub + + Private Sub InitClass() + Me.DataSetName = "DataSet1" + Me.Prefix = "" + Me.Namespace = "http://www.tempuri.org/DataSet1.xsd" + Me.Locale = New System.Globalization.CultureInfo("en-GB") + Me.CaseSensitive = false + Me.EnforceConstraints = true + Me.tablepublishers = New publishersDataTable + Me.Tables.Add(Me.tablepublishers) + End Sub + + Private Function ShouldSerializepublishers() As Boolean + Return false + End Function + + Private Sub SchemaChanged(ByVal sender As Object, ByVal e As System.ComponentModel.CollectionChangeEventArgs) + If (e.Action = System.ComponentModel.CollectionChangeAction.Remove) Then + Me.InitVars + End If + End Sub + + Public Delegate Sub publishersRowChangeEventHandler(ByVal sender As Object, ByVal e As publishersRowChangeEvent) + + _ + Public Class publishersDataTable + Inherits DataTable + Implements System.Collections.IEnumerable + + Private columnpub_id As DataColumn + + Private columnpub_name As DataColumn + + Private columncity As DataColumn + + Private columnstate As DataColumn + + Private columncountry As DataColumn + + Friend Sub New() + MyBase.New("publishers") + Me.InitClass + End Sub + + Friend Sub New(ByVal table As DataTable) + MyBase.New(table.TableName) + If (table.CaseSensitive <> table.DataSet.CaseSensitive) Then + Me.CaseSensitive = table.CaseSensitive + End If + If (table.Locale.ToString <> table.DataSet.Locale.ToString) Then + Me.Locale = table.Locale + End If + If (table.Namespace <> table.DataSet.Namespace) Then + Me.Namespace = table.Namespace + End If + Me.Prefix = table.Prefix + Me.MinimumCapacity = table.MinimumCapacity + Me.DisplayExpression = table.DisplayExpression + End Sub + + _ + Public ReadOnly Property Count As Integer + Get + Return Me.Rows.Count + End Get + End Property + + Friend ReadOnly Property pub_idColumn As DataColumn + Get + Return Me.columnpub_id + End Get + End Property + + Friend ReadOnly Property pub_nameColumn As DataColumn + Get + Return Me.columnpub_name + End Get + End Property + + Friend ReadOnly Property cityColumn As DataColumn + Get + Return Me.columncity + End Get + End Property + + Friend ReadOnly Property stateColumn As DataColumn + Get + Return Me.columnstate + End Get + End Property + + Friend ReadOnly Property countryColumn As DataColumn + Get + Return Me.columncountry + End Get + End Property + + Public Default ReadOnly Property Item(ByVal index As Integer) As publishersRow + Get + Return CType(Me.Rows(index),publishersRow) + End Get + End Property + + Public Event publishersRowChanged As publishersRowChangeEventHandler + + Public Event publishersRowChanging As publishersRowChangeEventHandler + + Public Event publishersRowDeleted As publishersRowChangeEventHandler + + Public Event publishersRowDeleting As publishersRowChangeEventHandler + + Public Overloads Sub AddpublishersRow(ByVal row As publishersRow) + Me.Rows.Add(row) + End Sub + + Public Overloads Function AddpublishersRow(ByVal pub_id As String, ByVal pub_name As String, ByVal city As String, ByVal state As String, ByVal country As String) As publishersRow + Dim rowpublishersRow As publishersRow = CType(Me.NewRow,publishersRow) + rowpublishersRow.ItemArray = New Object() {pub_id, pub_name, city, state, country} + Me.Rows.Add(rowpublishersRow) + Return rowpublishersRow + End Function + + Public Function FindBypub_id(ByVal pub_id As String) As publishersRow + Return CType(Me.Rows.Find(New Object() {pub_id}),publishersRow) + End Function + + Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator + Return Me.Rows.GetEnumerator + End Function + + Public Overrides Function Clone() As DataTable + Dim cln As publishersDataTable = CType(MyBase.Clone,publishersDataTable) + cln.InitVars + Return cln + End Function + + Protected Overrides Function CreateInstance() As DataTable + Return New publishersDataTable + End Function + + Friend Sub InitVars() + Me.columnpub_id = Me.Columns("pub_id") + Me.columnpub_name = Me.Columns("pub_name") + Me.columncity = Me.Columns("city") + Me.columnstate = Me.Columns("state") + Me.columncountry = Me.Columns("country") + End Sub + + Private Sub InitClass() + Me.columnpub_id = New DataColumn("pub_id", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnpub_id) + Me.columnpub_name = New DataColumn("pub_name", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnpub_name) + Me.columncity = New DataColumn("city", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columncity) + Me.columnstate = New DataColumn("state", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnstate) + Me.columncountry = New DataColumn("country", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columncountry) + Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnpub_id}, true)) + Me.columnpub_id.AllowDBNull = false + Me.columnpub_id.Unique = true + End Sub + + Public Function NewpublishersRow() As publishersRow + Return CType(Me.NewRow,publishersRow) + End Function + + Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow + Return New publishersRow(builder) + End Function + + Protected Overrides Function GetRowType() As System.Type + Return GetType(publishersRow) + End Function + + Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanged(e) + If (Not (Me.publishersRowChangedEvent) Is Nothing) Then + RaiseEvent publishersRowChanged(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanging(e) + If (Not (Me.publishersRowChangingEvent) Is Nothing) Then + RaiseEvent publishersRowChanging(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleted(e) + If (Not (Me.publishersRowDeletedEvent) Is Nothing) Then + RaiseEvent publishersRowDeleted(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleting(e) + If (Not (Me.publishersRowDeletingEvent) Is Nothing) Then + RaiseEvent publishersRowDeleting(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Public Sub RemovepublishersRow(ByVal row As publishersRow) + Me.Rows.Remove(row) + End Sub + End Class + + _ + Public Class publishersRow + Inherits DataRow + + Private tablepublishers As publishersDataTable + + Friend Sub New(ByVal rb As DataRowBuilder) + MyBase.New(rb) + Me.tablepublishers = CType(Me.Table,publishersDataTable) + End Sub + + Public Property pub_id As String + Get + Return CType(Me(Me.tablepublishers.pub_idColumn),String) + End Get + Set + Me(Me.tablepublishers.pub_idColumn) = value + End Set + End Property + + Public Property pub_name As String + Get + Try + Return CType(Me(Me.tablepublishers.pub_nameColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.pub_nameColumn) = value + End Set + End Property + + Public Property city As String + Get + Try + Return CType(Me(Me.tablepublishers.cityColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.cityColumn) = value + End Set + End Property + + Public Property state As String + Get + Try + Return CType(Me(Me.tablepublishers.stateColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.stateColumn) = value + End Set + End Property + + Public Property country As String + Get + Try + Return CType(Me(Me.tablepublishers.countryColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.countryColumn) = value + End Set + End Property + + Public Function Ispub_nameNull() As Boolean + Return Me.IsNull(Me.tablepublishers.pub_nameColumn) + End Function + + Public Sub Setpub_nameNull() + Me(Me.tablepublishers.pub_nameColumn) = System.Convert.DBNull + End Sub + + Public Function IscityNull() As Boolean + Return Me.IsNull(Me.tablepublishers.cityColumn) + End Function + + Public Sub SetcityNull() + Me(Me.tablepublishers.cityColumn) = System.Convert.DBNull + End Sub + + Public Function IsstateNull() As Boolean + Return Me.IsNull(Me.tablepublishers.stateColumn) + End Function + + Public Sub SetstateNull() + Me(Me.tablepublishers.stateColumn) = System.Convert.DBNull + End Sub + + Public Function IscountryNull() As Boolean + Return Me.IsNull(Me.tablepublishers.countryColumn) + End Function + + Public Sub SetcountryNull() + Me(Me.tablepublishers.countryColumn) = System.Convert.DBNull + End Sub + End Class + + _ + Public Class publishersRowChangeEvent + Inherits EventArgs + + Private eventRow As publishersRow + + Private eventAction As DataRowAction + + Public Sub New(ByVal row As publishersRow, ByVal action As DataRowAction) + MyBase.New + Me.eventRow = row + Me.eventAction = action + End Sub + + Public ReadOnly Property Row As publishersRow + Get + Return Me.eventRow + End Get + End Property + + Public ReadOnly Property Action As DataRowAction + Get + Return Me.eventAction + End Get + End Property + End Class +End Class diff --git a/Ch4 - Confirm Deletes/DataSet1.xsd b/Ch4 - Confirm Deletes/DataSet1.xsd new file mode 100644 index 0000000..651872e --- /dev/null +++ b/Ch4 - Confirm Deletes/DataSet1.xsd @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ch4 - Confirm Deletes/Global.asax b/Ch4 - Confirm Deletes/Global.asax new file mode 100644 index 0000000..0874230 --- /dev/null +++ b/Ch4 - Confirm Deletes/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch4___Confirm_Deletes.Global" %> \ No newline at end of file diff --git a/Ch4 - Confirm Deletes/Global.asax.resx b/Ch4 - Confirm Deletes/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch4 - Confirm Deletes/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch4 - Confirm Deletes/Global.asax.vb b/Ch4 - Confirm Deletes/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch4 - Confirm Deletes/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch4 - Confirm Deletes/Read Me First.txt b/Ch4 - Confirm Deletes/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch4 - Confirm Deletes/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch4 - Confirm Deletes/Styles.css b/Ch4 - Confirm Deletes/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch4 - Confirm Deletes/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch4 - Confirm Deletes/Web.config b/Ch4 - Confirm Deletes/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch4 - Confirm Deletes/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Confirm Deletes/WebForm1.aspx b/Ch4 - Confirm Deletes/WebForm1.aspx new file mode 100644 index 0000000..9d733ba --- /dev/null +++ b/Ch4 - Confirm Deletes/WebForm1.aspx @@ -0,0 +1,26 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch4___Confirm_Deletes.WebForm1"%> + + + + WebForm1 + + + + + + +
+ + + + + + + + + + + +
+ + diff --git a/Ch4 - Confirm Deletes/WebForm1.aspx.resx b/Ch4 - Confirm Deletes/WebForm1.aspx.resx new file mode 100644 index 0000000..2ada03c --- /dev/null +++ b/Ch4 - Confirm Deletes/WebForm1.aspx.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + 17, 17 + + + False + + + 152, 17 + + + False + + + 17, 17 + + + False + + + False + + + 17, 17 + + + False + + + False + + + 17, 17 + + + False + + + 17, 17 + + + 280, 17 + + \ No newline at end of file diff --git a/Ch4 - Confirm Deletes/WebForm1.aspx.vb b/Ch4 - Confirm Deletes/WebForm1.aspx.vb new file mode 100644 index 0000000..92b683f --- /dev/null +++ b/Ch4 - Confirm Deletes/WebForm1.aspx.vb @@ -0,0 +1,131 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlUpdateCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlDeleteCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection + Protected WithEvents SqlDataAdapter1 As System.Data.SqlClient.SqlDataAdapter + Protected WithEvents DataSet11 As Ch4___Confirm_Deletes.DataSet1 + Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid + Protected WithEvents lblInfo As System.Web.UI.WebControls.Label + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection() + Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter() + Me.DataSet11 = New Ch4___Confirm_Deletes.DataSet1() + CType(Me.DataSet11, System.ComponentModel.ISupportInitialize).BeginInit() + ' + 'SqlSelectCommand1 + ' + Me.SqlSelectCommand1.CommandText = "SELECT pub_id, pub_name, city, state, country FROM publishers" + Me.SqlSelectCommand1.Connection = Me.SqlConnection1 + ' + 'SqlConnection1 + ' + Me.SqlConnection1.ConnectionString = "data source=.;initial catalog=pubs;persist security info=False;user id=sa;packet " & _ + "size=4096;password=;" + ' + 'SqlInsertCommand1 + ' + Me.SqlInsertCommand1.CommandText = "INSERT INTO publishers(pub_id, pub_name, city, state, country) VALUES (@pub_id, @" & _ + "pub_name, @city, @state, @country); SELECT pub_id, pub_name, city, state, countr" & _ + "y FROM publishers WHERE (pub_id = @pub_id)" + Me.SqlInsertCommand1.Connection = Me.SqlConnection1 + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_id", System.Data.SqlDbType.VarChar, 4, "pub_id")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_name", System.Data.SqlDbType.VarChar, 40, "pub_name")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@city", System.Data.SqlDbType.VarChar, 20, "city")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@state", System.Data.SqlDbType.VarChar, 2, "state")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@country", System.Data.SqlDbType.VarChar, 30, "country")) + ' + 'SqlUpdateCommand1 + ' + Me.SqlUpdateCommand1.CommandText = "UPDATE publishers SET pub_id = @pub_id, pub_name = @pub_name, city = @city, state" & _ + " = @state, country = @country WHERE (pub_id = @Original_pub_id) AND (city = @Ori" & _ + "ginal_city OR @Original_city IS NULL AND city IS NULL) AND (country = @Original_" & _ + "country OR @Original_country IS NULL AND country IS NULL) AND (pub_name = @Origi" & _ + "nal_pub_name OR @Original_pub_name IS NULL AND pub_name IS NULL) AND (state = @O" & _ + "riginal_state OR @Original_state IS NULL AND state IS NULL); SELECT pub_id, pub_" & _ + "name, city, state, country FROM publishers WHERE (pub_id = @pub_id)" + Me.SqlUpdateCommand1.Connection = Me.SqlConnection1 + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_id", System.Data.SqlDbType.VarChar, 4, "pub_id")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_name", System.Data.SqlDbType.VarChar, 40, "pub_name")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@city", System.Data.SqlDbType.VarChar, 20, "city")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@state", System.Data.SqlDbType.VarChar, 2, "state")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@country", System.Data.SqlDbType.VarChar, 30, "country")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_id", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_city", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "city", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_country", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "country", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_name", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_name", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_state", System.Data.SqlDbType.VarChar, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "state", System.Data.DataRowVersion.Original, Nothing)) + ' + 'SqlDeleteCommand1 + ' + Me.SqlDeleteCommand1.CommandText = "DELETE FROM publishers WHERE (pub_id = @Original_pub_id) AND (city = @Original_ci" & _ + "ty OR @Original_city IS NULL AND city IS NULL) AND (country = @Original_country " & _ + "OR @Original_country IS NULL AND country IS NULL) AND (pub_name = @Original_pub_" & _ + "name OR @Original_pub_name IS NULL AND pub_name IS NULL) AND (state = @Original_" & _ + "state OR @Original_state IS NULL AND state IS NULL)" + Me.SqlDeleteCommand1.Connection = Me.SqlConnection1 + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_id", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_city", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "city", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_country", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "country", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_name", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_name", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_state", System.Data.SqlDbType.VarChar, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "state", System.Data.DataRowVersion.Original, Nothing)) + ' + 'SqlDataAdapter1 + ' + Me.SqlDataAdapter1.DeleteCommand = Me.SqlDeleteCommand1 + Me.SqlDataAdapter1.InsertCommand = Me.SqlInsertCommand1 + Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1 + Me.SqlDataAdapter1.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "publishers", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("pub_id", "pub_id"), New System.Data.Common.DataColumnMapping("pub_name", "pub_name"), New System.Data.Common.DataColumnMapping("city", "city"), New System.Data.Common.DataColumnMapping("state", "state"), New System.Data.Common.DataColumnMapping("country", "country")})}) + Me.SqlDataAdapter1.UpdateCommand = Me.SqlUpdateCommand1 + ' + 'DataSet11 + ' + Me.DataSet11.DataSetName = "DataSet1" + Me.DataSet11.Locale = New System.Globalization.CultureInfo("en-GB") + Me.DataSet11.Namespace = "http://www.tempuri.org/DataSet1.xsd" + CType(Me.DataSet11, System.ComponentModel.ISupportInitialize).EndInit() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + If Not IsPostBack Then + SqlDataAdapter1.Fill(DataSet11) + DataGrid1.DataBind() + End If + End Sub + + Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound + If e.Item.ItemType = ListItemType.Item Or _ + e.Item.ItemType = ListItemType.AlternatingItem Then + If e.Item.Cells(0).Controls.Count > 0 Then + If TypeOf (e.Item.Cells(0).Controls(0)) Is Button Then + Dim btnDelete As Button = CType(e.Item.Cells(0).Controls(0), Button) + btnDelete.Attributes("onclick") = _ + "return confirm('Are you sure you wish to delete this record?');" + End If + End If + End If + End Sub + + Private Sub DataGrid1_DeleteCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.DeleteCommand + lblInfo.Text = "This sample does not actually delete records." + End Sub +End Class diff --git a/Ch4 - Confirm Deletes/_vti_pvt/access.cnf b/Ch4 - Confirm Deletes/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch4 - Confirm Deletes/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch4 - Confirm Deletes/_vti_pvt/deptodoc.btr b/Ch4 - Confirm Deletes/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch4 - Confirm Deletes/_vti_pvt/deptodoc.btr differ diff --git a/Ch4 - Confirm Deletes/_vti_pvt/doctodep.btr b/Ch4 - Confirm Deletes/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch4 - Confirm Deletes/_vti_pvt/doctodep.btr differ diff --git a/Ch4 - Confirm Deletes/_vti_pvt/service.cnf b/Ch4 - Confirm Deletes/_vti_pvt/service.cnf new file mode 100644 index 0000000..bd5697d --- /dev/null +++ b/Ch4 - Confirm Deletes/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|06 Nov 2002 16:40:49 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch4 - Confirm Deletes/_vti_pvt/service.lck b/Ch4 - Confirm Deletes/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch4 - Confirm Deletes/_vti_pvt/services.cnf b/Ch4 - Confirm Deletes/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch4 - Confirm Deletes/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch4 - Confirm Deletes/bin/Ch4 - Confirm Deletes.dll b/Ch4 - Confirm Deletes/bin/Ch4 - Confirm Deletes.dll new file mode 100644 index 0000000..fb95946 Binary files /dev/null and b/Ch4 - Confirm Deletes/bin/Ch4 - Confirm Deletes.dll differ diff --git a/Ch4 - Confirm Deletes/bin/Ch4 - Confirm Deletes.pdb b/Ch4 - Confirm Deletes/bin/Ch4 - Confirm Deletes.pdb new file mode 100644 index 0000000..f97dfd3 Binary files /dev/null and b/Ch4 - Confirm Deletes/bin/Ch4 - Confirm Deletes.pdb differ diff --git a/Ch4 - DataSet from Excel Worksheet/AssemblyInfo.vb b/Ch4 - DataSet from Excel Worksheet/AssemblyInfo.vb new file mode 100644 index 0000000..c02908c --- /dev/null +++ b/Ch4 - DataSet from Excel Worksheet/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch4 - DataSet from Excel Worksheet/Ch4 - DataSet from Excel Worksheet.sln b/Ch4 - DataSet from Excel Worksheet/Ch4 - DataSet from Excel Worksheet.sln new file mode 100644 index 0000000..ae44a95 --- /dev/null +++ b/Ch4 - DataSet from Excel Worksheet/Ch4 - DataSet from Excel Worksheet.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch4 - DataSet from Excel Worksheet", "Ch4 - DataSet from Excel Worksheet.vbproj", "{DD2913E0-FC91-4757-BBE5-B561D07BC644}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {DD2913E0-FC91-4757-BBE5-B561D07BC644}.Debug.ActiveCfg = Debug|.NET + {DD2913E0-FC91-4757-BBE5-B561D07BC644}.Debug.Build.0 = Debug|.NET + {DD2913E0-FC91-4757-BBE5-B561D07BC644}.Release.ActiveCfg = Release|.NET + {DD2913E0-FC91-4757-BBE5-B561D07BC644}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch4 - DataSet from Excel Worksheet/Ch4 - DataSet from Excel Worksheet.suo b/Ch4 - DataSet from Excel Worksheet/Ch4 - DataSet from Excel Worksheet.suo new file mode 100644 index 0000000..9c08f27 Binary files /dev/null and b/Ch4 - DataSet from Excel Worksheet/Ch4 - DataSet from Excel Worksheet.suo differ diff --git a/Ch4 - DataSet from Excel Worksheet/Ch4 - DataSet from Excel Worksheet.vbproj b/Ch4 - DataSet from Excel Worksheet/Ch4 - DataSet from Excel Worksheet.vbproj new file mode 100644 index 0000000..dff5691 --- /dev/null +++ b/Ch4 - DataSet from Excel Worksheet/Ch4 - DataSet from Excel Worksheet.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - DataSet from Excel Worksheet/Ch4 - DataSet from Excel Worksheet.vbproj.user b/Ch4 - DataSet from Excel Worksheet/Ch4 - DataSet from Excel Worksheet.vbproj.user new file mode 100644 index 0000000..c168d10 --- /dev/null +++ b/Ch4 - DataSet from Excel Worksheet/Ch4 - DataSet from Excel Worksheet.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch4 - DataSet from Excel Worksheet/Form1.resx b/Ch4 - DataSet from Excel Worksheet/Form1.resx new file mode 100644 index 0000000..77022f3 --- /dev/null +++ b/Ch4 - DataSet from Excel Worksheet/Form1.resx @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch4 - DataSet from Excel Worksheet/Form1.vb b/Ch4 - DataSet from Excel Worksheet/Form1.vb new file mode 100644 index 0000000..d6eb7a9 --- /dev/null +++ b/Ch4 - DataSet from Excel Worksheet/Form1.vb @@ -0,0 +1,103 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.DataGrid1 = New System.Windows.Forms.DataGrid() + Me.Button1 = New System.Windows.Forms.Button() + CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'DataGrid1 + ' + Me.DataGrid1.DataMember = "" + Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText + Me.DataGrid1.Location = New System.Drawing.Point(64, 24) + Me.DataGrid1.Name = "DataGrid1" + Me.DataGrid1.Size = New System.Drawing.Size(424, 152) + Me.DataGrid1.TabIndex = 0 + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(64, 200) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(424, 32) + Me.Button1.TabIndex = 1 + Me.Button1.Text = "Grab using named ranges" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(560, 262) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1, Me.DataGrid1}) + Me.Name = "Form1" + Me.Text = "Sample Excel Worksheet Reading!" + CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + + End Sub + +#End Region + + Public Function GetDataFromExcel(ByVal FileName As String, _ + ByVal RangeName As String) As System.Data.DataSet + ' Returns a DataSet containing information from + ' RangeName in the passed Excel worksheet + Try + Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ + "Data Source=" & FileName & ";Extended Properties=Excel 8.0;" + Dim objConn As New System.Data.OleDb.OleDbConnection(strConn) + objConn.Open() + ' Create objects ready to grab data + Dim objCmd As New System.Data.OleDb.OleDbCommand( _ + "SELECT * FROM " & RangeName, objConn) + Dim objDA As New System.Data.OleDb.OleDbDataAdapter() + objDA.SelectCommand = objCmd + ' Fill DataSet + Dim objDS As New System.Data.DataSet() + objDA.Fill(objDS) + ' Cleanup and return DataSet + objConn.Close() + Return objDS + Catch + ' Possible errors include Excel file + ' already open and locked, et al. + Return Nothing + End Try + End Function + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + DataGrid1.DataSource = GetDataFromExcel(Application.StartupPath & "\MyTestWorkbook.xls", _ + "SampleNamedRange").Tables(0) + End Sub + +End Class diff --git a/Ch4 - DataSet from Excel Worksheet/Read Me First.txt b/Ch4 - DataSet from Excel Worksheet/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch4 - DataSet from Excel Worksheet/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch4 - DataSet from Excel Worksheet/bin/Ch4 - DataSet from Excel Worksheet.exe b/Ch4 - DataSet from Excel Worksheet/bin/Ch4 - DataSet from Excel Worksheet.exe new file mode 100644 index 0000000..2b11551 Binary files /dev/null and b/Ch4 - DataSet from Excel Worksheet/bin/Ch4 - DataSet from Excel Worksheet.exe differ diff --git a/Ch4 - DataSet from Excel Worksheet/bin/Ch4 - DataSet from Excel Worksheet.exeMyTextWorkbook.xls b/Ch4 - DataSet from Excel Worksheet/bin/Ch4 - DataSet from Excel Worksheet.exeMyTextWorkbook.xls new file mode 100644 index 0000000..5ea6088 Binary files /dev/null and b/Ch4 - DataSet from Excel Worksheet/bin/Ch4 - DataSet from Excel Worksheet.exeMyTextWorkbook.xls differ diff --git a/Ch4 - DataSet from Excel Worksheet/bin/Ch4 - DataSet from Excel Worksheet.pdb b/Ch4 - DataSet from Excel Worksheet/bin/Ch4 - DataSet from Excel Worksheet.pdb new file mode 100644 index 0000000..a1274b9 Binary files /dev/null and b/Ch4 - DataSet from Excel Worksheet/bin/Ch4 - DataSet from Excel Worksheet.pdb differ diff --git a/Ch4 - DataSet from Excel Worksheet/bin/MyTestWorkbook.xls b/Ch4 - DataSet from Excel Worksheet/bin/MyTestWorkbook.xls new file mode 100644 index 0000000..caf1e96 Binary files /dev/null and b/Ch4 - DataSet from Excel Worksheet/bin/MyTestWorkbook.xls differ diff --git a/Ch4 - DataSet from Excel Worksheet/bin/MyTextWorkbook.xls b/Ch4 - DataSet from Excel Worksheet/bin/MyTextWorkbook.xls new file mode 100644 index 0000000..e3253b0 Binary files /dev/null and b/Ch4 - DataSet from Excel Worksheet/bin/MyTextWorkbook.xls differ diff --git a/Ch4 - DataSet from Excel Worksheet/obj/Debug/Ch4 - DataSet from Excel Worksheet.exe b/Ch4 - DataSet from Excel Worksheet/obj/Debug/Ch4 - DataSet from Excel Worksheet.exe new file mode 100644 index 0000000..2b11551 Binary files /dev/null and b/Ch4 - DataSet from Excel Worksheet/obj/Debug/Ch4 - DataSet from Excel Worksheet.exe differ diff --git a/Ch4 - DataSet from Excel Worksheet/obj/Debug/Ch4 - DataSet from Excel Worksheet.pdb b/Ch4 - DataSet from Excel Worksheet/obj/Debug/Ch4 - DataSet from Excel Worksheet.pdb new file mode 100644 index 0000000..a1274b9 Binary files /dev/null and b/Ch4 - DataSet from Excel Worksheet/obj/Debug/Ch4 - DataSet from Excel Worksheet.pdb differ diff --git a/Ch4 - DataSet from Excel Worksheet/obj/Debug/Ch4___DataSet_from_Excel_Worksheet.Form1.resources b/Ch4 - DataSet from Excel Worksheet/obj/Debug/Ch4___DataSet_from_Excel_Worksheet.Form1.resources new file mode 100644 index 0000000..6161de3 Binary files /dev/null and b/Ch4 - DataSet from Excel Worksheet/obj/Debug/Ch4___DataSet_from_Excel_Worksheet.Form1.resources differ diff --git a/Ch4 - Drop Down in Web Grid/AssemblyInfo.vb b/Ch4 - Drop Down in Web Grid/AssemblyInfo.vb new file mode 100644 index 0000000..43f7e09 --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch4 - Drop Down in Web Grid/Ch4 - Drop Down in Web Grid.sln b/Ch4 - Drop Down in Web Grid/Ch4 - Drop Down in Web Grid.sln new file mode 100644 index 0000000..47b6200 --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/Ch4 - Drop Down in Web Grid.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch4 - Drop Down in Web Grid", "http://localhost/Ch4 - Drop Down in Web Grid/Ch4 - Drop Down in Web Grid.vbproj", "{8CFC8E86-4F86-406E-A7A8-3A0149A7F529}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {8CFC8E86-4F86-406E-A7A8-3A0149A7F529}.Debug.ActiveCfg = Debug|.NET + {8CFC8E86-4F86-406E-A7A8-3A0149A7F529}.Debug.Build.0 = Debug|.NET + {8CFC8E86-4F86-406E-A7A8-3A0149A7F529}.Release.ActiveCfg = Release|.NET + {8CFC8E86-4F86-406E-A7A8-3A0149A7F529}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch4 - Drop Down in Web Grid/Ch4 - Drop Down in Web Grid.suo b/Ch4 - Drop Down in Web Grid/Ch4 - Drop Down in Web Grid.suo new file mode 100644 index 0000000..b4af091 Binary files /dev/null and b/Ch4 - Drop Down in Web Grid/Ch4 - Drop Down in Web Grid.suo differ diff --git a/Ch4 - Drop Down in Web Grid/Ch4 - Drop Down in Web Grid.vbproj b/Ch4 - Drop Down in Web Grid/Ch4 - Drop Down in Web Grid.vbproj new file mode 100644 index 0000000..a78ea87 --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/Ch4 - Drop Down in Web Grid.vbproj @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Drop Down in Web Grid/Ch4 - Drop Down in Web Grid.vbproj.webinfo b/Ch4 - Drop Down in Web Grid/Ch4 - Drop Down in Web Grid.vbproj.webinfo new file mode 100644 index 0000000..0608db3 --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/Ch4 - Drop Down in Web Grid.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch4 - Drop Down in Web Grid/Ch4 - Drop Down in Web Grid.vsdisco b/Ch4 - Drop Down in Web Grid/Ch4 - Drop Down in Web Grid.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/Ch4 - Drop Down in Web Grid.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch4 - Drop Down in Web Grid/DataSet1.vb b/Ch4 - Drop Down in Web Grid/DataSet1.vb new file mode 100644 index 0000000..f70665a --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/DataSet1.vb @@ -0,0 +1,778 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version: 1.0.3705.288 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict Off +Option Explicit On + +Imports System +Imports System.Data +Imports System.Runtime.Serialization +Imports System.Xml + + + _ +Public Class DataSet1 + Inherits DataSet + + Private tableemployee As employeeDataTable + + Private tablejobs As jobsDataTable + + Public Sub New() + MyBase.New + Me.InitClass + Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged + AddHandler Me.Tables.CollectionChanged, schemaChangedHandler + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler + End Sub + + Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext) + MyBase.New + Dim strSchema As String = CType(info.GetValue("XmlSchema", GetType(System.String)),String) + If (Not (strSchema) Is Nothing) Then + Dim ds As DataSet = New DataSet + ds.ReadXmlSchema(New XmlTextReader(New System.IO.StringReader(strSchema))) + If (Not (ds.Tables("employee")) Is Nothing) Then + Me.Tables.Add(New employeeDataTable(ds.Tables("employee"))) + End If + If (Not (ds.Tables("jobs")) Is Nothing) Then + Me.Tables.Add(New jobsDataTable(ds.Tables("jobs"))) + End If + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.Namespace = ds.Namespace + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) + Me.InitVars + Else + Me.InitClass + End If + Me.GetSerializationData(info, context) + Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged + AddHandler Me.Tables.CollectionChanged, schemaChangedHandler + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler + End Sub + + _ + Public ReadOnly Property employee As employeeDataTable + Get + Return Me.tableemployee + End Get + End Property + + _ + Public ReadOnly Property jobs As jobsDataTable + Get + Return Me.tablejobs + End Get + End Property + + Public Overrides Function Clone() As DataSet + Dim cln As DataSet1 = CType(MyBase.Clone,DataSet1) + cln.InitVars + Return cln + End Function + + Protected Overrides Function ShouldSerializeTables() As Boolean + Return false + End Function + + Protected Overrides Function ShouldSerializeRelations() As Boolean + Return false + End Function + + Protected Overrides Sub ReadXmlSerializable(ByVal reader As XmlReader) + Me.Reset + Dim ds As DataSet = New DataSet + ds.ReadXml(reader) + If (Not (ds.Tables("employee")) Is Nothing) Then + Me.Tables.Add(New employeeDataTable(ds.Tables("employee"))) + End If + If (Not (ds.Tables("jobs")) Is Nothing) Then + Me.Tables.Add(New jobsDataTable(ds.Tables("jobs"))) + End If + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.Namespace = ds.Namespace + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) + Me.InitVars + End Sub + + Protected Overrides Function GetSchemaSerializable() As System.Xml.Schema.XmlSchema + Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream + Me.WriteXmlSchema(New XmlTextWriter(stream, Nothing)) + stream.Position = 0 + Return System.Xml.Schema.XmlSchema.Read(New XmlTextReader(stream), Nothing) + End Function + + Friend Sub InitVars() + Me.tableemployee = CType(Me.Tables("employee"),employeeDataTable) + If (Not (Me.tableemployee) Is Nothing) Then + Me.tableemployee.InitVars + End If + Me.tablejobs = CType(Me.Tables("jobs"),jobsDataTable) + If (Not (Me.tablejobs) Is Nothing) Then + Me.tablejobs.InitVars + End If + End Sub + + Private Sub InitClass() + Me.DataSetName = "DataSet1" + Me.Prefix = "" + Me.Namespace = "http://www.tempuri.org/DataSet1.xsd" + Me.Locale = New System.Globalization.CultureInfo("en-GB") + Me.CaseSensitive = false + Me.EnforceConstraints = true + Me.tableemployee = New employeeDataTable + Me.Tables.Add(Me.tableemployee) + Me.tablejobs = New jobsDataTable + Me.Tables.Add(Me.tablejobs) + End Sub + + Private Function ShouldSerializeemployee() As Boolean + Return false + End Function + + Private Function ShouldSerializejobs() As Boolean + Return false + End Function + + Private Sub SchemaChanged(ByVal sender As Object, ByVal e As System.ComponentModel.CollectionChangeEventArgs) + If (e.Action = System.ComponentModel.CollectionChangeAction.Remove) Then + Me.InitVars + End If + End Sub + + Public Delegate Sub employeeRowChangeEventHandler(ByVal sender As Object, ByVal e As employeeRowChangeEvent) + + Public Delegate Sub jobsRowChangeEventHandler(ByVal sender As Object, ByVal e As jobsRowChangeEvent) + + _ + Public Class employeeDataTable + Inherits DataTable + Implements System.Collections.IEnumerable + + Private columnemp_id As DataColumn + + Private columnfname As DataColumn + + Private columnminit As DataColumn + + Private columnlname As DataColumn + + Private columnjob_id As DataColumn + + Private columnjob_lvl As DataColumn + + Private columnpub_id As DataColumn + + Private columnhire_date As DataColumn + + Friend Sub New() + MyBase.New("employee") + Me.InitClass + End Sub + + Friend Sub New(ByVal table As DataTable) + MyBase.New(table.TableName) + If (table.CaseSensitive <> table.DataSet.CaseSensitive) Then + Me.CaseSensitive = table.CaseSensitive + End If + If (table.Locale.ToString <> table.DataSet.Locale.ToString) Then + Me.Locale = table.Locale + End If + If (table.Namespace <> table.DataSet.Namespace) Then + Me.Namespace = table.Namespace + End If + Me.Prefix = table.Prefix + Me.MinimumCapacity = table.MinimumCapacity + Me.DisplayExpression = table.DisplayExpression + End Sub + + _ + Public ReadOnly Property Count As Integer + Get + Return Me.Rows.Count + End Get + End Property + + Friend ReadOnly Property emp_idColumn As DataColumn + Get + Return Me.columnemp_id + End Get + End Property + + Friend ReadOnly Property fnameColumn As DataColumn + Get + Return Me.columnfname + End Get + End Property + + Friend ReadOnly Property minitColumn As DataColumn + Get + Return Me.columnminit + End Get + End Property + + Friend ReadOnly Property lnameColumn As DataColumn + Get + Return Me.columnlname + End Get + End Property + + Friend ReadOnly Property job_idColumn As DataColumn + Get + Return Me.columnjob_id + End Get + End Property + + Friend ReadOnly Property job_lvlColumn As DataColumn + Get + Return Me.columnjob_lvl + End Get + End Property + + Friend ReadOnly Property pub_idColumn As DataColumn + Get + Return Me.columnpub_id + End Get + End Property + + Friend ReadOnly Property hire_dateColumn As DataColumn + Get + Return Me.columnhire_date + End Get + End Property + + Public Default ReadOnly Property Item(ByVal index As Integer) As employeeRow + Get + Return CType(Me.Rows(index),employeeRow) + End Get + End Property + + Public Event employeeRowChanged As employeeRowChangeEventHandler + + Public Event employeeRowChanging As employeeRowChangeEventHandler + + Public Event employeeRowDeleted As employeeRowChangeEventHandler + + Public Event employeeRowDeleting As employeeRowChangeEventHandler + + Public Overloads Sub AddemployeeRow(ByVal row As employeeRow) + Me.Rows.Add(row) + End Sub + + Public Overloads Function AddemployeeRow(ByVal emp_id As String, ByVal fname As String, ByVal minit As String, ByVal lname As String, ByVal job_id As Short, ByVal job_lvl As Byte, ByVal pub_id As String, ByVal hire_date As Date) As employeeRow + Dim rowemployeeRow As employeeRow = CType(Me.NewRow,employeeRow) + rowemployeeRow.ItemArray = New Object() {emp_id, fname, minit, lname, job_id, job_lvl, pub_id, hire_date} + Me.Rows.Add(rowemployeeRow) + Return rowemployeeRow + End Function + + Public Function FindByemp_id(ByVal emp_id As String) As employeeRow + Return CType(Me.Rows.Find(New Object() {emp_id}),employeeRow) + End Function + + Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator + Return Me.Rows.GetEnumerator + End Function + + Public Overrides Function Clone() As DataTable + Dim cln As employeeDataTable = CType(MyBase.Clone,employeeDataTable) + cln.InitVars + Return cln + End Function + + Protected Overrides Function CreateInstance() As DataTable + Return New employeeDataTable + End Function + + Friend Sub InitVars() + Me.columnemp_id = Me.Columns("emp_id") + Me.columnfname = Me.Columns("fname") + Me.columnminit = Me.Columns("minit") + Me.columnlname = Me.Columns("lname") + Me.columnjob_id = Me.Columns("job_id") + Me.columnjob_lvl = Me.Columns("job_lvl") + Me.columnpub_id = Me.Columns("pub_id") + Me.columnhire_date = Me.Columns("hire_date") + End Sub + + Private Sub InitClass() + Me.columnemp_id = New DataColumn("emp_id", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnemp_id) + Me.columnfname = New DataColumn("fname", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnfname) + Me.columnminit = New DataColumn("minit", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnminit) + Me.columnlname = New DataColumn("lname", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnlname) + Me.columnjob_id = New DataColumn("job_id", GetType(System.Int16), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnjob_id) + Me.columnjob_lvl = New DataColumn("job_lvl", GetType(System.Byte), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnjob_lvl) + Me.columnpub_id = New DataColumn("pub_id", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnpub_id) + Me.columnhire_date = New DataColumn("hire_date", GetType(System.DateTime), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnhire_date) + Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnemp_id}, true)) + Me.columnemp_id.AllowDBNull = false + Me.columnemp_id.Unique = true + Me.columnfname.AllowDBNull = false + Me.columnlname.AllowDBNull = false + Me.columnjob_id.AllowDBNull = false + Me.columnpub_id.AllowDBNull = false + Me.columnhire_date.AllowDBNull = false + End Sub + + Public Function NewemployeeRow() As employeeRow + Return CType(Me.NewRow,employeeRow) + End Function + + Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow + Return New employeeRow(builder) + End Function + + Protected Overrides Function GetRowType() As System.Type + Return GetType(employeeRow) + End Function + + Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanged(e) + If (Not (Me.employeeRowChangedEvent) Is Nothing) Then + RaiseEvent employeeRowChanged(Me, New employeeRowChangeEvent(CType(e.Row,employeeRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanging(e) + If (Not (Me.employeeRowChangingEvent) Is Nothing) Then + RaiseEvent employeeRowChanging(Me, New employeeRowChangeEvent(CType(e.Row,employeeRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleted(e) + If (Not (Me.employeeRowDeletedEvent) Is Nothing) Then + RaiseEvent employeeRowDeleted(Me, New employeeRowChangeEvent(CType(e.Row,employeeRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleting(e) + If (Not (Me.employeeRowDeletingEvent) Is Nothing) Then + RaiseEvent employeeRowDeleting(Me, New employeeRowChangeEvent(CType(e.Row,employeeRow), e.Action)) + End If + End Sub + + Public Sub RemoveemployeeRow(ByVal row As employeeRow) + Me.Rows.Remove(row) + End Sub + End Class + + _ + Public Class employeeRow + Inherits DataRow + + Private tableemployee As employeeDataTable + + Friend Sub New(ByVal rb As DataRowBuilder) + MyBase.New(rb) + Me.tableemployee = CType(Me.Table,employeeDataTable) + End Sub + + Public Property emp_id As String + Get + Return CType(Me(Me.tableemployee.emp_idColumn),String) + End Get + Set + Me(Me.tableemployee.emp_idColumn) = value + End Set + End Property + + Public Property fname As String + Get + Return CType(Me(Me.tableemployee.fnameColumn),String) + End Get + Set + Me(Me.tableemployee.fnameColumn) = value + End Set + End Property + + Public Property minit As String + Get + Try + Return CType(Me(Me.tableemployee.minitColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tableemployee.minitColumn) = value + End Set + End Property + + Public Property lname As String + Get + Return CType(Me(Me.tableemployee.lnameColumn),String) + End Get + Set + Me(Me.tableemployee.lnameColumn) = value + End Set + End Property + + Public Property job_id As Short + Get + Return CType(Me(Me.tableemployee.job_idColumn),Short) + End Get + Set + Me(Me.tableemployee.job_idColumn) = value + End Set + End Property + + Public Property job_lvl As Byte + Get + Try + Return CType(Me(Me.tableemployee.job_lvlColumn),Byte) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tableemployee.job_lvlColumn) = value + End Set + End Property + + Public Property pub_id As String + Get + Return CType(Me(Me.tableemployee.pub_idColumn),String) + End Get + Set + Me(Me.tableemployee.pub_idColumn) = value + End Set + End Property + + Public Property hire_date As Date + Get + Return CType(Me(Me.tableemployee.hire_dateColumn),Date) + End Get + Set + Me(Me.tableemployee.hire_dateColumn) = value + End Set + End Property + + Public Function IsminitNull() As Boolean + Return Me.IsNull(Me.tableemployee.minitColumn) + End Function + + Public Sub SetminitNull() + Me(Me.tableemployee.minitColumn) = System.Convert.DBNull + End Sub + + Public Function Isjob_lvlNull() As Boolean + Return Me.IsNull(Me.tableemployee.job_lvlColumn) + End Function + + Public Sub Setjob_lvlNull() + Me(Me.tableemployee.job_lvlColumn) = System.Convert.DBNull + End Sub + End Class + + _ + Public Class employeeRowChangeEvent + Inherits EventArgs + + Private eventRow As employeeRow + + Private eventAction As DataRowAction + + Public Sub New(ByVal row As employeeRow, ByVal action As DataRowAction) + MyBase.New + Me.eventRow = row + Me.eventAction = action + End Sub + + Public ReadOnly Property Row As employeeRow + Get + Return Me.eventRow + End Get + End Property + + Public ReadOnly Property Action As DataRowAction + Get + Return Me.eventAction + End Get + End Property + End Class + + _ + Public Class jobsDataTable + Inherits DataTable + Implements System.Collections.IEnumerable + + Private columnjob_id As DataColumn + + Private columnjob_desc As DataColumn + + Private columnmin_lvl As DataColumn + + Private columnmax_lvl As DataColumn + + Friend Sub New() + MyBase.New("jobs") + Me.InitClass + End Sub + + Friend Sub New(ByVal table As DataTable) + MyBase.New(table.TableName) + If (table.CaseSensitive <> table.DataSet.CaseSensitive) Then + Me.CaseSensitive = table.CaseSensitive + End If + If (table.Locale.ToString <> table.DataSet.Locale.ToString) Then + Me.Locale = table.Locale + End If + If (table.Namespace <> table.DataSet.Namespace) Then + Me.Namespace = table.Namespace + End If + Me.Prefix = table.Prefix + Me.MinimumCapacity = table.MinimumCapacity + Me.DisplayExpression = table.DisplayExpression + End Sub + + _ + Public ReadOnly Property Count As Integer + Get + Return Me.Rows.Count + End Get + End Property + + Friend ReadOnly Property job_idColumn As DataColumn + Get + Return Me.columnjob_id + End Get + End Property + + Friend ReadOnly Property job_descColumn As DataColumn + Get + Return Me.columnjob_desc + End Get + End Property + + Friend ReadOnly Property min_lvlColumn As DataColumn + Get + Return Me.columnmin_lvl + End Get + End Property + + Friend ReadOnly Property max_lvlColumn As DataColumn + Get + Return Me.columnmax_lvl + End Get + End Property + + Public Default ReadOnly Property Item(ByVal index As Integer) As jobsRow + Get + Return CType(Me.Rows(index),jobsRow) + End Get + End Property + + Public Event jobsRowChanged As jobsRowChangeEventHandler + + Public Event jobsRowChanging As jobsRowChangeEventHandler + + Public Event jobsRowDeleted As jobsRowChangeEventHandler + + Public Event jobsRowDeleting As jobsRowChangeEventHandler + + Public Overloads Sub AddjobsRow(ByVal row As jobsRow) + Me.Rows.Add(row) + End Sub + + Public Overloads Function AddjobsRow(ByVal job_desc As String, ByVal min_lvl As Byte, ByVal max_lvl As Byte) As jobsRow + Dim rowjobsRow As jobsRow = CType(Me.NewRow,jobsRow) + rowjobsRow.ItemArray = New Object() {Nothing, job_desc, min_lvl, max_lvl} + Me.Rows.Add(rowjobsRow) + Return rowjobsRow + End Function + + Public Function FindByjob_id(ByVal job_id As Short) As jobsRow + Return CType(Me.Rows.Find(New Object() {job_id}),jobsRow) + End Function + + Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator + Return Me.Rows.GetEnumerator + End Function + + Public Overrides Function Clone() As DataTable + Dim cln As jobsDataTable = CType(MyBase.Clone,jobsDataTable) + cln.InitVars + Return cln + End Function + + Protected Overrides Function CreateInstance() As DataTable + Return New jobsDataTable + End Function + + Friend Sub InitVars() + Me.columnjob_id = Me.Columns("job_id") + Me.columnjob_desc = Me.Columns("job_desc") + Me.columnmin_lvl = Me.Columns("min_lvl") + Me.columnmax_lvl = Me.Columns("max_lvl") + End Sub + + Private Sub InitClass() + Me.columnjob_id = New DataColumn("job_id", GetType(System.Int16), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnjob_id) + Me.columnjob_desc = New DataColumn("job_desc", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnjob_desc) + Me.columnmin_lvl = New DataColumn("min_lvl", GetType(System.Byte), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnmin_lvl) + Me.columnmax_lvl = New DataColumn("max_lvl", GetType(System.Byte), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnmax_lvl) + Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnjob_id}, true)) + Me.columnjob_id.AutoIncrement = true + Me.columnjob_id.AllowDBNull = false + Me.columnjob_id.ReadOnly = true + Me.columnjob_id.Unique = true + Me.columnjob_desc.AllowDBNull = false + Me.columnmin_lvl.AllowDBNull = false + Me.columnmax_lvl.AllowDBNull = false + End Sub + + Public Function NewjobsRow() As jobsRow + Return CType(Me.NewRow,jobsRow) + End Function + + Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow + Return New jobsRow(builder) + End Function + + Protected Overrides Function GetRowType() As System.Type + Return GetType(jobsRow) + End Function + + Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanged(e) + If (Not (Me.jobsRowChangedEvent) Is Nothing) Then + RaiseEvent jobsRowChanged(Me, New jobsRowChangeEvent(CType(e.Row,jobsRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanging(e) + If (Not (Me.jobsRowChangingEvent) Is Nothing) Then + RaiseEvent jobsRowChanging(Me, New jobsRowChangeEvent(CType(e.Row,jobsRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleted(e) + If (Not (Me.jobsRowDeletedEvent) Is Nothing) Then + RaiseEvent jobsRowDeleted(Me, New jobsRowChangeEvent(CType(e.Row,jobsRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleting(e) + If (Not (Me.jobsRowDeletingEvent) Is Nothing) Then + RaiseEvent jobsRowDeleting(Me, New jobsRowChangeEvent(CType(e.Row,jobsRow), e.Action)) + End If + End Sub + + Public Sub RemovejobsRow(ByVal row As jobsRow) + Me.Rows.Remove(row) + End Sub + End Class + + _ + Public Class jobsRow + Inherits DataRow + + Private tablejobs As jobsDataTable + + Friend Sub New(ByVal rb As DataRowBuilder) + MyBase.New(rb) + Me.tablejobs = CType(Me.Table,jobsDataTable) + End Sub + + Public Property job_id As Short + Get + Return CType(Me(Me.tablejobs.job_idColumn),Short) + End Get + Set + Me(Me.tablejobs.job_idColumn) = value + End Set + End Property + + Public Property job_desc As String + Get + Return CType(Me(Me.tablejobs.job_descColumn),String) + End Get + Set + Me(Me.tablejobs.job_descColumn) = value + End Set + End Property + + Public Property min_lvl As Byte + Get + Return CType(Me(Me.tablejobs.min_lvlColumn),Byte) + End Get + Set + Me(Me.tablejobs.min_lvlColumn) = value + End Set + End Property + + Public Property max_lvl As Byte + Get + Return CType(Me(Me.tablejobs.max_lvlColumn),Byte) + End Get + Set + Me(Me.tablejobs.max_lvlColumn) = value + End Set + End Property + End Class + + _ + Public Class jobsRowChangeEvent + Inherits EventArgs + + Private eventRow As jobsRow + + Private eventAction As DataRowAction + + Public Sub New(ByVal row As jobsRow, ByVal action As DataRowAction) + MyBase.New + Me.eventRow = row + Me.eventAction = action + End Sub + + Public ReadOnly Property Row As jobsRow + Get + Return Me.eventRow + End Get + End Property + + Public ReadOnly Property Action As DataRowAction + Get + Return Me.eventAction + End Get + End Property + End Class +End Class diff --git a/Ch4 - Drop Down in Web Grid/DataSet1.xsd b/Ch4 - Drop Down in Web Grid/DataSet1.xsd new file mode 100644 index 0000000..cfe1593 --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/DataSet1.xsd @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ch4 - Drop Down in Web Grid/DataSet1.xsx b/Ch4 - Drop Down in Web Grid/DataSet1.xsx new file mode 100644 index 0000000..a2034e0 --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/DataSet1.xsx @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Ch4 - Drop Down in Web Grid/Global.asax b/Ch4 - Drop Down in Web Grid/Global.asax new file mode 100644 index 0000000..c77eb99 --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch4___Drop_Down_in_Web_Grid.Global" %> \ No newline at end of file diff --git a/Ch4 - Drop Down in Web Grid/Global.asax.resx b/Ch4 - Drop Down in Web Grid/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch4 - Drop Down in Web Grid/Global.asax.vb b/Ch4 - Drop Down in Web Grid/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch4 - Drop Down in Web Grid/Read Me First.txt b/Ch4 - Drop Down in Web Grid/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch4 - Drop Down in Web Grid/Styles.css b/Ch4 - Drop Down in Web Grid/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch4 - Drop Down in Web Grid/Web.config b/Ch4 - Drop Down in Web Grid/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Drop Down in Web Grid/WebForm1.aspx b/Ch4 - Drop Down in Web Grid/WebForm1.aspx new file mode 100644 index 0000000..a4daebf --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/WebForm1.aspx @@ -0,0 +1,43 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch4___Drop_Down_in_Web_Grid.WebForm1"%> + + + + WebForm1 + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/Ch4 - Drop Down in Web Grid/WebForm1.aspx.resx b/Ch4 - Drop Down in Web Grid/WebForm1.aspx.resx new file mode 100644 index 0000000..3528fc9 --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/WebForm1.aspx.resx @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + 17, 17 + + + False + + + 301, 17 + + + False + + + 17, 17 + + + False + + + False + + + 17, 17 + + + False + + + False + + + 17, 17 + + + False + + + 17, 17 + + + 429, 17 + + + False + + + 17, 17 + + + False + + + False + + + 17, 17 + + + False + + + False + + + 17, 17 + + + False + + + False + + + 17, 17 + + + False + + + 163, 17 + + \ No newline at end of file diff --git a/Ch4 - Drop Down in Web Grid/WebForm1.aspx.vb b/Ch4 - Drop Down in Web Grid/WebForm1.aspx.vb new file mode 100644 index 0000000..4457681 --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/WebForm1.aspx.vb @@ -0,0 +1,282 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlUpdateCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlDeleteCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection + Protected WithEvents SqlSelectCommand2 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlInsertCommand2 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlUpdateCommand2 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlDeleteCommand2 As System.Data.SqlClient.SqlCommand + Protected WithEvents ChildDataAdapter As System.Data.SqlClient.SqlDataAdapter + Protected WithEvents ParentDataAdapter As System.Data.SqlClient.SqlDataAdapter + Protected WithEvents MyDataGrid As System.Web.UI.WebControls.DataGrid + Protected WithEvents MyDataSet As Ch4___Drop_Down_in_Web_Grid.DataSet1 + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection() + Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand() + Me.ParentDataAdapter = New System.Data.SqlClient.SqlDataAdapter() + Me.MyDataSet = New Ch4___Drop_Down_in_Web_Grid.DataSet1() + Me.SqlSelectCommand2 = New System.Data.SqlClient.SqlCommand() + Me.SqlInsertCommand2 = New System.Data.SqlClient.SqlCommand() + Me.SqlUpdateCommand2 = New System.Data.SqlClient.SqlCommand() + Me.SqlDeleteCommand2 = New System.Data.SqlClient.SqlCommand() + Me.ChildDataAdapter = New System.Data.SqlClient.SqlDataAdapter() + CType(Me.MyDataSet, System.ComponentModel.ISupportInitialize).BeginInit() + ' + 'SqlSelectCommand1 + ' + Me.SqlSelectCommand1.CommandText = "SELECT emp_id, fname, minit, lname, job_id, job_lvl, pub_id, hire_date FROM emplo" & _ + "yee" + Me.SqlSelectCommand1.Connection = Me.SqlConnection1 + ' + 'SqlConnection1 + ' + Me.SqlConnection1.ConnectionString = "data source=.;initial catalog=pubs;persist security info=False;user id=sa;packet " & _ + "size=4096;password=;" + ' + 'SqlInsertCommand1 + ' + Me.SqlInsertCommand1.CommandText = "INSERT INTO employee(emp_id, fname, minit, lname, job_id, job_lvl, pub_id, hire_d" & _ + "ate) VALUES (@emp_id, @fname, @minit, @lname, @job_id, @job_lvl, @pub_id, @hire_" & _ + "date); SELECT emp_id, fname, minit, lname, job_id, job_lvl, pub_id, hire_date FR" & _ + "OM employee WHERE (emp_id = @emp_id)" + Me.SqlInsertCommand1.Connection = Me.SqlConnection1 + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@emp_id", System.Data.SqlDbType.VarChar, 9, "emp_id")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@fname", System.Data.SqlDbType.VarChar, 20, "fname")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@minit", System.Data.SqlDbType.VarChar, 1, "minit")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@lname", System.Data.SqlDbType.VarChar, 30, "lname")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@job_id", System.Data.SqlDbType.SmallInt, 2, "job_id")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@job_lvl", System.Data.SqlDbType.TinyInt, 1, "job_lvl")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_id", System.Data.SqlDbType.VarChar, 4, "pub_id")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@hire_date", System.Data.SqlDbType.DateTime, 8, "hire_date")) + ' + 'SqlUpdateCommand1 + ' + Me.SqlUpdateCommand1.CommandText = "UPDATE employee SET emp_id = @emp_id, fname = @fname, minit = @minit, lname = @ln" & _ + "ame, job_id = @job_id, job_lvl = @job_lvl, pub_id = @pub_id, hire_date = @hire_d" & _ + "ate WHERE (emp_id = @Original_emp_id) AND (fname = @Original_fname) AND (hire_da" & _ + "te = @Original_hire_date) AND (job_id = @Original_job_id) AND (job_lvl = @Origin" & _ + "al_job_lvl OR @Original_job_lvl IS NULL AND job_lvl IS NULL) AND (lname = @Origi" & _ + "nal_lname) AND (minit = @Original_minit OR @Original_minit IS NULL AND minit IS " & _ + "NULL) AND (pub_id = @Original_pub_id); SELECT emp_id, fname, minit, lname, job_i" & _ + "d, job_lvl, pub_id, hire_date FROM employee WHERE (emp_id = @emp_id)" + Me.SqlUpdateCommand1.Connection = Me.SqlConnection1 + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@emp_id", System.Data.SqlDbType.VarChar, 9, "emp_id")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@fname", System.Data.SqlDbType.VarChar, 20, "fname")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@minit", System.Data.SqlDbType.VarChar, 1, "minit")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@lname", System.Data.SqlDbType.VarChar, 30, "lname")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@job_id", System.Data.SqlDbType.SmallInt, 2, "job_id")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@job_lvl", System.Data.SqlDbType.TinyInt, 1, "job_lvl")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_id", System.Data.SqlDbType.VarChar, 4, "pub_id")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@hire_date", System.Data.SqlDbType.DateTime, 8, "hire_date")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_emp_id", System.Data.SqlDbType.VarChar, 9, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "emp_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_fname", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "fname", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_hire_date", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "hire_date", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_job_id", System.Data.SqlDbType.SmallInt, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "job_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_job_lvl", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "job_lvl", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_lname", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "lname", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_minit", System.Data.SqlDbType.VarChar, 1, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "minit", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_id", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_id", System.Data.DataRowVersion.Original, Nothing)) + ' + 'SqlDeleteCommand1 + ' + Me.SqlDeleteCommand1.CommandText = "DELETE FROM employee WHERE (emp_id = @Original_emp_id) AND (fname = @Original_fna" & _ + "me) AND (hire_date = @Original_hire_date) AND (job_id = @Original_job_id) AND (j" & _ + "ob_lvl = @Original_job_lvl OR @Original_job_lvl IS NULL AND job_lvl IS NULL) AND" & _ + " (lname = @Original_lname) AND (minit = @Original_minit OR @Original_minit IS NU" & _ + "LL AND minit IS NULL) AND (pub_id = @Original_pub_id)" + Me.SqlDeleteCommand1.Connection = Me.SqlConnection1 + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_emp_id", System.Data.SqlDbType.VarChar, 9, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "emp_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_fname", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "fname", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_hire_date", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "hire_date", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_job_id", System.Data.SqlDbType.SmallInt, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "job_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_job_lvl", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "job_lvl", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_lname", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "lname", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_minit", System.Data.SqlDbType.VarChar, 1, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "minit", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_id", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_id", System.Data.DataRowVersion.Original, Nothing)) + ' + 'ParentDataAdapter + ' + Me.ParentDataAdapter.DeleteCommand = Me.SqlDeleteCommand1 + Me.ParentDataAdapter.InsertCommand = Me.SqlInsertCommand1 + Me.ParentDataAdapter.SelectCommand = Me.SqlSelectCommand1 + Me.ParentDataAdapter.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "employee", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("emp_id", "emp_id"), New System.Data.Common.DataColumnMapping("fname", "fname"), New System.Data.Common.DataColumnMapping("minit", "minit"), New System.Data.Common.DataColumnMapping("lname", "lname"), New System.Data.Common.DataColumnMapping("job_id", "job_id"), New System.Data.Common.DataColumnMapping("job_lvl", "job_lvl"), New System.Data.Common.DataColumnMapping("pub_id", "pub_id"), New System.Data.Common.DataColumnMapping("hire_date", "hire_date")})}) + Me.ParentDataAdapter.UpdateCommand = Me.SqlUpdateCommand1 + ' + 'MyDataSet + ' + Me.MyDataSet.DataSetName = "DataSet1" + Me.MyDataSet.Locale = New System.Globalization.CultureInfo("en-GB") + Me.MyDataSet.Namespace = "http://www.tempuri.org/DataSet1.xsd" + ' + 'SqlSelectCommand2 + ' + Me.SqlSelectCommand2.CommandText = "SELECT job_id, job_desc, min_lvl, max_lvl FROM jobs" + Me.SqlSelectCommand2.Connection = Me.SqlConnection1 + ' + 'SqlInsertCommand2 + ' + Me.SqlInsertCommand2.CommandText = "INSERT INTO jobs(job_desc, min_lvl, max_lvl) VALUES (@job_desc, @min_lvl, @max_lv" & _ + "l); SELECT job_id, job_desc, min_lvl, max_lvl FROM jobs WHERE (job_id = @@IDENTI" & _ + "TY)" + Me.SqlInsertCommand2.Connection = Me.SqlConnection1 + Me.SqlInsertCommand2.Parameters.Add(New System.Data.SqlClient.SqlParameter("@job_desc", System.Data.SqlDbType.VarChar, 50, "job_desc")) + Me.SqlInsertCommand2.Parameters.Add(New System.Data.SqlClient.SqlParameter("@min_lvl", System.Data.SqlDbType.TinyInt, 1, "min_lvl")) + Me.SqlInsertCommand2.Parameters.Add(New System.Data.SqlClient.SqlParameter("@max_lvl", System.Data.SqlDbType.TinyInt, 1, "max_lvl")) + ' + 'SqlUpdateCommand2 + ' + Me.SqlUpdateCommand2.CommandText = "UPDATE jobs SET job_desc = @job_desc, min_lvl = @min_lvl, max_lvl = @max_lvl WHER" & _ + "E (job_id = @Original_job_id) AND (job_desc = @Original_job_desc) AND (max_lvl =" & _ + " @Original_max_lvl) AND (min_lvl = @Original_min_lvl); SELECT job_id, job_desc, " & _ + "min_lvl, max_lvl FROM jobs WHERE (job_id = @job_id)" + Me.SqlUpdateCommand2.Connection = Me.SqlConnection1 + Me.SqlUpdateCommand2.Parameters.Add(New System.Data.SqlClient.SqlParameter("@job_desc", System.Data.SqlDbType.VarChar, 50, "job_desc")) + Me.SqlUpdateCommand2.Parameters.Add(New System.Data.SqlClient.SqlParameter("@min_lvl", System.Data.SqlDbType.TinyInt, 1, "min_lvl")) + Me.SqlUpdateCommand2.Parameters.Add(New System.Data.SqlClient.SqlParameter("@max_lvl", System.Data.SqlDbType.TinyInt, 1, "max_lvl")) + Me.SqlUpdateCommand2.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_job_id", System.Data.SqlDbType.SmallInt, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "job_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand2.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_job_desc", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "job_desc", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand2.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_max_lvl", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "max_lvl", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand2.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_min_lvl", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "min_lvl", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand2.Parameters.Add(New System.Data.SqlClient.SqlParameter("@job_id", System.Data.SqlDbType.SmallInt, 2, "job_id")) + ' + 'SqlDeleteCommand2 + ' + Me.SqlDeleteCommand2.CommandText = "DELETE FROM jobs WHERE (job_id = @Original_job_id) AND (job_desc = @Original_job_" & _ + "desc) AND (max_lvl = @Original_max_lvl) AND (min_lvl = @Original_min_lvl)" + Me.SqlDeleteCommand2.Connection = Me.SqlConnection1 + Me.SqlDeleteCommand2.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_job_id", System.Data.SqlDbType.SmallInt, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "job_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand2.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_job_desc", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "job_desc", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand2.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_max_lvl", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "max_lvl", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand2.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_min_lvl", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "min_lvl", System.Data.DataRowVersion.Original, Nothing)) + ' + 'ChildDataAdapter + ' + Me.ChildDataAdapter.DeleteCommand = Me.SqlDeleteCommand2 + Me.ChildDataAdapter.InsertCommand = Me.SqlInsertCommand2 + Me.ChildDataAdapter.SelectCommand = Me.SqlSelectCommand2 + Me.ChildDataAdapter.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "jobs", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("job_id", "job_id"), New System.Data.Common.DataColumnMapping("job_desc", "job_desc"), New System.Data.Common.DataColumnMapping("min_lvl", "min_lvl"), New System.Data.Common.DataColumnMapping("max_lvl", "max_lvl")})}) + Me.ChildDataAdapter.UpdateCommand = Me.SqlUpdateCommand2 + CType(Me.MyDataSet, System.ComponentModel.ISupportInitialize).EndInit() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + ' Do initial data fill + If Not IsPostBack Then + ParentDataAdapter.Fill(MyDataSet) + ChildDataAdapter.Fill(MyDataSet) + MyDataGrid.DataBind() + End If + End Sub + + Private Sub MyDataGrid_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles MyDataGrid.ItemDataBound + ' If this is a valid item... + If e.Item.ItemType = ListItemType.AlternatingItem Or _ + e.Item.ItemType = ListItemType.Item Then + ' Find the dropdown containing our list of options + Dim ddl As DropDownList = _ + CType(e.Item.FindControl("ddl1"), DropDownList) + ' Retrieve the foreign key value + Dim intForeignKey As Integer = _ + e.Item.Cells(5).Text + ' Select the correct entry in the dropdown + ddl.SelectedIndex = _ + ddl.Items.IndexOf( _ + ddl.Items.FindByValue(intForeignKey)) + End If + End Sub + + Private Sub MyDataGrid_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles MyDataGrid.EditCommand + ' Select the current row for 'edit mode' + MyDataGrid.EditItemIndex = e.Item.ItemIndex + ' Refill DataSets with information + ParentDataAdapter.Fill(MyDataSet) + ChildDataAdapter.Fill(MyDataSet) + ' Rebind data + MyDataGrid.DataBind() + ' Select default dropdown option, as earlier + Dim ddl As DropDownList = _ + CType(MyDataGrid.Items(MyDataGrid.EditItemIndex). _ + FindControl("ddl2"), DropDownList) + ddl.SelectedIndex = _ + ddl.Items.IndexOf( _ + ddl.Items.FindByValue(e.Item.Cells(5).Text)) + End Sub + + Private Sub MyDataGrid_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles MyDataGrid.UpdateCommand + + ' This event runs when the Update button is clicked + + ' Step one: Put dropdown list value into foreign key field + CType(e.Item.Cells(5).Controls(0), TextBox).Text = _ + CType(e.Item.FindControl("ddl2"), DropDownList).SelectedItem.Value() + + ' Step two: Fill DataSet and identify row to edit + ParentDataAdapter.Fill(MyDataSet) + ChildDataAdapter.Fill(MyDataSet) + Dim objEditedRow As DataRow = MyDataSet.Tables(0).Rows.Find( _ + CType(e.Item.Cells(1).Controls(0), TextBox).Text) + + ' Step three: Cycle through valid "data" cells and put + ' information back in underlying DataSet + Dim intCount As Integer + For intCount = 0 To e.Item.Cells.Count - 1 + If e.Item.Cells(intCount).Controls.Count > 0 Then + If TypeOf (e.Item.Cells(intCount).Controls(0)) Is TextBox Then + ' This appears to be a TextBox-holding "data" cell + Dim strValue As String = CType(e.Item.Cells(intCount). _ + Controls(0), TextBox).Text + ' Put value (or null if empty) back into relevant DataSet field + If strValue = "" Then + objEditedRow.Item(MyDataGrid.Columns(intCount). _ + SortExpression) = System.DBNull.Value + Else + objEditedRow.Item(MyDataGrid.Columns(intCount). _ + SortExpression) = strValue + End If + End If + End If + Next + + ' Update backend data + ParentDataAdapter.Update(MyDataSet) + + ' Deselect DataGrid items and rebind + With MyDataGrid + .SelectedIndex = -1 + .EditItemIndex = -1 + .DataSource = MyDataSet + .DataBind() + End With + + End Sub + + Private Sub MyDataGrid_CancelCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles MyDataGrid.CancelCommand + ' This code runs when the Cancel button is clicked + ' It simply resets and rebinds + MyDataGrid.SelectedIndex = -1 + MyDataGrid.EditItemIndex = -1 + ParentDataAdapter.Fill(MyDataSet) + ChildDataAdapter.Fill(MyDataSet) + MyDataGrid.DataBind() + End Sub + +End Class diff --git a/Ch4 - Drop Down in Web Grid/_vti_pvt/access.cnf b/Ch4 - Drop Down in Web Grid/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch4 - Drop Down in Web Grid/_vti_pvt/deptodoc.btr b/Ch4 - Drop Down in Web Grid/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch4 - Drop Down in Web Grid/_vti_pvt/deptodoc.btr differ diff --git a/Ch4 - Drop Down in Web Grid/_vti_pvt/doctodep.btr b/Ch4 - Drop Down in Web Grid/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..59a41f4 Binary files /dev/null and b/Ch4 - Drop Down in Web Grid/_vti_pvt/doctodep.btr differ diff --git a/Ch4 - Drop Down in Web Grid/_vti_pvt/service.cnf b/Ch4 - Drop Down in Web Grid/_vti_pvt/service.cnf new file mode 100644 index 0000000..28123a5 --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|06 Nov 2002 19:14:40 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch4 - Drop Down in Web Grid/_vti_pvt/service.lck b/Ch4 - Drop Down in Web Grid/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch4 - Drop Down in Web Grid/_vti_pvt/services.cnf b/Ch4 - Drop Down in Web Grid/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch4 - Drop Down in Web Grid/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch4 - Drop Down in Web Grid/bin/Ch4 - Drop Down in Web Grid.dll b/Ch4 - Drop Down in Web Grid/bin/Ch4 - Drop Down in Web Grid.dll new file mode 100644 index 0000000..9b5e944 Binary files /dev/null and b/Ch4 - Drop Down in Web Grid/bin/Ch4 - Drop Down in Web Grid.dll differ diff --git a/Ch4 - Drop Down in Web Grid/bin/Ch4 - Drop Down in Web Grid.pdb b/Ch4 - Drop Down in Web Grid/bin/Ch4 - Drop Down in Web Grid.pdb new file mode 100644 index 0000000..6194a4e Binary files /dev/null and b/Ch4 - Drop Down in Web Grid/bin/Ch4 - Drop Down in Web Grid.pdb differ diff --git a/Ch4 - Export to Excel/AssemblyInfo.vb b/Ch4 - Export to Excel/AssemblyInfo.vb new file mode 100644 index 0000000..37362cd --- /dev/null +++ b/Ch4 - Export to Excel/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch4 - Export to Excel/Ch4 - Export to Excel.sln b/Ch4 - Export to Excel/Ch4 - Export to Excel.sln new file mode 100644 index 0000000..3d7b8e8 --- /dev/null +++ b/Ch4 - Export to Excel/Ch4 - Export to Excel.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch4 - Export to Excel", "http://localhost/Ch4 - Export to Excel/Ch4 - Export to Excel.vbproj", "{1382B20B-0422-4A61-B157-BBEF709758D0}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {1382B20B-0422-4A61-B157-BBEF709758D0}.Debug.ActiveCfg = Debug|.NET + {1382B20B-0422-4A61-B157-BBEF709758D0}.Debug.Build.0 = Debug|.NET + {1382B20B-0422-4A61-B157-BBEF709758D0}.Release.ActiveCfg = Release|.NET + {1382B20B-0422-4A61-B157-BBEF709758D0}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch4 - Export to Excel/Ch4 - Export to Excel.suo b/Ch4 - Export to Excel/Ch4 - Export to Excel.suo new file mode 100644 index 0000000..05fc07e Binary files /dev/null and b/Ch4 - Export to Excel/Ch4 - Export to Excel.suo differ diff --git a/Ch4 - Export to Excel/Ch4 - Export to Excel.vbproj b/Ch4 - Export to Excel/Ch4 - Export to Excel.vbproj new file mode 100644 index 0000000..8a66497 --- /dev/null +++ b/Ch4 - Export to Excel/Ch4 - Export to Excel.vbproj @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Export to Excel/Ch4 - Export to Excel.vbproj.webinfo b/Ch4 - Export to Excel/Ch4 - Export to Excel.vbproj.webinfo new file mode 100644 index 0000000..8ce8d34 --- /dev/null +++ b/Ch4 - Export to Excel/Ch4 - Export to Excel.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch4 - Export to Excel/Ch4 - Export to Excel.vsdisco b/Ch4 - Export to Excel/Ch4 - Export to Excel.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch4 - Export to Excel/Ch4 - Export to Excel.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch4 - Export to Excel/DataSet1.vb b/Ch4 - Export to Excel/DataSet1.vb new file mode 100644 index 0000000..ae2c350 --- /dev/null +++ b/Ch4 - Export to Excel/DataSet1.vb @@ -0,0 +1,455 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version: 1.0.3705.288 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict Off +Option Explicit On + +Imports System +Imports System.Data +Imports System.Runtime.Serialization +Imports System.Xml + + + _ +Public Class DataSet1 + Inherits DataSet + + Private tablepublishers As publishersDataTable + + Public Sub New() + MyBase.New + Me.InitClass + Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged + AddHandler Me.Tables.CollectionChanged, schemaChangedHandler + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler + End Sub + + Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext) + MyBase.New + Dim strSchema As String = CType(info.GetValue("XmlSchema", GetType(System.String)),String) + If (Not (strSchema) Is Nothing) Then + Dim ds As DataSet = New DataSet + ds.ReadXmlSchema(New XmlTextReader(New System.IO.StringReader(strSchema))) + If (Not (ds.Tables("publishers")) Is Nothing) Then + Me.Tables.Add(New publishersDataTable(ds.Tables("publishers"))) + End If + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.Namespace = ds.Namespace + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) + Me.InitVars + Else + Me.InitClass + End If + Me.GetSerializationData(info, context) + Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged + AddHandler Me.Tables.CollectionChanged, schemaChangedHandler + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler + End Sub + + _ + Public ReadOnly Property publishers As publishersDataTable + Get + Return Me.tablepublishers + End Get + End Property + + Public Overrides Function Clone() As DataSet + Dim cln As DataSet1 = CType(MyBase.Clone,DataSet1) + cln.InitVars + Return cln + End Function + + Protected Overrides Function ShouldSerializeTables() As Boolean + Return false + End Function + + Protected Overrides Function ShouldSerializeRelations() As Boolean + Return false + End Function + + Protected Overrides Sub ReadXmlSerializable(ByVal reader As XmlReader) + Me.Reset + Dim ds As DataSet = New DataSet + ds.ReadXml(reader) + If (Not (ds.Tables("publishers")) Is Nothing) Then + Me.Tables.Add(New publishersDataTable(ds.Tables("publishers"))) + End If + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.Namespace = ds.Namespace + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) + Me.InitVars + End Sub + + Protected Overrides Function GetSchemaSerializable() As System.Xml.Schema.XmlSchema + Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream + Me.WriteXmlSchema(New XmlTextWriter(stream, Nothing)) + stream.Position = 0 + Return System.Xml.Schema.XmlSchema.Read(New XmlTextReader(stream), Nothing) + End Function + + Friend Sub InitVars() + Me.tablepublishers = CType(Me.Tables("publishers"),publishersDataTable) + If (Not (Me.tablepublishers) Is Nothing) Then + Me.tablepublishers.InitVars + End If + End Sub + + Private Sub InitClass() + Me.DataSetName = "DataSet1" + Me.Prefix = "" + Me.Namespace = "http://www.tempuri.org/DataSet1.xsd" + Me.Locale = New System.Globalization.CultureInfo("en-GB") + Me.CaseSensitive = false + Me.EnforceConstraints = true + Me.tablepublishers = New publishersDataTable + Me.Tables.Add(Me.tablepublishers) + End Sub + + Private Function ShouldSerializepublishers() As Boolean + Return false + End Function + + Private Sub SchemaChanged(ByVal sender As Object, ByVal e As System.ComponentModel.CollectionChangeEventArgs) + If (e.Action = System.ComponentModel.CollectionChangeAction.Remove) Then + Me.InitVars + End If + End Sub + + Public Delegate Sub publishersRowChangeEventHandler(ByVal sender As Object, ByVal e As publishersRowChangeEvent) + + _ + Public Class publishersDataTable + Inherits DataTable + Implements System.Collections.IEnumerable + + Private columnpub_id As DataColumn + + Private columnpub_name As DataColumn + + Private columncity As DataColumn + + Private columnstate As DataColumn + + Private columncountry As DataColumn + + Friend Sub New() + MyBase.New("publishers") + Me.InitClass + End Sub + + Friend Sub New(ByVal table As DataTable) + MyBase.New(table.TableName) + If (table.CaseSensitive <> table.DataSet.CaseSensitive) Then + Me.CaseSensitive = table.CaseSensitive + End If + If (table.Locale.ToString <> table.DataSet.Locale.ToString) Then + Me.Locale = table.Locale + End If + If (table.Namespace <> table.DataSet.Namespace) Then + Me.Namespace = table.Namespace + End If + Me.Prefix = table.Prefix + Me.MinimumCapacity = table.MinimumCapacity + Me.DisplayExpression = table.DisplayExpression + End Sub + + _ + Public ReadOnly Property Count As Integer + Get + Return Me.Rows.Count + End Get + End Property + + Friend ReadOnly Property pub_idColumn As DataColumn + Get + Return Me.columnpub_id + End Get + End Property + + Friend ReadOnly Property pub_nameColumn As DataColumn + Get + Return Me.columnpub_name + End Get + End Property + + Friend ReadOnly Property cityColumn As DataColumn + Get + Return Me.columncity + End Get + End Property + + Friend ReadOnly Property stateColumn As DataColumn + Get + Return Me.columnstate + End Get + End Property + + Friend ReadOnly Property countryColumn As DataColumn + Get + Return Me.columncountry + End Get + End Property + + Public Default ReadOnly Property Item(ByVal index As Integer) As publishersRow + Get + Return CType(Me.Rows(index),publishersRow) + End Get + End Property + + Public Event publishersRowChanged As publishersRowChangeEventHandler + + Public Event publishersRowChanging As publishersRowChangeEventHandler + + Public Event publishersRowDeleted As publishersRowChangeEventHandler + + Public Event publishersRowDeleting As publishersRowChangeEventHandler + + Public Overloads Sub AddpublishersRow(ByVal row As publishersRow) + Me.Rows.Add(row) + End Sub + + Public Overloads Function AddpublishersRow(ByVal pub_id As String, ByVal pub_name As String, ByVal city As String, ByVal state As String, ByVal country As String) As publishersRow + Dim rowpublishersRow As publishersRow = CType(Me.NewRow,publishersRow) + rowpublishersRow.ItemArray = New Object() {pub_id, pub_name, city, state, country} + Me.Rows.Add(rowpublishersRow) + Return rowpublishersRow + End Function + + Public Function FindBypub_id(ByVal pub_id As String) As publishersRow + Return CType(Me.Rows.Find(New Object() {pub_id}),publishersRow) + End Function + + Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator + Return Me.Rows.GetEnumerator + End Function + + Public Overrides Function Clone() As DataTable + Dim cln As publishersDataTable = CType(MyBase.Clone,publishersDataTable) + cln.InitVars + Return cln + End Function + + Protected Overrides Function CreateInstance() As DataTable + Return New publishersDataTable + End Function + + Friend Sub InitVars() + Me.columnpub_id = Me.Columns("pub_id") + Me.columnpub_name = Me.Columns("pub_name") + Me.columncity = Me.Columns("city") + Me.columnstate = Me.Columns("state") + Me.columncountry = Me.Columns("country") + End Sub + + Private Sub InitClass() + Me.columnpub_id = New DataColumn("pub_id", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnpub_id) + Me.columnpub_name = New DataColumn("pub_name", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnpub_name) + Me.columncity = New DataColumn("city", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columncity) + Me.columnstate = New DataColumn("state", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnstate) + Me.columncountry = New DataColumn("country", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columncountry) + Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnpub_id}, true)) + Me.columnpub_id.AllowDBNull = false + Me.columnpub_id.Unique = true + End Sub + + Public Function NewpublishersRow() As publishersRow + Return CType(Me.NewRow,publishersRow) + End Function + + Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow + Return New publishersRow(builder) + End Function + + Protected Overrides Function GetRowType() As System.Type + Return GetType(publishersRow) + End Function + + Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanged(e) + If (Not (Me.publishersRowChangedEvent) Is Nothing) Then + RaiseEvent publishersRowChanged(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanging(e) + If (Not (Me.publishersRowChangingEvent) Is Nothing) Then + RaiseEvent publishersRowChanging(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleted(e) + If (Not (Me.publishersRowDeletedEvent) Is Nothing) Then + RaiseEvent publishersRowDeleted(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleting(e) + If (Not (Me.publishersRowDeletingEvent) Is Nothing) Then + RaiseEvent publishersRowDeleting(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Public Sub RemovepublishersRow(ByVal row As publishersRow) + Me.Rows.Remove(row) + End Sub + End Class + + _ + Public Class publishersRow + Inherits DataRow + + Private tablepublishers As publishersDataTable + + Friend Sub New(ByVal rb As DataRowBuilder) + MyBase.New(rb) + Me.tablepublishers = CType(Me.Table,publishersDataTable) + End Sub + + Public Property pub_id As String + Get + Return CType(Me(Me.tablepublishers.pub_idColumn),String) + End Get + Set + Me(Me.tablepublishers.pub_idColumn) = value + End Set + End Property + + Public Property pub_name As String + Get + Try + Return CType(Me(Me.tablepublishers.pub_nameColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.pub_nameColumn) = value + End Set + End Property + + Public Property city As String + Get + Try + Return CType(Me(Me.tablepublishers.cityColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.cityColumn) = value + End Set + End Property + + Public Property state As String + Get + Try + Return CType(Me(Me.tablepublishers.stateColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.stateColumn) = value + End Set + End Property + + Public Property country As String + Get + Try + Return CType(Me(Me.tablepublishers.countryColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.countryColumn) = value + End Set + End Property + + Public Function Ispub_nameNull() As Boolean + Return Me.IsNull(Me.tablepublishers.pub_nameColumn) + End Function + + Public Sub Setpub_nameNull() + Me(Me.tablepublishers.pub_nameColumn) = System.Convert.DBNull + End Sub + + Public Function IscityNull() As Boolean + Return Me.IsNull(Me.tablepublishers.cityColumn) + End Function + + Public Sub SetcityNull() + Me(Me.tablepublishers.cityColumn) = System.Convert.DBNull + End Sub + + Public Function IsstateNull() As Boolean + Return Me.IsNull(Me.tablepublishers.stateColumn) + End Function + + Public Sub SetstateNull() + Me(Me.tablepublishers.stateColumn) = System.Convert.DBNull + End Sub + + Public Function IscountryNull() As Boolean + Return Me.IsNull(Me.tablepublishers.countryColumn) + End Function + + Public Sub SetcountryNull() + Me(Me.tablepublishers.countryColumn) = System.Convert.DBNull + End Sub + End Class + + _ + Public Class publishersRowChangeEvent + Inherits EventArgs + + Private eventRow As publishersRow + + Private eventAction As DataRowAction + + Public Sub New(ByVal row As publishersRow, ByVal action As DataRowAction) + MyBase.New + Me.eventRow = row + Me.eventAction = action + End Sub + + Public ReadOnly Property Row As publishersRow + Get + Return Me.eventRow + End Get + End Property + + Public ReadOnly Property Action As DataRowAction + Get + Return Me.eventAction + End Get + End Property + End Class +End Class diff --git a/Ch4 - Export to Excel/DataSet1.xsd b/Ch4 - Export to Excel/DataSet1.xsd new file mode 100644 index 0000000..651872e --- /dev/null +++ b/Ch4 - Export to Excel/DataSet1.xsd @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ch4 - Export to Excel/Global.asax b/Ch4 - Export to Excel/Global.asax new file mode 100644 index 0000000..508b5d2 --- /dev/null +++ b/Ch4 - Export to Excel/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch4___Export_to_Excel.Global" %> \ No newline at end of file diff --git a/Ch4 - Export to Excel/Global.asax.resx b/Ch4 - Export to Excel/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch4 - Export to Excel/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch4 - Export to Excel/Global.asax.vb b/Ch4 - Export to Excel/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch4 - Export to Excel/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch4 - Export to Excel/Read Me First.txt b/Ch4 - Export to Excel/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch4 - Export to Excel/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch4 - Export to Excel/Styles.css b/Ch4 - Export to Excel/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch4 - Export to Excel/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch4 - Export to Excel/Web.config b/Ch4 - Export to Excel/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch4 - Export to Excel/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Export to Excel/WebForm1.aspx b/Ch4 - Export to Excel/WebForm1.aspx new file mode 100644 index 0000000..09fee3c --- /dev/null +++ b/Ch4 - Export to Excel/WebForm1.aspx @@ -0,0 +1,28 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch4___Export_to_Excel.WebForm1"%> + + + + WebForm1 + + + + + + +
+ + + + + + + + + + + + + +
+ + diff --git a/Ch4 - Export to Excel/WebForm1.aspx.resx b/Ch4 - Export to Excel/WebForm1.aspx.resx new file mode 100644 index 0000000..62e649b --- /dev/null +++ b/Ch4 - Export to Excel/WebForm1.aspx.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + 17, 17 + + + False + + + 145, 17 + + + False + + + 17, 17 + + + False + + + False + + + 17, 17 + + + False + + + False + + + 17, 17 + + + False + + + 17, 17 + + + 280, 17 + + \ No newline at end of file diff --git a/Ch4 - Export to Excel/WebForm1.aspx.vb b/Ch4 - Export to Excel/WebForm1.aspx.vb new file mode 100644 index 0000000..4664467 --- /dev/null +++ b/Ch4 - Export to Excel/WebForm1.aspx.vb @@ -0,0 +1,128 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlUpdateCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlDeleteCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection + Protected WithEvents MyDataAdapter As System.Data.SqlClient.SqlDataAdapter + Protected WithEvents MyDataSet As Ch4___Export_to_Excel.DataSet1 + Protected WithEvents MyDataGrid As System.Web.UI.WebControls.DataGrid + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection() + Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand() + Me.MyDataAdapter = New System.Data.SqlClient.SqlDataAdapter() + Me.MyDataSet = New Ch4___Export_to_Excel.DataSet1() + CType(Me.MyDataSet, System.ComponentModel.ISupportInitialize).BeginInit() + ' + 'SqlSelectCommand1 + ' + Me.SqlSelectCommand1.CommandText = "SELECT pub_id, pub_name, city, state, country FROM publishers" + Me.SqlSelectCommand1.Connection = Me.SqlConnection1 + ' + 'SqlConnection1 + ' + Me.SqlConnection1.ConnectionString = "data source=.;initial catalog=pubs;persist security info=False;user id=sa;packet " & _ + "size=4096;password=;" + ' + 'SqlInsertCommand1 + ' + Me.SqlInsertCommand1.CommandText = "INSERT INTO publishers(pub_id, pub_name, city, state, country) VALUES (@pub_id, @" & _ + "pub_name, @city, @state, @country); SELECT pub_id, pub_name, city, state, countr" & _ + "y FROM publishers WHERE (pub_id = @pub_id)" + Me.SqlInsertCommand1.Connection = Me.SqlConnection1 + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_id", System.Data.SqlDbType.VarChar, 4, "pub_id")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_name", System.Data.SqlDbType.VarChar, 40, "pub_name")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@city", System.Data.SqlDbType.VarChar, 20, "city")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@state", System.Data.SqlDbType.VarChar, 2, "state")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@country", System.Data.SqlDbType.VarChar, 30, "country")) + ' + 'SqlUpdateCommand1 + ' + Me.SqlUpdateCommand1.CommandText = "UPDATE publishers SET pub_id = @pub_id, pub_name = @pub_name, city = @city, state" & _ + " = @state, country = @country WHERE (pub_id = @Original_pub_id) AND (city = @Ori" & _ + "ginal_city OR @Original_city IS NULL AND city IS NULL) AND (country = @Original_" & _ + "country OR @Original_country IS NULL AND country IS NULL) AND (pub_name = @Origi" & _ + "nal_pub_name OR @Original_pub_name IS NULL AND pub_name IS NULL) AND (state = @O" & _ + "riginal_state OR @Original_state IS NULL AND state IS NULL); SELECT pub_id, pub_" & _ + "name, city, state, country FROM publishers WHERE (pub_id = @pub_id)" + Me.SqlUpdateCommand1.Connection = Me.SqlConnection1 + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_id", System.Data.SqlDbType.VarChar, 4, "pub_id")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_name", System.Data.SqlDbType.VarChar, 40, "pub_name")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@city", System.Data.SqlDbType.VarChar, 20, "city")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@state", System.Data.SqlDbType.VarChar, 2, "state")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@country", System.Data.SqlDbType.VarChar, 30, "country")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_id", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_city", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "city", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_country", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "country", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_name", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_name", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_state", System.Data.SqlDbType.VarChar, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "state", System.Data.DataRowVersion.Original, Nothing)) + ' + 'SqlDeleteCommand1 + ' + Me.SqlDeleteCommand1.CommandText = "DELETE FROM publishers WHERE (pub_id = @Original_pub_id) AND (city = @Original_ci" & _ + "ty OR @Original_city IS NULL AND city IS NULL) AND (country = @Original_country " & _ + "OR @Original_country IS NULL AND country IS NULL) AND (pub_name = @Original_pub_" & _ + "name OR @Original_pub_name IS NULL AND pub_name IS NULL) AND (state = @Original_" & _ + "state OR @Original_state IS NULL AND state IS NULL)" + Me.SqlDeleteCommand1.Connection = Me.SqlConnection1 + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_id", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_city", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "city", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_country", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "country", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_name", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_name", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_state", System.Data.SqlDbType.VarChar, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "state", System.Data.DataRowVersion.Original, Nothing)) + ' + 'MyDataAdapter + ' + Me.MyDataAdapter.DeleteCommand = Me.SqlDeleteCommand1 + Me.MyDataAdapter.InsertCommand = Me.SqlInsertCommand1 + Me.MyDataAdapter.SelectCommand = Me.SqlSelectCommand1 + Me.MyDataAdapter.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "publishers", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("pub_id", "pub_id"), New System.Data.Common.DataColumnMapping("pub_name", "pub_name"), New System.Data.Common.DataColumnMapping("city", "city"), New System.Data.Common.DataColumnMapping("state", "state"), New System.Data.Common.DataColumnMapping("country", "country")})}) + Me.MyDataAdapter.UpdateCommand = Me.SqlUpdateCommand1 + ' + 'MyDataSet + ' + Me.MyDataSet.DataSetName = "DataSet1" + Me.MyDataSet.Locale = New System.Globalization.CultureInfo("en-GB") + Me.MyDataSet.Namespace = "http://www.tempuri.org/DataSet1.xsd" + CType(Me.MyDataSet, System.ComponentModel.ISupportInitialize).EndInit() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + ' Put information into your DataGrid, for example: + MyDataAdapter.Fill(MyDataSet) + MyDataGrid.DataSource = MyDataSet.Tables(0) + MyDataGrid.DataBind() + + ' Tell browser this is 'Excel' information + ' and prepare to send down info + Response.ContentType = "application/vnd.ms-excel" + Response.Charset = "" + Me.EnableViewState = False + + ' Get the DataGrid HTML from the control, + ' then write straight to the browser + Dim objSW As New System.IO.StringWriter() + Dim objHTW As New System.Web.UI.HtmlTextWriter(objSW) + MyDataGrid.RenderControl(objHTW) + Response.Write(objSW.ToString()) + Response.End() + End Sub + +End Class diff --git a/Ch4 - Export to Excel/_vti_pvt/access.cnf b/Ch4 - Export to Excel/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch4 - Export to Excel/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch4 - Export to Excel/_vti_pvt/deptodoc.btr b/Ch4 - Export to Excel/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..cc6ca4b Binary files /dev/null and b/Ch4 - Export to Excel/_vti_pvt/deptodoc.btr differ diff --git a/Ch4 - Export to Excel/_vti_pvt/doctodep.btr b/Ch4 - Export to Excel/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch4 - Export to Excel/_vti_pvt/doctodep.btr differ diff --git a/Ch4 - Export to Excel/_vti_pvt/service.cnf b/Ch4 - Export to Excel/_vti_pvt/service.cnf new file mode 100644 index 0000000..c9fcba4 --- /dev/null +++ b/Ch4 - Export to Excel/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|06 Nov 2002 19:07:25 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch4 - Export to Excel/_vti_pvt/service.lck b/Ch4 - Export to Excel/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch4 - Export to Excel/_vti_pvt/services.cnf b/Ch4 - Export to Excel/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch4 - Export to Excel/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch4 - Export to Excel/bin/Ch4 - Export to Excel.dll b/Ch4 - Export to Excel/bin/Ch4 - Export to Excel.dll new file mode 100644 index 0000000..4c40726 Binary files /dev/null and b/Ch4 - Export to Excel/bin/Ch4 - Export to Excel.dll differ diff --git a/Ch4 - Export to Excel/bin/Ch4 - Export to Excel.pdb b/Ch4 - Export to Excel/bin/Ch4 - Export to Excel.pdb new file mode 100644 index 0000000..507ecab Binary files /dev/null and b/Ch4 - Export to Excel/bin/Ch4 - Export to Excel.pdb differ diff --git a/Ch4 - GUIDs/AssemblyInfo.vb b/Ch4 - GUIDs/AssemblyInfo.vb new file mode 100644 index 0000000..ef79c19 --- /dev/null +++ b/Ch4 - GUIDs/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch4 - GUIDs/Ch4 - GUIDs.sln b/Ch4 - GUIDs/Ch4 - GUIDs.sln new file mode 100644 index 0000000..d4c5069 --- /dev/null +++ b/Ch4 - GUIDs/Ch4 - GUIDs.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch4 - GUIDs", "Ch4 - GUIDs.vbproj", "{ABE29566-CEF4-41BF-BD03-7BACADE08759}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {ABE29566-CEF4-41BF-BD03-7BACADE08759}.Debug.ActiveCfg = Debug|.NET + {ABE29566-CEF4-41BF-BD03-7BACADE08759}.Debug.Build.0 = Debug|.NET + {ABE29566-CEF4-41BF-BD03-7BACADE08759}.Release.ActiveCfg = Release|.NET + {ABE29566-CEF4-41BF-BD03-7BACADE08759}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch4 - GUIDs/Ch4 - GUIDs.suo b/Ch4 - GUIDs/Ch4 - GUIDs.suo new file mode 100644 index 0000000..af2feb9 Binary files /dev/null and b/Ch4 - GUIDs/Ch4 - GUIDs.suo differ diff --git a/Ch4 - GUIDs/Ch4 - GUIDs.vbproj b/Ch4 - GUIDs/Ch4 - GUIDs.vbproj new file mode 100644 index 0000000..40cda2a --- /dev/null +++ b/Ch4 - GUIDs/Ch4 - GUIDs.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - GUIDs/Ch4 - GUIDs.vbproj.user b/Ch4 - GUIDs/Ch4 - GUIDs.vbproj.user new file mode 100644 index 0000000..eabb41d --- /dev/null +++ b/Ch4 - GUIDs/Ch4 - GUIDs.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch4 - GUIDs/Form1.resx b/Ch4 - GUIDs/Form1.resx new file mode 100644 index 0000000..e25f8ab --- /dev/null +++ b/Ch4 - GUIDs/Form1.resx @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch4 - GUIDs/Form1.vb b/Ch4 - GUIDs/Form1.vb new file mode 100644 index 0000000..c2e12e4 --- /dev/null +++ b/Ch4 - GUIDs/Form1.vb @@ -0,0 +1,67 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(56, 88) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(200, 40) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Click for a GUID" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(312, 230) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1}) + Me.Name = "Form1" + Me.Text = "Generating GUIDs In a Flash" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + MessageBox.Show(GetGUID) + End Sub + + Public Function GetGUID() As String + ' Returns a new GUID + Return System.Guid.NewGuid.ToString + End Function + +End Class diff --git a/Ch4 - GUIDs/bin/Ch4 - GUIDs.exe b/Ch4 - GUIDs/bin/Ch4 - GUIDs.exe new file mode 100644 index 0000000..dd27506 Binary files /dev/null and b/Ch4 - GUIDs/bin/Ch4 - GUIDs.exe differ diff --git a/Ch4 - GUIDs/bin/Ch4 - GUIDs.pdb b/Ch4 - GUIDs/bin/Ch4 - GUIDs.pdb new file mode 100644 index 0000000..9b31459 Binary files /dev/null and b/Ch4 - GUIDs/bin/Ch4 - GUIDs.pdb differ diff --git a/Ch4 - GUIDs/obj/Debug/Ch4 - GUIDs.exe b/Ch4 - GUIDs/obj/Debug/Ch4 - GUIDs.exe new file mode 100644 index 0000000..dd27506 Binary files /dev/null and b/Ch4 - GUIDs/obj/Debug/Ch4 - GUIDs.exe differ diff --git a/Ch4 - GUIDs/obj/Debug/Ch4 - GUIDs.pdb b/Ch4 - GUIDs/obj/Debug/Ch4 - GUIDs.pdb new file mode 100644 index 0000000..9b31459 Binary files /dev/null and b/Ch4 - GUIDs/obj/Debug/Ch4 - GUIDs.pdb differ diff --git a/Ch4 - GUIDs/obj/Debug/Ch4___GUIDs.Form1.resources b/Ch4 - GUIDs/obj/Debug/Ch4___GUIDs.Form1.resources new file mode 100644 index 0000000..ad3ef8f Binary files /dev/null and b/Ch4 - GUIDs/obj/Debug/Ch4___GUIDs.Form1.resources differ diff --git a/Ch4 - Multiple Tables in DataSet/AssemblyInfo.vb b/Ch4 - Multiple Tables in DataSet/AssemblyInfo.vb new file mode 100644 index 0000000..391abb5 --- /dev/null +++ b/Ch4 - Multiple Tables in DataSet/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch4 - Multiple Tables in DataSet/Ch4 - Multiple Tables in DataSet.sln b/Ch4 - Multiple Tables in DataSet/Ch4 - Multiple Tables in DataSet.sln new file mode 100644 index 0000000..81c5075 --- /dev/null +++ b/Ch4 - Multiple Tables in DataSet/Ch4 - Multiple Tables in DataSet.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch4 - Multiple Tables in DataSet", "Ch4 - Multiple Tables in DataSet.vbproj", "{D4F5096E-8D8D-407F-951C-F0EF5C3C3764}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {D4F5096E-8D8D-407F-951C-F0EF5C3C3764}.Debug.ActiveCfg = Debug|.NET + {D4F5096E-8D8D-407F-951C-F0EF5C3C3764}.Debug.Build.0 = Debug|.NET + {D4F5096E-8D8D-407F-951C-F0EF5C3C3764}.Release.ActiveCfg = Release|.NET + {D4F5096E-8D8D-407F-951C-F0EF5C3C3764}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch4 - Multiple Tables in DataSet/Ch4 - Multiple Tables in DataSet.suo b/Ch4 - Multiple Tables in DataSet/Ch4 - Multiple Tables in DataSet.suo new file mode 100644 index 0000000..108443e Binary files /dev/null and b/Ch4 - Multiple Tables in DataSet/Ch4 - Multiple Tables in DataSet.suo differ diff --git a/Ch4 - Multiple Tables in DataSet/Ch4 - Multiple Tables in DataSet.vbproj b/Ch4 - Multiple Tables in DataSet/Ch4 - Multiple Tables in DataSet.vbproj new file mode 100644 index 0000000..af6371c --- /dev/null +++ b/Ch4 - Multiple Tables in DataSet/Ch4 - Multiple Tables in DataSet.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Multiple Tables in DataSet/Ch4 - Multiple Tables in DataSet.vbproj.user b/Ch4 - Multiple Tables in DataSet/Ch4 - Multiple Tables in DataSet.vbproj.user new file mode 100644 index 0000000..a6e254a --- /dev/null +++ b/Ch4 - Multiple Tables in DataSet/Ch4 - Multiple Tables in DataSet.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch4 - Multiple Tables in DataSet/Form1.resx b/Ch4 - Multiple Tables in DataSet/Form1.resx new file mode 100644 index 0000000..e25f8ab --- /dev/null +++ b/Ch4 - Multiple Tables in DataSet/Form1.resx @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch4 - Multiple Tables in DataSet/Form1.vb b/Ch4 - Multiple Tables in DataSet/Form1.vb new file mode 100644 index 0000000..8f3cac0 --- /dev/null +++ b/Ch4 - Multiple Tables in DataSet/Form1.vb @@ -0,0 +1,106 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(96, 48) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(272, 40) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Click here to retrieve three tables from the local SQL Server ""pubs"" database" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(456, 142) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1}) + Me.Name = "Form1" + Me.Text = "Simple example demonstrating multi-table DataSet!" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + + Dim MyDataSet As New DataSet() + Dim Tables(2) As String + Tables(0) = "authors" : Tables(1) = "sales" : Tables(2) = "titles" + MyDataSet = GetDataSet("data source=localhost;initial catalog=pubs;" & _ + "persist security info=False;user id=sa;pwd=", Tables) + + MessageBox.Show("DataSet successfully populated!") + + End Sub + + Public Function GetDataSet(ByVal ConnectionString As String, _ + ByRef Tables() As String) As System.Data.DataSet + + ' Create connection, command object and empty DataSet + Dim objConn As New System.Data.SqlClient.SqlConnection(ConnectionString) + Dim objCmd As New System.Data.SqlClient.SqlCommand() + objCmd.Connection = objConn + objCmd.CommandType = System.Data.CommandType.Text + Dim objDS As New System.Data.DataSet() + + Try + ' Create new DataAdapter + Dim objDA As New System.Data.SqlClient.SqlDataAdapter(objCmd) + objDA.SelectCommand = objCmd + ' Open connection + objConn.Open() + ' Populate the DataSet with specified tables + Dim intCount As Integer + For intCount = 0 To Tables.GetUpperBound(0) + objCmd.CommandText = "SELECT * FROM " & Tables(intCount) + objDA.Fill(objDS, Tables(intCount)) + Next + + Catch e As Exception + ' Calling code must check for thrown errors + Throw e + + Finally + ' Clean up + objConn.Close() + End Try + + Return objDS + + End Function + +End Class diff --git a/Ch4 - OLE DB Conn String/Click to Generate OLE DB Connection String.vbs b/Ch4 - OLE DB Conn String/Click to Generate OLE DB Connection String.vbs new file mode 100644 index 0000000..58e9190 --- /dev/null +++ b/Ch4 - OLE DB Conn String/Click to Generate OLE DB Connection String.vbs @@ -0,0 +1,10 @@ +Dim objDataLinks, strRetVal +Set objDataLinks = CreateObject("DataLinks") +On Error Resume Next ' ignore cancel +strRetVal = objDataLinks.PromptNew +On Error Goto 0 +If Not IsEmpty(strRetVal) Then +InputBox "Your Connection String is listed below.", _ + "OLE DB Connection String", strRetVal +End If +Set objDataLinks = Nothing diff --git a/Ch4 - Paging/AssemblyInfo.vb b/Ch4 - Paging/AssemblyInfo.vb new file mode 100644 index 0000000..fad41c9 --- /dev/null +++ b/Ch4 - Paging/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch4 - Paging/Ch4 - Paging.sln b/Ch4 - Paging/Ch4 - Paging.sln new file mode 100644 index 0000000..0f52019 --- /dev/null +++ b/Ch4 - Paging/Ch4 - Paging.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch4 - Paging", "http://localhost/Ch4 - Paging/Ch4 - Paging.vbproj", "{47BED780-C213-4040-8537-874D40CD8E3D}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {47BED780-C213-4040-8537-874D40CD8E3D}.Debug.ActiveCfg = Debug|.NET + {47BED780-C213-4040-8537-874D40CD8E3D}.Debug.Build.0 = Debug|.NET + {47BED780-C213-4040-8537-874D40CD8E3D}.Release.ActiveCfg = Release|.NET + {47BED780-C213-4040-8537-874D40CD8E3D}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch4 - Paging/Ch4 - Paging.suo b/Ch4 - Paging/Ch4 - Paging.suo new file mode 100644 index 0000000..848671b Binary files /dev/null and b/Ch4 - Paging/Ch4 - Paging.suo differ diff --git a/Ch4 - Paging/Ch4 - Paging.vbproj b/Ch4 - Paging/Ch4 - Paging.vbproj new file mode 100644 index 0000000..6a1c001 --- /dev/null +++ b/Ch4 - Paging/Ch4 - Paging.vbproj @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Paging/Ch4 - Paging.vbproj.webinfo b/Ch4 - Paging/Ch4 - Paging.vbproj.webinfo new file mode 100644 index 0000000..bae819a --- /dev/null +++ b/Ch4 - Paging/Ch4 - Paging.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch4 - Paging/Ch4 - Paging.vsdisco b/Ch4 - Paging/Ch4 - Paging.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch4 - Paging/Ch4 - Paging.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch4 - Paging/DataSet1.vb b/Ch4 - Paging/DataSet1.vb new file mode 100644 index 0000000..ae2c350 --- /dev/null +++ b/Ch4 - Paging/DataSet1.vb @@ -0,0 +1,455 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version: 1.0.3705.288 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict Off +Option Explicit On + +Imports System +Imports System.Data +Imports System.Runtime.Serialization +Imports System.Xml + + + _ +Public Class DataSet1 + Inherits DataSet + + Private tablepublishers As publishersDataTable + + Public Sub New() + MyBase.New + Me.InitClass + Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged + AddHandler Me.Tables.CollectionChanged, schemaChangedHandler + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler + End Sub + + Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext) + MyBase.New + Dim strSchema As String = CType(info.GetValue("XmlSchema", GetType(System.String)),String) + If (Not (strSchema) Is Nothing) Then + Dim ds As DataSet = New DataSet + ds.ReadXmlSchema(New XmlTextReader(New System.IO.StringReader(strSchema))) + If (Not (ds.Tables("publishers")) Is Nothing) Then + Me.Tables.Add(New publishersDataTable(ds.Tables("publishers"))) + End If + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.Namespace = ds.Namespace + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) + Me.InitVars + Else + Me.InitClass + End If + Me.GetSerializationData(info, context) + Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged + AddHandler Me.Tables.CollectionChanged, schemaChangedHandler + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler + End Sub + + _ + Public ReadOnly Property publishers As publishersDataTable + Get + Return Me.tablepublishers + End Get + End Property + + Public Overrides Function Clone() As DataSet + Dim cln As DataSet1 = CType(MyBase.Clone,DataSet1) + cln.InitVars + Return cln + End Function + + Protected Overrides Function ShouldSerializeTables() As Boolean + Return false + End Function + + Protected Overrides Function ShouldSerializeRelations() As Boolean + Return false + End Function + + Protected Overrides Sub ReadXmlSerializable(ByVal reader As XmlReader) + Me.Reset + Dim ds As DataSet = New DataSet + ds.ReadXml(reader) + If (Not (ds.Tables("publishers")) Is Nothing) Then + Me.Tables.Add(New publishersDataTable(ds.Tables("publishers"))) + End If + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.Namespace = ds.Namespace + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) + Me.InitVars + End Sub + + Protected Overrides Function GetSchemaSerializable() As System.Xml.Schema.XmlSchema + Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream + Me.WriteXmlSchema(New XmlTextWriter(stream, Nothing)) + stream.Position = 0 + Return System.Xml.Schema.XmlSchema.Read(New XmlTextReader(stream), Nothing) + End Function + + Friend Sub InitVars() + Me.tablepublishers = CType(Me.Tables("publishers"),publishersDataTable) + If (Not (Me.tablepublishers) Is Nothing) Then + Me.tablepublishers.InitVars + End If + End Sub + + Private Sub InitClass() + Me.DataSetName = "DataSet1" + Me.Prefix = "" + Me.Namespace = "http://www.tempuri.org/DataSet1.xsd" + Me.Locale = New System.Globalization.CultureInfo("en-GB") + Me.CaseSensitive = false + Me.EnforceConstraints = true + Me.tablepublishers = New publishersDataTable + Me.Tables.Add(Me.tablepublishers) + End Sub + + Private Function ShouldSerializepublishers() As Boolean + Return false + End Function + + Private Sub SchemaChanged(ByVal sender As Object, ByVal e As System.ComponentModel.CollectionChangeEventArgs) + If (e.Action = System.ComponentModel.CollectionChangeAction.Remove) Then + Me.InitVars + End If + End Sub + + Public Delegate Sub publishersRowChangeEventHandler(ByVal sender As Object, ByVal e As publishersRowChangeEvent) + + _ + Public Class publishersDataTable + Inherits DataTable + Implements System.Collections.IEnumerable + + Private columnpub_id As DataColumn + + Private columnpub_name As DataColumn + + Private columncity As DataColumn + + Private columnstate As DataColumn + + Private columncountry As DataColumn + + Friend Sub New() + MyBase.New("publishers") + Me.InitClass + End Sub + + Friend Sub New(ByVal table As DataTable) + MyBase.New(table.TableName) + If (table.CaseSensitive <> table.DataSet.CaseSensitive) Then + Me.CaseSensitive = table.CaseSensitive + End If + If (table.Locale.ToString <> table.DataSet.Locale.ToString) Then + Me.Locale = table.Locale + End If + If (table.Namespace <> table.DataSet.Namespace) Then + Me.Namespace = table.Namespace + End If + Me.Prefix = table.Prefix + Me.MinimumCapacity = table.MinimumCapacity + Me.DisplayExpression = table.DisplayExpression + End Sub + + _ + Public ReadOnly Property Count As Integer + Get + Return Me.Rows.Count + End Get + End Property + + Friend ReadOnly Property pub_idColumn As DataColumn + Get + Return Me.columnpub_id + End Get + End Property + + Friend ReadOnly Property pub_nameColumn As DataColumn + Get + Return Me.columnpub_name + End Get + End Property + + Friend ReadOnly Property cityColumn As DataColumn + Get + Return Me.columncity + End Get + End Property + + Friend ReadOnly Property stateColumn As DataColumn + Get + Return Me.columnstate + End Get + End Property + + Friend ReadOnly Property countryColumn As DataColumn + Get + Return Me.columncountry + End Get + End Property + + Public Default ReadOnly Property Item(ByVal index As Integer) As publishersRow + Get + Return CType(Me.Rows(index),publishersRow) + End Get + End Property + + Public Event publishersRowChanged As publishersRowChangeEventHandler + + Public Event publishersRowChanging As publishersRowChangeEventHandler + + Public Event publishersRowDeleted As publishersRowChangeEventHandler + + Public Event publishersRowDeleting As publishersRowChangeEventHandler + + Public Overloads Sub AddpublishersRow(ByVal row As publishersRow) + Me.Rows.Add(row) + End Sub + + Public Overloads Function AddpublishersRow(ByVal pub_id As String, ByVal pub_name As String, ByVal city As String, ByVal state As String, ByVal country As String) As publishersRow + Dim rowpublishersRow As publishersRow = CType(Me.NewRow,publishersRow) + rowpublishersRow.ItemArray = New Object() {pub_id, pub_name, city, state, country} + Me.Rows.Add(rowpublishersRow) + Return rowpublishersRow + End Function + + Public Function FindBypub_id(ByVal pub_id As String) As publishersRow + Return CType(Me.Rows.Find(New Object() {pub_id}),publishersRow) + End Function + + Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator + Return Me.Rows.GetEnumerator + End Function + + Public Overrides Function Clone() As DataTable + Dim cln As publishersDataTable = CType(MyBase.Clone,publishersDataTable) + cln.InitVars + Return cln + End Function + + Protected Overrides Function CreateInstance() As DataTable + Return New publishersDataTable + End Function + + Friend Sub InitVars() + Me.columnpub_id = Me.Columns("pub_id") + Me.columnpub_name = Me.Columns("pub_name") + Me.columncity = Me.Columns("city") + Me.columnstate = Me.Columns("state") + Me.columncountry = Me.Columns("country") + End Sub + + Private Sub InitClass() + Me.columnpub_id = New DataColumn("pub_id", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnpub_id) + Me.columnpub_name = New DataColumn("pub_name", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnpub_name) + Me.columncity = New DataColumn("city", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columncity) + Me.columnstate = New DataColumn("state", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnstate) + Me.columncountry = New DataColumn("country", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columncountry) + Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnpub_id}, true)) + Me.columnpub_id.AllowDBNull = false + Me.columnpub_id.Unique = true + End Sub + + Public Function NewpublishersRow() As publishersRow + Return CType(Me.NewRow,publishersRow) + End Function + + Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow + Return New publishersRow(builder) + End Function + + Protected Overrides Function GetRowType() As System.Type + Return GetType(publishersRow) + End Function + + Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanged(e) + If (Not (Me.publishersRowChangedEvent) Is Nothing) Then + RaiseEvent publishersRowChanged(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanging(e) + If (Not (Me.publishersRowChangingEvent) Is Nothing) Then + RaiseEvent publishersRowChanging(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleted(e) + If (Not (Me.publishersRowDeletedEvent) Is Nothing) Then + RaiseEvent publishersRowDeleted(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleting(e) + If (Not (Me.publishersRowDeletingEvent) Is Nothing) Then + RaiseEvent publishersRowDeleting(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Public Sub RemovepublishersRow(ByVal row As publishersRow) + Me.Rows.Remove(row) + End Sub + End Class + + _ + Public Class publishersRow + Inherits DataRow + + Private tablepublishers As publishersDataTable + + Friend Sub New(ByVal rb As DataRowBuilder) + MyBase.New(rb) + Me.tablepublishers = CType(Me.Table,publishersDataTable) + End Sub + + Public Property pub_id As String + Get + Return CType(Me(Me.tablepublishers.pub_idColumn),String) + End Get + Set + Me(Me.tablepublishers.pub_idColumn) = value + End Set + End Property + + Public Property pub_name As String + Get + Try + Return CType(Me(Me.tablepublishers.pub_nameColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.pub_nameColumn) = value + End Set + End Property + + Public Property city As String + Get + Try + Return CType(Me(Me.tablepublishers.cityColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.cityColumn) = value + End Set + End Property + + Public Property state As String + Get + Try + Return CType(Me(Me.tablepublishers.stateColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.stateColumn) = value + End Set + End Property + + Public Property country As String + Get + Try + Return CType(Me(Me.tablepublishers.countryColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.countryColumn) = value + End Set + End Property + + Public Function Ispub_nameNull() As Boolean + Return Me.IsNull(Me.tablepublishers.pub_nameColumn) + End Function + + Public Sub Setpub_nameNull() + Me(Me.tablepublishers.pub_nameColumn) = System.Convert.DBNull + End Sub + + Public Function IscityNull() As Boolean + Return Me.IsNull(Me.tablepublishers.cityColumn) + End Function + + Public Sub SetcityNull() + Me(Me.tablepublishers.cityColumn) = System.Convert.DBNull + End Sub + + Public Function IsstateNull() As Boolean + Return Me.IsNull(Me.tablepublishers.stateColumn) + End Function + + Public Sub SetstateNull() + Me(Me.tablepublishers.stateColumn) = System.Convert.DBNull + End Sub + + Public Function IscountryNull() As Boolean + Return Me.IsNull(Me.tablepublishers.countryColumn) + End Function + + Public Sub SetcountryNull() + Me(Me.tablepublishers.countryColumn) = System.Convert.DBNull + End Sub + End Class + + _ + Public Class publishersRowChangeEvent + Inherits EventArgs + + Private eventRow As publishersRow + + Private eventAction As DataRowAction + + Public Sub New(ByVal row As publishersRow, ByVal action As DataRowAction) + MyBase.New + Me.eventRow = row + Me.eventAction = action + End Sub + + Public ReadOnly Property Row As publishersRow + Get + Return Me.eventRow + End Get + End Property + + Public ReadOnly Property Action As DataRowAction + Get + Return Me.eventAction + End Get + End Property + End Class +End Class diff --git a/Ch4 - Paging/DataSet1.xsd b/Ch4 - Paging/DataSet1.xsd new file mode 100644 index 0000000..651872e --- /dev/null +++ b/Ch4 - Paging/DataSet1.xsd @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ch4 - Paging/Global.asax b/Ch4 - Paging/Global.asax new file mode 100644 index 0000000..40ab238 --- /dev/null +++ b/Ch4 - Paging/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch4___Paging.Global" %> \ No newline at end of file diff --git a/Ch4 - Paging/Global.asax.resx b/Ch4 - Paging/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch4 - Paging/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch4 - Paging/Global.asax.vb b/Ch4 - Paging/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch4 - Paging/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch4 - Paging/Read Me First.txt b/Ch4 - Paging/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch4 - Paging/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch4 - Paging/Styles.css b/Ch4 - Paging/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch4 - Paging/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch4 - Paging/Web.config b/Ch4 - Paging/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch4 - Paging/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Paging/WebForm1.aspx b/Ch4 - Paging/WebForm1.aspx new file mode 100644 index 0000000..ab2caf8 --- /dev/null +++ b/Ch4 - Paging/WebForm1.aspx @@ -0,0 +1,22 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch4___Paging.WebForm1"%> + + + + WebForm1 + + + + + + +
+ + + + + + + +
+ + diff --git a/Ch4 - Paging/WebForm1.aspx.resx b/Ch4 - Paging/WebForm1.aspx.resx new file mode 100644 index 0000000..62e649b --- /dev/null +++ b/Ch4 - Paging/WebForm1.aspx.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + 17, 17 + + + False + + + 145, 17 + + + False + + + 17, 17 + + + False + + + False + + + 17, 17 + + + False + + + False + + + 17, 17 + + + False + + + 17, 17 + + + 280, 17 + + \ No newline at end of file diff --git a/Ch4 - Paging/WebForm1.aspx.vb b/Ch4 - Paging/WebForm1.aspx.vb new file mode 100644 index 0000000..a4c8bc0 --- /dev/null +++ b/Ch4 - Paging/WebForm1.aspx.vb @@ -0,0 +1,121 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlUpdateCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlDeleteCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection + Protected WithEvents MyDataGrid As System.Web.UI.WebControls.DataGrid + Protected WithEvents MyDataSet As Ch4___Paging.DataSet1 + Protected WithEvents MyDataAdapter As System.Data.SqlClient.SqlDataAdapter + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection() + Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand() + Me.MyDataAdapter = New System.Data.SqlClient.SqlDataAdapter() + Me.MyDataSet = New Ch4___Paging.DataSet1() + CType(Me.MyDataSet, System.ComponentModel.ISupportInitialize).BeginInit() + ' + 'SqlSelectCommand1 + ' + Me.SqlSelectCommand1.CommandText = "SELECT pub_id, pub_name, city, state, country FROM publishers" + Me.SqlSelectCommand1.Connection = Me.SqlConnection1 + ' + 'SqlConnection1 + ' + Me.SqlConnection1.ConnectionString = "data source=.;initial catalog=pubs;persist security info=False;user id=sa;packet " & _ + "size=4096;password=;" + ' + 'SqlInsertCommand1 + ' + Me.SqlInsertCommand1.CommandText = "INSERT INTO publishers(pub_id, pub_name, city, state, country) VALUES (@pub_id, @" & _ + "pub_name, @city, @state, @country); SELECT pub_id, pub_name, city, state, countr" & _ + "y FROM publishers WHERE (pub_id = @pub_id)" + Me.SqlInsertCommand1.Connection = Me.SqlConnection1 + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_id", System.Data.SqlDbType.VarChar, 4, "pub_id")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_name", System.Data.SqlDbType.VarChar, 40, "pub_name")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@city", System.Data.SqlDbType.VarChar, 20, "city")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@state", System.Data.SqlDbType.VarChar, 2, "state")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@country", System.Data.SqlDbType.VarChar, 30, "country")) + ' + 'SqlUpdateCommand1 + ' + Me.SqlUpdateCommand1.CommandText = "UPDATE publishers SET pub_id = @pub_id, pub_name = @pub_name, city = @city, state" & _ + " = @state, country = @country WHERE (pub_id = @Original_pub_id) AND (city = @Ori" & _ + "ginal_city OR @Original_city IS NULL AND city IS NULL) AND (country = @Original_" & _ + "country OR @Original_country IS NULL AND country IS NULL) AND (pub_name = @Origi" & _ + "nal_pub_name OR @Original_pub_name IS NULL AND pub_name IS NULL) AND (state = @O" & _ + "riginal_state OR @Original_state IS NULL AND state IS NULL); SELECT pub_id, pub_" & _ + "name, city, state, country FROM publishers WHERE (pub_id = @pub_id)" + Me.SqlUpdateCommand1.Connection = Me.SqlConnection1 + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_id", System.Data.SqlDbType.VarChar, 4, "pub_id")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_name", System.Data.SqlDbType.VarChar, 40, "pub_name")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@city", System.Data.SqlDbType.VarChar, 20, "city")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@state", System.Data.SqlDbType.VarChar, 2, "state")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@country", System.Data.SqlDbType.VarChar, 30, "country")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_id", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_city", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "city", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_country", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "country", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_name", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_name", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_state", System.Data.SqlDbType.VarChar, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "state", System.Data.DataRowVersion.Original, Nothing)) + ' + 'SqlDeleteCommand1 + ' + Me.SqlDeleteCommand1.CommandText = "DELETE FROM publishers WHERE (pub_id = @Original_pub_id) AND (city = @Original_ci" & _ + "ty OR @Original_city IS NULL AND city IS NULL) AND (country = @Original_country " & _ + "OR @Original_country IS NULL AND country IS NULL) AND (pub_name = @Original_pub_" & _ + "name OR @Original_pub_name IS NULL AND pub_name IS NULL) AND (state = @Original_" & _ + "state OR @Original_state IS NULL AND state IS NULL)" + Me.SqlDeleteCommand1.Connection = Me.SqlConnection1 + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_id", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_city", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "city", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_country", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "country", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_name", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_name", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_state", System.Data.SqlDbType.VarChar, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "state", System.Data.DataRowVersion.Original, Nothing)) + ' + 'MyDataAdapter + ' + Me.MyDataAdapter.DeleteCommand = Me.SqlDeleteCommand1 + Me.MyDataAdapter.InsertCommand = Me.SqlInsertCommand1 + Me.MyDataAdapter.SelectCommand = Me.SqlSelectCommand1 + Me.MyDataAdapter.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "publishers", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("pub_id", "pub_id"), New System.Data.Common.DataColumnMapping("pub_name", "pub_name"), New System.Data.Common.DataColumnMapping("city", "city"), New System.Data.Common.DataColumnMapping("state", "state"), New System.Data.Common.DataColumnMapping("country", "country")})}) + Me.MyDataAdapter.UpdateCommand = Me.SqlUpdateCommand1 + ' + 'MyDataSet + ' + Me.MyDataSet.DataSetName = "DataSet1" + Me.MyDataSet.Locale = New System.Globalization.CultureInfo("en-GB") + Me.MyDataSet.Namespace = "http://www.tempuri.org/DataSet1.xsd" + CType(Me.MyDataSet, System.ComponentModel.ISupportInitialize).EndInit() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + If Not IsPostBack Then + MyDataAdapter.Fill(MyDataSet) + MyDataGrid.DataBind() + End If + End Sub + + Private Sub MyDataGrid_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles MyDataGrid.PageIndexChanged + MyDataGrid.CurrentPageIndex = e.NewPageIndex + ' Bind your data again here. You could load DataSet + ' from ViewState, database, etc. For example: + MyDataAdapter.Fill(MyDataSet) + MyDataGrid.DataBind() + End Sub +End Class diff --git a/Ch4 - Paging/_vti_pvt/access.cnf b/Ch4 - Paging/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch4 - Paging/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch4 - Paging/_vti_pvt/deptodoc.btr b/Ch4 - Paging/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..65ea3b9 Binary files /dev/null and b/Ch4 - Paging/_vti_pvt/deptodoc.btr differ diff --git a/Ch4 - Paging/_vti_pvt/doctodep.btr b/Ch4 - Paging/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch4 - Paging/_vti_pvt/doctodep.btr differ diff --git a/Ch4 - Paging/_vti_pvt/service.cnf b/Ch4 - Paging/_vti_pvt/service.cnf new file mode 100644 index 0000000..5a2e4a1 --- /dev/null +++ b/Ch4 - Paging/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|06 Nov 2002 18:47:37 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch4 - Paging/_vti_pvt/service.lck b/Ch4 - Paging/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch4 - Paging/_vti_pvt/services.cnf b/Ch4 - Paging/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch4 - Paging/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch4 - Paging/bin/Ch4 - Paging.dll b/Ch4 - Paging/bin/Ch4 - Paging.dll new file mode 100644 index 0000000..b258353 Binary files /dev/null and b/Ch4 - Paging/bin/Ch4 - Paging.dll differ diff --git a/Ch4 - Paging/bin/Ch4 - Paging.pdb b/Ch4 - Paging/bin/Ch4 - Paging.pdb new file mode 100644 index 0000000..c41e5e8 Binary files /dev/null and b/Ch4 - Paging/bin/Ch4 - Paging.pdb differ diff --git a/Ch4 - SQL Server Online Check/AssemblyInfo.vb b/Ch4 - SQL Server Online Check/AssemblyInfo.vb new file mode 100644 index 0000000..f0d1d7e --- /dev/null +++ b/Ch4 - SQL Server Online Check/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch4 - SQL Server Online Check/Ch4 - SQL Server Online Check.sln b/Ch4 - SQL Server Online Check/Ch4 - SQL Server Online Check.sln new file mode 100644 index 0000000..6387c13 --- /dev/null +++ b/Ch4 - SQL Server Online Check/Ch4 - SQL Server Online Check.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch4 - SQL Server Online Check", "Ch4 - SQL Server Online Check.vbproj", "{A5740FC8-47D7-4103-B769-E1F4E01AC525}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {A5740FC8-47D7-4103-B769-E1F4E01AC525}.Debug.ActiveCfg = Debug|.NET + {A5740FC8-47D7-4103-B769-E1F4E01AC525}.Debug.Build.0 = Debug|.NET + {A5740FC8-47D7-4103-B769-E1F4E01AC525}.Release.ActiveCfg = Release|.NET + {A5740FC8-47D7-4103-B769-E1F4E01AC525}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch4 - SQL Server Online Check/Ch4 - SQL Server Online Check.suo b/Ch4 - SQL Server Online Check/Ch4 - SQL Server Online Check.suo new file mode 100644 index 0000000..7f9d8e3 Binary files /dev/null and b/Ch4 - SQL Server Online Check/Ch4 - SQL Server Online Check.suo differ diff --git a/Ch4 - SQL Server Online Check/Ch4 - SQL Server Online Check.vbproj b/Ch4 - SQL Server Online Check/Ch4 - SQL Server Online Check.vbproj new file mode 100644 index 0000000..efa631b --- /dev/null +++ b/Ch4 - SQL Server Online Check/Ch4 - SQL Server Online Check.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - SQL Server Online Check/Ch4 - SQL Server Online Check.vbproj.user b/Ch4 - SQL Server Online Check/Ch4 - SQL Server Online Check.vbproj.user new file mode 100644 index 0000000..a6e254a --- /dev/null +++ b/Ch4 - SQL Server Online Check/Ch4 - SQL Server Online Check.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch4 - SQL Server Online Check/Form1.resx b/Ch4 - SQL Server Online Check/Form1.resx new file mode 100644 index 0000000..6352565 --- /dev/null +++ b/Ch4 - SQL Server Online Check/Form1.resx @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch4 - SQL Server Online Check/Form1.vb b/Ch4 - SQL Server Online Check/Form1.vb new file mode 100644 index 0000000..5f84104 --- /dev/null +++ b/Ch4 - SQL Server Online Check/Form1.vb @@ -0,0 +1,126 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents Label2 As System.Windows.Forms.Label + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Label1 = New System.Windows.Forms.Label() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.Label2 = New System.Windows.Forms.Label() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Label1 + ' + Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label1.Location = New System.Drawing.Point(96, 128) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(304, 32) + Me.Label1.TabIndex = 0 + Me.Label1.Text = "Click button to start" + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(216, 16) + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(232, 20) + Me.TextBox1.TabIndex = 1 + Me.TextBox1.Text = "maxsql001.maximumasp.com" + ' + 'Label2 + ' + Me.Label2.Location = New System.Drawing.Point(72, 16) + Me.Label2.Name = "Label2" + Me.Label2.TabIndex = 2 + Me.Label2.Text = "Server address:" + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(80, 64) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(368, 24) + Me.Button1.TabIndex = 3 + Me.Button1.Text = "Click here to check whether above server is online" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(520, 182) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1, Me.Label2, Me.TextBox1, Me.Label1}) + Me.Name = "Form1" + Me.Text = "Ch4 - Simple check to see whether SQL Server is online" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Public Function IsSQLServerOnline(ByVal ServerAddress As String) As Boolean + ' Tests an SQL Server connection by name or IP address + + Try + ' Attempt to get server address + Dim objIPHost As New System.Net.IPHostEntry() + objIPHost = System.Net.Dns.Resolve(ServerAddress) + Dim objAddress As System.Net.IPAddress + objAddress = objIPHost.AddressList(0) + ' Connect to port 1433, most common SQL Server + ' port. If your target is different, change here + Dim objTCP As System.Net.Sockets.TcpClient = _ + New System.Net.Sockets.TcpClient() + objTCP.Connect(objAddress, 1433) + ' No problems (hurrah!) + ' Close and cleanup + objTCP.Close() + objTCP = Nothing + objAddress = Nothing + objIPHost = Nothing + ' Return success + Return True + + Catch ex As Exception + ' Server unavailable, return fail value + Return False + End Try + End Function + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + + If IsSQLServerOnline(TextBox1.Text) Then + Label1.Text = "Can connect to server!" + Else + Label1.Text = "Server not available!" + End If + + End Sub +End Class diff --git a/Ch4 - SQL Server Online Check/bin/Ch4 - SQL Server Online Check.exe b/Ch4 - SQL Server Online Check/bin/Ch4 - SQL Server Online Check.exe new file mode 100644 index 0000000..4b4d1cb Binary files /dev/null and b/Ch4 - SQL Server Online Check/bin/Ch4 - SQL Server Online Check.exe differ diff --git a/Ch4 - SQL Server Online Check/bin/Ch4 - SQL Server Online Check.pdb b/Ch4 - SQL Server Online Check/bin/Ch4 - SQL Server Online Check.pdb new file mode 100644 index 0000000..e1ff389 Binary files /dev/null and b/Ch4 - SQL Server Online Check/bin/Ch4 - SQL Server Online Check.pdb differ diff --git a/Ch4 - SQL Server Online Check/obj/Debug/Ch4 - SQL Server Online Check.exe b/Ch4 - SQL Server Online Check/obj/Debug/Ch4 - SQL Server Online Check.exe new file mode 100644 index 0000000..4b4d1cb Binary files /dev/null and b/Ch4 - SQL Server Online Check/obj/Debug/Ch4 - SQL Server Online Check.exe differ diff --git a/Ch4 - SQL Server Online Check/obj/Debug/Ch4 - SQL Server Online Check.pdb b/Ch4 - SQL Server Online Check/obj/Debug/Ch4 - SQL Server Online Check.pdb new file mode 100644 index 0000000..e1ff389 Binary files /dev/null and b/Ch4 - SQL Server Online Check/obj/Debug/Ch4 - SQL Server Online Check.pdb differ diff --git a/Ch4 - SQL Server Online Check/obj/Debug/Ch4___SQL_Server_Online_Check.Form1.resources b/Ch4 - SQL Server Online Check/obj/Debug/Ch4___SQL_Server_Online_Check.Form1.resources new file mode 100644 index 0000000..c0ee42f Binary files /dev/null and b/Ch4 - SQL Server Online Check/obj/Debug/Ch4___SQL_Server_Online_Check.Form1.resources differ diff --git a/Ch4 - Select @@Identity/AssemblyInfo.vb b/Ch4 - Select @@Identity/AssemblyInfo.vb new file mode 100644 index 0000000..7ed91ab --- /dev/null +++ b/Ch4 - Select @@Identity/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch4 - Select @@Identity/Ch4 - Select @@Identity.sln b/Ch4 - Select @@Identity/Ch4 - Select @@Identity.sln new file mode 100644 index 0000000..719e129 --- /dev/null +++ b/Ch4 - Select @@Identity/Ch4 - Select @@Identity.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch4 - Select @@Identity", "Ch4 - Select @@Identity.vbproj", "{019E6299-E827-4687-8A99-045E543E8634}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {019E6299-E827-4687-8A99-045E543E8634}.Debug.ActiveCfg = Debug|.NET + {019E6299-E827-4687-8A99-045E543E8634}.Debug.Build.0 = Debug|.NET + {019E6299-E827-4687-8A99-045E543E8634}.Release.ActiveCfg = Release|.NET + {019E6299-E827-4687-8A99-045E543E8634}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch4 - Select @@Identity/Ch4 - Select @@Identity.suo b/Ch4 - Select @@Identity/Ch4 - Select @@Identity.suo new file mode 100644 index 0000000..cb27e4a Binary files /dev/null and b/Ch4 - Select @@Identity/Ch4 - Select @@Identity.suo differ diff --git a/Ch4 - Select @@Identity/Ch4 - Select @@Identity.vbproj b/Ch4 - Select @@Identity/Ch4 - Select @@Identity.vbproj new file mode 100644 index 0000000..409852d --- /dev/null +++ b/Ch4 - Select @@Identity/Ch4 - Select @@Identity.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Select @@Identity/Ch4 - Select @@Identity.vbproj.user b/Ch4 - Select @@Identity/Ch4 - Select @@Identity.vbproj.user new file mode 100644 index 0000000..447fdc6 --- /dev/null +++ b/Ch4 - Select @@Identity/Ch4 - Select @@Identity.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch4 - Select @@Identity/Form1.resx b/Ch4 - Select @@Identity/Form1.resx new file mode 100644 index 0000000..eadbec7 --- /dev/null +++ b/Ch4 - Select @@Identity/Form1.resx @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch4 - Select @@Identity/Form1.vb b/Ch4 - Select @@Identity/Form1.vb new file mode 100644 index 0000000..7169bb1 --- /dev/null +++ b/Ch4 - Select @@Identity/Form1.vb @@ -0,0 +1,110 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents Label2 As System.Windows.Forms.Label + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Label1 = New System.Windows.Forms.Label() + Me.Label2 = New System.Windows.Forms.Label() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Label1 + ' + Me.Label1.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label1.Location = New System.Drawing.Point(16, 16) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(336, 24) + Me.Label1.TabIndex = 0 + Me.Label1.Text = "Finding the Last Identity Number Added" + ' + 'Label2 + ' + Me.Label2.Location = New System.Drawing.Point(16, 48) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(376, 40) + Me.Label2.TabIndex = 1 + Me.Label2.Text = "This example uses the SQL Server ""pubs"" database to add a row to the ""jobs"" table" & _ + " and report back with the autogenerated ID number." + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(112, 96) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(176, 32) + Me.Button1.TabIndex = 2 + Me.Button1.Text = "Click here to add row" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(400, 158) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1, Me.Label2, Me.Label1}) + Me.Name = "Form1" + Me.Text = "Finding the Last Identity Number Added" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + ' Variable to hold the identity value of our record + Dim MyIdentityValue As Integer + ' Setup sample connection and command + Dim objConnection As New SqlClient.SqlConnection( _ + "server=.;database=pubs;" & _ + "trusted_connection=true") + Dim objCommand As New SqlClient.SqlCommand( _ + "INSERT INTO jobs (job_desc, min_lvl, max_lvl) " & _ + "VALUES('In-house Author', 50, 100)") + ' Open connection and execute INSERT command + objConnection.Open() + objCommand.Connection = objConnection + ' Execute and check minimum of one record affected... + If objCommand.ExecuteNonQuery > 0 = True Then + ' Setup separate command to retrieve identity value + Dim objIdentifier As New _ + SqlClient.SqlCommand("Select @@Identity", objConnection) + Try + ' Return value of field + MyIdentityValue = objIdentifier.ExecuteScalar + Catch + MyIdentityValue = 0 + End Try + End If + ' Close connection + objConnection.Close() + ' Display value + MessageBox.Show("The autogenerated identity number was " & MyIdentityValue) + End Sub +End Class diff --git a/Ch4 - Select @@Identity/bin/Ch4 - Select @@Identity.exe b/Ch4 - Select @@Identity/bin/Ch4 - Select @@Identity.exe new file mode 100644 index 0000000..b2f58fd Binary files /dev/null and b/Ch4 - Select @@Identity/bin/Ch4 - Select @@Identity.exe differ diff --git a/Ch4 - Select @@Identity/bin/Ch4 - Select @@Identity.pdb b/Ch4 - Select @@Identity/bin/Ch4 - Select @@Identity.pdb new file mode 100644 index 0000000..9cc6f4e Binary files /dev/null and b/Ch4 - Select @@Identity/bin/Ch4 - Select @@Identity.pdb differ diff --git a/Ch4 - Select @@Identity/obj/Debug/Ch4 - Select @@Identity.exe b/Ch4 - Select @@Identity/obj/Debug/Ch4 - Select @@Identity.exe new file mode 100644 index 0000000..b2f58fd Binary files /dev/null and b/Ch4 - Select @@Identity/obj/Debug/Ch4 - Select @@Identity.exe differ diff --git a/Ch4 - Select @@Identity/obj/Debug/Ch4 - Select @@Identity.pdb b/Ch4 - Select @@Identity/obj/Debug/Ch4 - Select @@Identity.pdb new file mode 100644 index 0000000..9cc6f4e Binary files /dev/null and b/Ch4 - Select @@Identity/obj/Debug/Ch4 - Select @@Identity.pdb differ diff --git a/Ch4 - Select @@Identity/obj/Debug/Ch4___Select___Identity.Form1.resources b/Ch4 - Select @@Identity/obj/Debug/Ch4___Select___Identity.Form1.resources new file mode 100644 index 0000000..a169505 Binary files /dev/null and b/Ch4 - Select @@Identity/obj/Debug/Ch4___Select___Identity.Form1.resources differ diff --git a/Ch4 - Select Multiple/AssemblyInfo.vb b/Ch4 - Select Multiple/AssemblyInfo.vb new file mode 100644 index 0000000..1eb11ef --- /dev/null +++ b/Ch4 - Select Multiple/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch4 - Select Multiple/Ch4 - Select Multiple.sln b/Ch4 - Select Multiple/Ch4 - Select Multiple.sln new file mode 100644 index 0000000..f1708d7 --- /dev/null +++ b/Ch4 - Select Multiple/Ch4 - Select Multiple.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch4 - Select Multiple", "http://localhost/Ch4 - Select Multiple/Ch4 - Select Multiple.vbproj", "{9E1206D5-1510-4F72-8B7D-107B98E344DA}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {9E1206D5-1510-4F72-8B7D-107B98E344DA}.Debug.ActiveCfg = Debug|.NET + {9E1206D5-1510-4F72-8B7D-107B98E344DA}.Debug.Build.0 = Debug|.NET + {9E1206D5-1510-4F72-8B7D-107B98E344DA}.Release.ActiveCfg = Release|.NET + {9E1206D5-1510-4F72-8B7D-107B98E344DA}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch4 - Select Multiple/Ch4 - Select Multiple.suo b/Ch4 - Select Multiple/Ch4 - Select Multiple.suo new file mode 100644 index 0000000..e30c476 Binary files /dev/null and b/Ch4 - Select Multiple/Ch4 - Select Multiple.suo differ diff --git a/Ch4 - Select Multiple/Ch4 - Select Multiple.vbproj b/Ch4 - Select Multiple/Ch4 - Select Multiple.vbproj new file mode 100644 index 0000000..437c00e --- /dev/null +++ b/Ch4 - Select Multiple/Ch4 - Select Multiple.vbproj @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Select Multiple/Ch4 - Select Multiple.vbproj.webinfo b/Ch4 - Select Multiple/Ch4 - Select Multiple.vbproj.webinfo new file mode 100644 index 0000000..c9ad5e1 --- /dev/null +++ b/Ch4 - Select Multiple/Ch4 - Select Multiple.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch4 - Select Multiple/Ch4 - Select Multiple.vsdisco b/Ch4 - Select Multiple/Ch4 - Select Multiple.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch4 - Select Multiple/Ch4 - Select Multiple.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch4 - Select Multiple/DataSet1.vb b/Ch4 - Select Multiple/DataSet1.vb new file mode 100644 index 0000000..ae2c350 --- /dev/null +++ b/Ch4 - Select Multiple/DataSet1.vb @@ -0,0 +1,455 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version: 1.0.3705.288 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict Off +Option Explicit On + +Imports System +Imports System.Data +Imports System.Runtime.Serialization +Imports System.Xml + + + _ +Public Class DataSet1 + Inherits DataSet + + Private tablepublishers As publishersDataTable + + Public Sub New() + MyBase.New + Me.InitClass + Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged + AddHandler Me.Tables.CollectionChanged, schemaChangedHandler + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler + End Sub + + Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext) + MyBase.New + Dim strSchema As String = CType(info.GetValue("XmlSchema", GetType(System.String)),String) + If (Not (strSchema) Is Nothing) Then + Dim ds As DataSet = New DataSet + ds.ReadXmlSchema(New XmlTextReader(New System.IO.StringReader(strSchema))) + If (Not (ds.Tables("publishers")) Is Nothing) Then + Me.Tables.Add(New publishersDataTable(ds.Tables("publishers"))) + End If + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.Namespace = ds.Namespace + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) + Me.InitVars + Else + Me.InitClass + End If + Me.GetSerializationData(info, context) + Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged + AddHandler Me.Tables.CollectionChanged, schemaChangedHandler + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler + End Sub + + _ + Public ReadOnly Property publishers As publishersDataTable + Get + Return Me.tablepublishers + End Get + End Property + + Public Overrides Function Clone() As DataSet + Dim cln As DataSet1 = CType(MyBase.Clone,DataSet1) + cln.InitVars + Return cln + End Function + + Protected Overrides Function ShouldSerializeTables() As Boolean + Return false + End Function + + Protected Overrides Function ShouldSerializeRelations() As Boolean + Return false + End Function + + Protected Overrides Sub ReadXmlSerializable(ByVal reader As XmlReader) + Me.Reset + Dim ds As DataSet = New DataSet + ds.ReadXml(reader) + If (Not (ds.Tables("publishers")) Is Nothing) Then + Me.Tables.Add(New publishersDataTable(ds.Tables("publishers"))) + End If + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.Namespace = ds.Namespace + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) + Me.InitVars + End Sub + + Protected Overrides Function GetSchemaSerializable() As System.Xml.Schema.XmlSchema + Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream + Me.WriteXmlSchema(New XmlTextWriter(stream, Nothing)) + stream.Position = 0 + Return System.Xml.Schema.XmlSchema.Read(New XmlTextReader(stream), Nothing) + End Function + + Friend Sub InitVars() + Me.tablepublishers = CType(Me.Tables("publishers"),publishersDataTable) + If (Not (Me.tablepublishers) Is Nothing) Then + Me.tablepublishers.InitVars + End If + End Sub + + Private Sub InitClass() + Me.DataSetName = "DataSet1" + Me.Prefix = "" + Me.Namespace = "http://www.tempuri.org/DataSet1.xsd" + Me.Locale = New System.Globalization.CultureInfo("en-GB") + Me.CaseSensitive = false + Me.EnforceConstraints = true + Me.tablepublishers = New publishersDataTable + Me.Tables.Add(Me.tablepublishers) + End Sub + + Private Function ShouldSerializepublishers() As Boolean + Return false + End Function + + Private Sub SchemaChanged(ByVal sender As Object, ByVal e As System.ComponentModel.CollectionChangeEventArgs) + If (e.Action = System.ComponentModel.CollectionChangeAction.Remove) Then + Me.InitVars + End If + End Sub + + Public Delegate Sub publishersRowChangeEventHandler(ByVal sender As Object, ByVal e As publishersRowChangeEvent) + + _ + Public Class publishersDataTable + Inherits DataTable + Implements System.Collections.IEnumerable + + Private columnpub_id As DataColumn + + Private columnpub_name As DataColumn + + Private columncity As DataColumn + + Private columnstate As DataColumn + + Private columncountry As DataColumn + + Friend Sub New() + MyBase.New("publishers") + Me.InitClass + End Sub + + Friend Sub New(ByVal table As DataTable) + MyBase.New(table.TableName) + If (table.CaseSensitive <> table.DataSet.CaseSensitive) Then + Me.CaseSensitive = table.CaseSensitive + End If + If (table.Locale.ToString <> table.DataSet.Locale.ToString) Then + Me.Locale = table.Locale + End If + If (table.Namespace <> table.DataSet.Namespace) Then + Me.Namespace = table.Namespace + End If + Me.Prefix = table.Prefix + Me.MinimumCapacity = table.MinimumCapacity + Me.DisplayExpression = table.DisplayExpression + End Sub + + _ + Public ReadOnly Property Count As Integer + Get + Return Me.Rows.Count + End Get + End Property + + Friend ReadOnly Property pub_idColumn As DataColumn + Get + Return Me.columnpub_id + End Get + End Property + + Friend ReadOnly Property pub_nameColumn As DataColumn + Get + Return Me.columnpub_name + End Get + End Property + + Friend ReadOnly Property cityColumn As DataColumn + Get + Return Me.columncity + End Get + End Property + + Friend ReadOnly Property stateColumn As DataColumn + Get + Return Me.columnstate + End Get + End Property + + Friend ReadOnly Property countryColumn As DataColumn + Get + Return Me.columncountry + End Get + End Property + + Public Default ReadOnly Property Item(ByVal index As Integer) As publishersRow + Get + Return CType(Me.Rows(index),publishersRow) + End Get + End Property + + Public Event publishersRowChanged As publishersRowChangeEventHandler + + Public Event publishersRowChanging As publishersRowChangeEventHandler + + Public Event publishersRowDeleted As publishersRowChangeEventHandler + + Public Event publishersRowDeleting As publishersRowChangeEventHandler + + Public Overloads Sub AddpublishersRow(ByVal row As publishersRow) + Me.Rows.Add(row) + End Sub + + Public Overloads Function AddpublishersRow(ByVal pub_id As String, ByVal pub_name As String, ByVal city As String, ByVal state As String, ByVal country As String) As publishersRow + Dim rowpublishersRow As publishersRow = CType(Me.NewRow,publishersRow) + rowpublishersRow.ItemArray = New Object() {pub_id, pub_name, city, state, country} + Me.Rows.Add(rowpublishersRow) + Return rowpublishersRow + End Function + + Public Function FindBypub_id(ByVal pub_id As String) As publishersRow + Return CType(Me.Rows.Find(New Object() {pub_id}),publishersRow) + End Function + + Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator + Return Me.Rows.GetEnumerator + End Function + + Public Overrides Function Clone() As DataTable + Dim cln As publishersDataTable = CType(MyBase.Clone,publishersDataTable) + cln.InitVars + Return cln + End Function + + Protected Overrides Function CreateInstance() As DataTable + Return New publishersDataTable + End Function + + Friend Sub InitVars() + Me.columnpub_id = Me.Columns("pub_id") + Me.columnpub_name = Me.Columns("pub_name") + Me.columncity = Me.Columns("city") + Me.columnstate = Me.Columns("state") + Me.columncountry = Me.Columns("country") + End Sub + + Private Sub InitClass() + Me.columnpub_id = New DataColumn("pub_id", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnpub_id) + Me.columnpub_name = New DataColumn("pub_name", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnpub_name) + Me.columncity = New DataColumn("city", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columncity) + Me.columnstate = New DataColumn("state", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnstate) + Me.columncountry = New DataColumn("country", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columncountry) + Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnpub_id}, true)) + Me.columnpub_id.AllowDBNull = false + Me.columnpub_id.Unique = true + End Sub + + Public Function NewpublishersRow() As publishersRow + Return CType(Me.NewRow,publishersRow) + End Function + + Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow + Return New publishersRow(builder) + End Function + + Protected Overrides Function GetRowType() As System.Type + Return GetType(publishersRow) + End Function + + Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanged(e) + If (Not (Me.publishersRowChangedEvent) Is Nothing) Then + RaiseEvent publishersRowChanged(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanging(e) + If (Not (Me.publishersRowChangingEvent) Is Nothing) Then + RaiseEvent publishersRowChanging(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleted(e) + If (Not (Me.publishersRowDeletedEvent) Is Nothing) Then + RaiseEvent publishersRowDeleted(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleting(e) + If (Not (Me.publishersRowDeletingEvent) Is Nothing) Then + RaiseEvent publishersRowDeleting(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Public Sub RemovepublishersRow(ByVal row As publishersRow) + Me.Rows.Remove(row) + End Sub + End Class + + _ + Public Class publishersRow + Inherits DataRow + + Private tablepublishers As publishersDataTable + + Friend Sub New(ByVal rb As DataRowBuilder) + MyBase.New(rb) + Me.tablepublishers = CType(Me.Table,publishersDataTable) + End Sub + + Public Property pub_id As String + Get + Return CType(Me(Me.tablepublishers.pub_idColumn),String) + End Get + Set + Me(Me.tablepublishers.pub_idColumn) = value + End Set + End Property + + Public Property pub_name As String + Get + Try + Return CType(Me(Me.tablepublishers.pub_nameColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.pub_nameColumn) = value + End Set + End Property + + Public Property city As String + Get + Try + Return CType(Me(Me.tablepublishers.cityColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.cityColumn) = value + End Set + End Property + + Public Property state As String + Get + Try + Return CType(Me(Me.tablepublishers.stateColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.stateColumn) = value + End Set + End Property + + Public Property country As String + Get + Try + Return CType(Me(Me.tablepublishers.countryColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.countryColumn) = value + End Set + End Property + + Public Function Ispub_nameNull() As Boolean + Return Me.IsNull(Me.tablepublishers.pub_nameColumn) + End Function + + Public Sub Setpub_nameNull() + Me(Me.tablepublishers.pub_nameColumn) = System.Convert.DBNull + End Sub + + Public Function IscityNull() As Boolean + Return Me.IsNull(Me.tablepublishers.cityColumn) + End Function + + Public Sub SetcityNull() + Me(Me.tablepublishers.cityColumn) = System.Convert.DBNull + End Sub + + Public Function IsstateNull() As Boolean + Return Me.IsNull(Me.tablepublishers.stateColumn) + End Function + + Public Sub SetstateNull() + Me(Me.tablepublishers.stateColumn) = System.Convert.DBNull + End Sub + + Public Function IscountryNull() As Boolean + Return Me.IsNull(Me.tablepublishers.countryColumn) + End Function + + Public Sub SetcountryNull() + Me(Me.tablepublishers.countryColumn) = System.Convert.DBNull + End Sub + End Class + + _ + Public Class publishersRowChangeEvent + Inherits EventArgs + + Private eventRow As publishersRow + + Private eventAction As DataRowAction + + Public Sub New(ByVal row As publishersRow, ByVal action As DataRowAction) + MyBase.New + Me.eventRow = row + Me.eventAction = action + End Sub + + Public ReadOnly Property Row As publishersRow + Get + Return Me.eventRow + End Get + End Property + + Public ReadOnly Property Action As DataRowAction + Get + Return Me.eventAction + End Get + End Property + End Class +End Class diff --git a/Ch4 - Select Multiple/DataSet1.xsd b/Ch4 - Select Multiple/DataSet1.xsd new file mode 100644 index 0000000..651872e --- /dev/null +++ b/Ch4 - Select Multiple/DataSet1.xsd @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ch4 - Select Multiple/Global.asax b/Ch4 - Select Multiple/Global.asax new file mode 100644 index 0000000..1e990aa --- /dev/null +++ b/Ch4 - Select Multiple/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch4___Select_Multiple.Global" %> \ No newline at end of file diff --git a/Ch4 - Select Multiple/Global.asax.resx b/Ch4 - Select Multiple/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch4 - Select Multiple/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch4 - Select Multiple/Global.asax.vb b/Ch4 - Select Multiple/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch4 - Select Multiple/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch4 - Select Multiple/Read Me First.txt b/Ch4 - Select Multiple/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch4 - Select Multiple/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch4 - Select Multiple/Styles.css b/Ch4 - Select Multiple/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch4 - Select Multiple/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch4 - Select Multiple/Web.config b/Ch4 - Select Multiple/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch4 - Select Multiple/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Select Multiple/WebForm1.aspx b/Ch4 - Select Multiple/WebForm1.aspx new file mode 100644 index 0000000..972a2d9 --- /dev/null +++ b/Ch4 - Select Multiple/WebForm1.aspx @@ -0,0 +1,30 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch4___Select_Multiple.WebForm1"%> + + + + Selecting Multiple Web Form Grid Items, Hotmail-Style + + + + + + +
+ + + + + + + + + + + + + + + +
+ + diff --git a/Ch4 - Select Multiple/WebForm1.aspx.resx b/Ch4 - Select Multiple/WebForm1.aspx.resx new file mode 100644 index 0000000..2ada03c --- /dev/null +++ b/Ch4 - Select Multiple/WebForm1.aspx.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + 17, 17 + + + False + + + 152, 17 + + + False + + + 17, 17 + + + False + + + False + + + 17, 17 + + + False + + + False + + + 17, 17 + + + False + + + 17, 17 + + + 280, 17 + + \ No newline at end of file diff --git a/Ch4 - Select Multiple/WebForm1.aspx.vb b/Ch4 - Select Multiple/WebForm1.aspx.vb new file mode 100644 index 0000000..535c245 --- /dev/null +++ b/Ch4 - Select Multiple/WebForm1.aspx.vb @@ -0,0 +1,139 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlUpdateCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlDeleteCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection + Protected WithEvents SqlDataAdapter1 As System.Data.SqlClient.SqlDataAdapter + Protected WithEvents DataSet11 As Ch4___Select_Multiple.DataSet1 + Protected WithEvents MyDataGrid As System.Web.UI.WebControls.DataGrid + Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox + Protected WithEvents Button1 As System.Web.UI.WebControls.Button + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection() + Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter() + Me.DataSet11 = New Ch4___Select_Multiple.DataSet1() + CType(Me.DataSet11, System.ComponentModel.ISupportInitialize).BeginInit() + ' + 'SqlSelectCommand1 + ' + Me.SqlSelectCommand1.CommandText = "SELECT pub_id, pub_name, city, state, country FROM publishers" + Me.SqlSelectCommand1.Connection = Me.SqlConnection1 + ' + 'SqlConnection1 + ' + Me.SqlConnection1.ConnectionString = "data source=.;initial catalog=pubs;persist security info=False;user id=sa;packet " & _ + "size=4096;password=;" + ' + 'SqlInsertCommand1 + ' + Me.SqlInsertCommand1.CommandText = "INSERT INTO publishers(pub_id, pub_name, city, state, country) VALUES (@pub_id, @" & _ + "pub_name, @city, @state, @country); SELECT pub_id, pub_name, city, state, countr" & _ + "y FROM publishers WHERE (pub_id = @pub_id)" + Me.SqlInsertCommand1.Connection = Me.SqlConnection1 + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_id", System.Data.SqlDbType.VarChar, 4, "pub_id")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_name", System.Data.SqlDbType.VarChar, 40, "pub_name")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@city", System.Data.SqlDbType.VarChar, 20, "city")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@state", System.Data.SqlDbType.VarChar, 2, "state")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@country", System.Data.SqlDbType.VarChar, 30, "country")) + ' + 'SqlUpdateCommand1 + ' + Me.SqlUpdateCommand1.CommandText = "UPDATE publishers SET pub_id = @pub_id, pub_name = @pub_name, city = @city, state" & _ + " = @state, country = @country WHERE (pub_id = @Original_pub_id) AND (city = @Ori" & _ + "ginal_city OR @Original_city IS NULL AND city IS NULL) AND (country = @Original_" & _ + "country OR @Original_country IS NULL AND country IS NULL) AND (pub_name = @Origi" & _ + "nal_pub_name OR @Original_pub_name IS NULL AND pub_name IS NULL) AND (state = @O" & _ + "riginal_state OR @Original_state IS NULL AND state IS NULL); SELECT pub_id, pub_" & _ + "name, city, state, country FROM publishers WHERE (pub_id = @pub_id)" + Me.SqlUpdateCommand1.Connection = Me.SqlConnection1 + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_id", System.Data.SqlDbType.VarChar, 4, "pub_id")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_name", System.Data.SqlDbType.VarChar, 40, "pub_name")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@city", System.Data.SqlDbType.VarChar, 20, "city")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@state", System.Data.SqlDbType.VarChar, 2, "state")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@country", System.Data.SqlDbType.VarChar, 30, "country")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_id", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_city", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "city", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_country", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "country", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_name", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_name", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_state", System.Data.SqlDbType.VarChar, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "state", System.Data.DataRowVersion.Original, Nothing)) + ' + 'SqlDeleteCommand1 + ' + Me.SqlDeleteCommand1.CommandText = "DELETE FROM publishers WHERE (pub_id = @Original_pub_id) AND (city = @Original_ci" & _ + "ty OR @Original_city IS NULL AND city IS NULL) AND (country = @Original_country " & _ + "OR @Original_country IS NULL AND country IS NULL) AND (pub_name = @Original_pub_" & _ + "name OR @Original_pub_name IS NULL AND pub_name IS NULL) AND (state = @Original_" & _ + "state OR @Original_state IS NULL AND state IS NULL)" + Me.SqlDeleteCommand1.Connection = Me.SqlConnection1 + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_id", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_city", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "city", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_country", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "country", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_name", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_name", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_state", System.Data.SqlDbType.VarChar, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "state", System.Data.DataRowVersion.Original, Nothing)) + ' + 'SqlDataAdapter1 + ' + Me.SqlDataAdapter1.DeleteCommand = Me.SqlDeleteCommand1 + Me.SqlDataAdapter1.InsertCommand = Me.SqlInsertCommand1 + Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1 + Me.SqlDataAdapter1.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "publishers", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("pub_id", "pub_id"), New System.Data.Common.DataColumnMapping("pub_name", "pub_name"), New System.Data.Common.DataColumnMapping("city", "city"), New System.Data.Common.DataColumnMapping("state", "state"), New System.Data.Common.DataColumnMapping("country", "country")})}) + Me.SqlDataAdapter1.UpdateCommand = Me.SqlUpdateCommand1 + ' + 'DataSet11 + ' + Me.DataSet11.DataSetName = "DataSet1" + Me.DataSet11.Locale = New System.Globalization.CultureInfo("en-GB") + Me.DataSet11.Namespace = "http://www.tempuri.org/DataSet1.xsd" + CType(Me.DataSet11, System.ComponentModel.ISupportInitialize).EndInit() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + If Not IsPostBack Then + SqlDataAdapter1.Fill(DataSet11) + MyDataGrid.DataBind() + End If + End Sub + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + + TextBox1.Text = "You selected... " + + Dim objItem As DataGridItem + For Each objItem In MyDataGrid.Items + ' Ignore invalid items + If objItem.ItemType <> ListItemType.Header And _ + objItem.ItemType <> ListItemType.Footer And _ + objItem.ItemType <> ListItemType.Pager Then + ' Retrieve the value of the check box + Dim blnDelete As Boolean + blnDelete = CType(objItem.Cells(0).FindControl("chkSelect"), _ + CheckBox).Checked + If blnDelete = True Then + ' Delete this row from the underlying DataSet, ie. + ' LocalDS.Tables(0).Rows(MyDataGrid.SelectedIndex).Delete + ' ... then rebind. + TextBox1.Text += objItem.Cells(2).Text & "; " + End If + End If + Next + End Sub +End Class diff --git a/Ch4 - Select Multiple/_vti_pvt/access.cnf b/Ch4 - Select Multiple/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch4 - Select Multiple/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch4 - Select Multiple/_vti_pvt/deptodoc.btr b/Ch4 - Select Multiple/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..4256bf0 Binary files /dev/null and b/Ch4 - Select Multiple/_vti_pvt/deptodoc.btr differ diff --git a/Ch4 - Select Multiple/_vti_pvt/doctodep.btr b/Ch4 - Select Multiple/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch4 - Select Multiple/_vti_pvt/doctodep.btr differ diff --git a/Ch4 - Select Multiple/_vti_pvt/service.cnf b/Ch4 - Select Multiple/_vti_pvt/service.cnf new file mode 100644 index 0000000..a60b539 --- /dev/null +++ b/Ch4 - Select Multiple/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|06 Nov 2002 18:22:17 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch4 - Select Multiple/_vti_pvt/service.lck b/Ch4 - Select Multiple/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch4 - Select Multiple/_vti_pvt/services.cnf b/Ch4 - Select Multiple/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch4 - Select Multiple/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch4 - Select Multiple/bin/Ch4 - Select Multiple.dll b/Ch4 - Select Multiple/bin/Ch4 - Select Multiple.dll new file mode 100644 index 0000000..7978320 Binary files /dev/null and b/Ch4 - Select Multiple/bin/Ch4 - Select Multiple.dll differ diff --git a/Ch4 - Select Multiple/bin/Ch4 - Select Multiple.pdb b/Ch4 - Select Multiple/bin/Ch4 - Select Multiple.pdb new file mode 100644 index 0000000..ac909a2 Binary files /dev/null and b/Ch4 - Select Multiple/bin/Ch4 - Select Multiple.pdb differ diff --git a/Ch4 - Sorting/AssemblyInfo.vb b/Ch4 - Sorting/AssemblyInfo.vb new file mode 100644 index 0000000..9a80c40 --- /dev/null +++ b/Ch4 - Sorting/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch4 - Sorting/Ch4 - Sorting.sln b/Ch4 - Sorting/Ch4 - Sorting.sln new file mode 100644 index 0000000..cc694b4 --- /dev/null +++ b/Ch4 - Sorting/Ch4 - Sorting.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch4 - Sorting", "http://localhost/Ch4 - Sorting/Ch4 - Sorting.vbproj", "{71D0EBAC-3269-4A85-A321-574234D039C2}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {71D0EBAC-3269-4A85-A321-574234D039C2}.Debug.ActiveCfg = Debug|.NET + {71D0EBAC-3269-4A85-A321-574234D039C2}.Debug.Build.0 = Debug|.NET + {71D0EBAC-3269-4A85-A321-574234D039C2}.Release.ActiveCfg = Release|.NET + {71D0EBAC-3269-4A85-A321-574234D039C2}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch4 - Sorting/Ch4 - Sorting.suo b/Ch4 - Sorting/Ch4 - Sorting.suo new file mode 100644 index 0000000..90e8f4a Binary files /dev/null and b/Ch4 - Sorting/Ch4 - Sorting.suo differ diff --git a/Ch4 - Sorting/Ch4 - Sorting.vbproj b/Ch4 - Sorting/Ch4 - Sorting.vbproj new file mode 100644 index 0000000..0ac5f6e --- /dev/null +++ b/Ch4 - Sorting/Ch4 - Sorting.vbproj @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Sorting/Ch4 - Sorting.vbproj.webinfo b/Ch4 - Sorting/Ch4 - Sorting.vbproj.webinfo new file mode 100644 index 0000000..9d74241 --- /dev/null +++ b/Ch4 - Sorting/Ch4 - Sorting.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch4 - Sorting/Ch4 - Sorting.vsdisco b/Ch4 - Sorting/Ch4 - Sorting.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch4 - Sorting/Ch4 - Sorting.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch4 - Sorting/DataSet1.vb b/Ch4 - Sorting/DataSet1.vb new file mode 100644 index 0000000..ae2c350 --- /dev/null +++ b/Ch4 - Sorting/DataSet1.vb @@ -0,0 +1,455 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version: 1.0.3705.288 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict Off +Option Explicit On + +Imports System +Imports System.Data +Imports System.Runtime.Serialization +Imports System.Xml + + + _ +Public Class DataSet1 + Inherits DataSet + + Private tablepublishers As publishersDataTable + + Public Sub New() + MyBase.New + Me.InitClass + Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged + AddHandler Me.Tables.CollectionChanged, schemaChangedHandler + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler + End Sub + + Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext) + MyBase.New + Dim strSchema As String = CType(info.GetValue("XmlSchema", GetType(System.String)),String) + If (Not (strSchema) Is Nothing) Then + Dim ds As DataSet = New DataSet + ds.ReadXmlSchema(New XmlTextReader(New System.IO.StringReader(strSchema))) + If (Not (ds.Tables("publishers")) Is Nothing) Then + Me.Tables.Add(New publishersDataTable(ds.Tables("publishers"))) + End If + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.Namespace = ds.Namespace + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) + Me.InitVars + Else + Me.InitClass + End If + Me.GetSerializationData(info, context) + Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged + AddHandler Me.Tables.CollectionChanged, schemaChangedHandler + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler + End Sub + + _ + Public ReadOnly Property publishers As publishersDataTable + Get + Return Me.tablepublishers + End Get + End Property + + Public Overrides Function Clone() As DataSet + Dim cln As DataSet1 = CType(MyBase.Clone,DataSet1) + cln.InitVars + Return cln + End Function + + Protected Overrides Function ShouldSerializeTables() As Boolean + Return false + End Function + + Protected Overrides Function ShouldSerializeRelations() As Boolean + Return false + End Function + + Protected Overrides Sub ReadXmlSerializable(ByVal reader As XmlReader) + Me.Reset + Dim ds As DataSet = New DataSet + ds.ReadXml(reader) + If (Not (ds.Tables("publishers")) Is Nothing) Then + Me.Tables.Add(New publishersDataTable(ds.Tables("publishers"))) + End If + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.Namespace = ds.Namespace + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) + Me.InitVars + End Sub + + Protected Overrides Function GetSchemaSerializable() As System.Xml.Schema.XmlSchema + Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream + Me.WriteXmlSchema(New XmlTextWriter(stream, Nothing)) + stream.Position = 0 + Return System.Xml.Schema.XmlSchema.Read(New XmlTextReader(stream), Nothing) + End Function + + Friend Sub InitVars() + Me.tablepublishers = CType(Me.Tables("publishers"),publishersDataTable) + If (Not (Me.tablepublishers) Is Nothing) Then + Me.tablepublishers.InitVars + End If + End Sub + + Private Sub InitClass() + Me.DataSetName = "DataSet1" + Me.Prefix = "" + Me.Namespace = "http://www.tempuri.org/DataSet1.xsd" + Me.Locale = New System.Globalization.CultureInfo("en-GB") + Me.CaseSensitive = false + Me.EnforceConstraints = true + Me.tablepublishers = New publishersDataTable + Me.Tables.Add(Me.tablepublishers) + End Sub + + Private Function ShouldSerializepublishers() As Boolean + Return false + End Function + + Private Sub SchemaChanged(ByVal sender As Object, ByVal e As System.ComponentModel.CollectionChangeEventArgs) + If (e.Action = System.ComponentModel.CollectionChangeAction.Remove) Then + Me.InitVars + End If + End Sub + + Public Delegate Sub publishersRowChangeEventHandler(ByVal sender As Object, ByVal e As publishersRowChangeEvent) + + _ + Public Class publishersDataTable + Inherits DataTable + Implements System.Collections.IEnumerable + + Private columnpub_id As DataColumn + + Private columnpub_name As DataColumn + + Private columncity As DataColumn + + Private columnstate As DataColumn + + Private columncountry As DataColumn + + Friend Sub New() + MyBase.New("publishers") + Me.InitClass + End Sub + + Friend Sub New(ByVal table As DataTable) + MyBase.New(table.TableName) + If (table.CaseSensitive <> table.DataSet.CaseSensitive) Then + Me.CaseSensitive = table.CaseSensitive + End If + If (table.Locale.ToString <> table.DataSet.Locale.ToString) Then + Me.Locale = table.Locale + End If + If (table.Namespace <> table.DataSet.Namespace) Then + Me.Namespace = table.Namespace + End If + Me.Prefix = table.Prefix + Me.MinimumCapacity = table.MinimumCapacity + Me.DisplayExpression = table.DisplayExpression + End Sub + + _ + Public ReadOnly Property Count As Integer + Get + Return Me.Rows.Count + End Get + End Property + + Friend ReadOnly Property pub_idColumn As DataColumn + Get + Return Me.columnpub_id + End Get + End Property + + Friend ReadOnly Property pub_nameColumn As DataColumn + Get + Return Me.columnpub_name + End Get + End Property + + Friend ReadOnly Property cityColumn As DataColumn + Get + Return Me.columncity + End Get + End Property + + Friend ReadOnly Property stateColumn As DataColumn + Get + Return Me.columnstate + End Get + End Property + + Friend ReadOnly Property countryColumn As DataColumn + Get + Return Me.columncountry + End Get + End Property + + Public Default ReadOnly Property Item(ByVal index As Integer) As publishersRow + Get + Return CType(Me.Rows(index),publishersRow) + End Get + End Property + + Public Event publishersRowChanged As publishersRowChangeEventHandler + + Public Event publishersRowChanging As publishersRowChangeEventHandler + + Public Event publishersRowDeleted As publishersRowChangeEventHandler + + Public Event publishersRowDeleting As publishersRowChangeEventHandler + + Public Overloads Sub AddpublishersRow(ByVal row As publishersRow) + Me.Rows.Add(row) + End Sub + + Public Overloads Function AddpublishersRow(ByVal pub_id As String, ByVal pub_name As String, ByVal city As String, ByVal state As String, ByVal country As String) As publishersRow + Dim rowpublishersRow As publishersRow = CType(Me.NewRow,publishersRow) + rowpublishersRow.ItemArray = New Object() {pub_id, pub_name, city, state, country} + Me.Rows.Add(rowpublishersRow) + Return rowpublishersRow + End Function + + Public Function FindBypub_id(ByVal pub_id As String) As publishersRow + Return CType(Me.Rows.Find(New Object() {pub_id}),publishersRow) + End Function + + Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator + Return Me.Rows.GetEnumerator + End Function + + Public Overrides Function Clone() As DataTable + Dim cln As publishersDataTable = CType(MyBase.Clone,publishersDataTable) + cln.InitVars + Return cln + End Function + + Protected Overrides Function CreateInstance() As DataTable + Return New publishersDataTable + End Function + + Friend Sub InitVars() + Me.columnpub_id = Me.Columns("pub_id") + Me.columnpub_name = Me.Columns("pub_name") + Me.columncity = Me.Columns("city") + Me.columnstate = Me.Columns("state") + Me.columncountry = Me.Columns("country") + End Sub + + Private Sub InitClass() + Me.columnpub_id = New DataColumn("pub_id", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnpub_id) + Me.columnpub_name = New DataColumn("pub_name", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnpub_name) + Me.columncity = New DataColumn("city", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columncity) + Me.columnstate = New DataColumn("state", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnstate) + Me.columncountry = New DataColumn("country", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columncountry) + Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnpub_id}, true)) + Me.columnpub_id.AllowDBNull = false + Me.columnpub_id.Unique = true + End Sub + + Public Function NewpublishersRow() As publishersRow + Return CType(Me.NewRow,publishersRow) + End Function + + Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow + Return New publishersRow(builder) + End Function + + Protected Overrides Function GetRowType() As System.Type + Return GetType(publishersRow) + End Function + + Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanged(e) + If (Not (Me.publishersRowChangedEvent) Is Nothing) Then + RaiseEvent publishersRowChanged(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanging(e) + If (Not (Me.publishersRowChangingEvent) Is Nothing) Then + RaiseEvent publishersRowChanging(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleted(e) + If (Not (Me.publishersRowDeletedEvent) Is Nothing) Then + RaiseEvent publishersRowDeleted(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleting(e) + If (Not (Me.publishersRowDeletingEvent) Is Nothing) Then + RaiseEvent publishersRowDeleting(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Public Sub RemovepublishersRow(ByVal row As publishersRow) + Me.Rows.Remove(row) + End Sub + End Class + + _ + Public Class publishersRow + Inherits DataRow + + Private tablepublishers As publishersDataTable + + Friend Sub New(ByVal rb As DataRowBuilder) + MyBase.New(rb) + Me.tablepublishers = CType(Me.Table,publishersDataTable) + End Sub + + Public Property pub_id As String + Get + Return CType(Me(Me.tablepublishers.pub_idColumn),String) + End Get + Set + Me(Me.tablepublishers.pub_idColumn) = value + End Set + End Property + + Public Property pub_name As String + Get + Try + Return CType(Me(Me.tablepublishers.pub_nameColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.pub_nameColumn) = value + End Set + End Property + + Public Property city As String + Get + Try + Return CType(Me(Me.tablepublishers.cityColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.cityColumn) = value + End Set + End Property + + Public Property state As String + Get + Try + Return CType(Me(Me.tablepublishers.stateColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.stateColumn) = value + End Set + End Property + + Public Property country As String + Get + Try + Return CType(Me(Me.tablepublishers.countryColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.countryColumn) = value + End Set + End Property + + Public Function Ispub_nameNull() As Boolean + Return Me.IsNull(Me.tablepublishers.pub_nameColumn) + End Function + + Public Sub Setpub_nameNull() + Me(Me.tablepublishers.pub_nameColumn) = System.Convert.DBNull + End Sub + + Public Function IscityNull() As Boolean + Return Me.IsNull(Me.tablepublishers.cityColumn) + End Function + + Public Sub SetcityNull() + Me(Me.tablepublishers.cityColumn) = System.Convert.DBNull + End Sub + + Public Function IsstateNull() As Boolean + Return Me.IsNull(Me.tablepublishers.stateColumn) + End Function + + Public Sub SetstateNull() + Me(Me.tablepublishers.stateColumn) = System.Convert.DBNull + End Sub + + Public Function IscountryNull() As Boolean + Return Me.IsNull(Me.tablepublishers.countryColumn) + End Function + + Public Sub SetcountryNull() + Me(Me.tablepublishers.countryColumn) = System.Convert.DBNull + End Sub + End Class + + _ + Public Class publishersRowChangeEvent + Inherits EventArgs + + Private eventRow As publishersRow + + Private eventAction As DataRowAction + + Public Sub New(ByVal row As publishersRow, ByVal action As DataRowAction) + MyBase.New + Me.eventRow = row + Me.eventAction = action + End Sub + + Public ReadOnly Property Row As publishersRow + Get + Return Me.eventRow + End Get + End Property + + Public ReadOnly Property Action As DataRowAction + Get + Return Me.eventAction + End Get + End Property + End Class +End Class diff --git a/Ch4 - Sorting/DataSet1.xsd b/Ch4 - Sorting/DataSet1.xsd new file mode 100644 index 0000000..651872e --- /dev/null +++ b/Ch4 - Sorting/DataSet1.xsd @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ch4 - Sorting/Global.asax b/Ch4 - Sorting/Global.asax new file mode 100644 index 0000000..8c705c8 --- /dev/null +++ b/Ch4 - Sorting/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch4___Sorting.Global" %> \ No newline at end of file diff --git a/Ch4 - Sorting/Global.asax.resx b/Ch4 - Sorting/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch4 - Sorting/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch4 - Sorting/Global.asax.vb b/Ch4 - Sorting/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch4 - Sorting/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch4 - Sorting/Read Me First.txt b/Ch4 - Sorting/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch4 - Sorting/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch4 - Sorting/Styles.css b/Ch4 - Sorting/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch4 - Sorting/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch4 - Sorting/Web.config b/Ch4 - Sorting/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch4 - Sorting/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Sorting/WebForm1.aspx b/Ch4 - Sorting/WebForm1.aspx new file mode 100644 index 0000000..07a0769 --- /dev/null +++ b/Ch4 - Sorting/WebForm1.aspx @@ -0,0 +1,29 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch4___Sorting.WebForm1"%> + + + + WebForm1 + + + + + + +
+ + + + + + + + + + + + + + +
+ + diff --git a/Ch4 - Sorting/WebForm1.aspx.resx b/Ch4 - Sorting/WebForm1.aspx.resx new file mode 100644 index 0000000..62e649b --- /dev/null +++ b/Ch4 - Sorting/WebForm1.aspx.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + 17, 17 + + + False + + + 145, 17 + + + False + + + 17, 17 + + + False + + + False + + + 17, 17 + + + False + + + False + + + 17, 17 + + + False + + + 17, 17 + + + 280, 17 + + \ No newline at end of file diff --git a/Ch4 - Sorting/WebForm1.aspx.vb b/Ch4 - Sorting/WebForm1.aspx.vb new file mode 100644 index 0000000..b201210 --- /dev/null +++ b/Ch4 - Sorting/WebForm1.aspx.vb @@ -0,0 +1,124 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlUpdateCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlDeleteCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection + Protected WithEvents MyDataAdapter As System.Data.SqlClient.SqlDataAdapter + Protected WithEvents MyDataSet As Ch4___Sorting.DataSet1 + Protected WithEvents MyDataGrid As System.Web.UI.WebControls.DataGrid + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection() + Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand() + Me.MyDataAdapter = New System.Data.SqlClient.SqlDataAdapter() + Me.MyDataSet = New Ch4___Sorting.DataSet1() + CType(Me.MyDataSet, System.ComponentModel.ISupportInitialize).BeginInit() + ' + 'SqlSelectCommand1 + ' + Me.SqlSelectCommand1.CommandText = "SELECT pub_id, pub_name, city, state, country FROM publishers" + Me.SqlSelectCommand1.Connection = Me.SqlConnection1 + ' + 'SqlConnection1 + ' + Me.SqlConnection1.ConnectionString = "data source=.;initial catalog=pubs;persist security info=False;user id=sa;packet " & _ + "size=4096;password=;" + ' + 'SqlInsertCommand1 + ' + Me.SqlInsertCommand1.CommandText = "INSERT INTO publishers(pub_id, pub_name, city, state, country) VALUES (@pub_id, @" & _ + "pub_name, @city, @state, @country); SELECT pub_id, pub_name, city, state, countr" & _ + "y FROM publishers WHERE (pub_id = @pub_id)" + Me.SqlInsertCommand1.Connection = Me.SqlConnection1 + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_id", System.Data.SqlDbType.VarChar, 4, "pub_id")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_name", System.Data.SqlDbType.VarChar, 40, "pub_name")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@city", System.Data.SqlDbType.VarChar, 20, "city")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@state", System.Data.SqlDbType.VarChar, 2, "state")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@country", System.Data.SqlDbType.VarChar, 30, "country")) + ' + 'SqlUpdateCommand1 + ' + Me.SqlUpdateCommand1.CommandText = "UPDATE publishers SET pub_id = @pub_id, pub_name = @pub_name, city = @city, state" & _ + " = @state, country = @country WHERE (pub_id = @Original_pub_id) AND (city = @Ori" & _ + "ginal_city OR @Original_city IS NULL AND city IS NULL) AND (country = @Original_" & _ + "country OR @Original_country IS NULL AND country IS NULL) AND (pub_name = @Origi" & _ + "nal_pub_name OR @Original_pub_name IS NULL AND pub_name IS NULL) AND (state = @O" & _ + "riginal_state OR @Original_state IS NULL AND state IS NULL); SELECT pub_id, pub_" & _ + "name, city, state, country FROM publishers WHERE (pub_id = @pub_id)" + Me.SqlUpdateCommand1.Connection = Me.SqlConnection1 + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_id", System.Data.SqlDbType.VarChar, 4, "pub_id")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_name", System.Data.SqlDbType.VarChar, 40, "pub_name")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@city", System.Data.SqlDbType.VarChar, 20, "city")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@state", System.Data.SqlDbType.VarChar, 2, "state")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@country", System.Data.SqlDbType.VarChar, 30, "country")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_id", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_city", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "city", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_country", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "country", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_name", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_name", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_state", System.Data.SqlDbType.VarChar, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "state", System.Data.DataRowVersion.Original, Nothing)) + ' + 'SqlDeleteCommand1 + ' + Me.SqlDeleteCommand1.CommandText = "DELETE FROM publishers WHERE (pub_id = @Original_pub_id) AND (city = @Original_ci" & _ + "ty OR @Original_city IS NULL AND city IS NULL) AND (country = @Original_country " & _ + "OR @Original_country IS NULL AND country IS NULL) AND (pub_name = @Original_pub_" & _ + "name OR @Original_pub_name IS NULL AND pub_name IS NULL) AND (state = @Original_" & _ + "state OR @Original_state IS NULL AND state IS NULL)" + Me.SqlDeleteCommand1.Connection = Me.SqlConnection1 + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_id", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_city", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "city", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_country", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "country", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_name", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_name", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_state", System.Data.SqlDbType.VarChar, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "state", System.Data.DataRowVersion.Original, Nothing)) + ' + 'MyDataAdapter + ' + Me.MyDataAdapter.DeleteCommand = Me.SqlDeleteCommand1 + Me.MyDataAdapter.InsertCommand = Me.SqlInsertCommand1 + Me.MyDataAdapter.SelectCommand = Me.SqlSelectCommand1 + Me.MyDataAdapter.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "publishers", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("pub_id", "pub_id"), New System.Data.Common.DataColumnMapping("pub_name", "pub_name"), New System.Data.Common.DataColumnMapping("city", "city"), New System.Data.Common.DataColumnMapping("state", "state"), New System.Data.Common.DataColumnMapping("country", "country")})}) + Me.MyDataAdapter.UpdateCommand = Me.SqlUpdateCommand1 + ' + 'MyDataSet + ' + Me.MyDataSet.DataSetName = "DataSet1" + Me.MyDataSet.Locale = New System.Globalization.CultureInfo("en-GB") + Me.MyDataSet.Namespace = "http://www.tempuri.org/DataSet1.xsd" + CType(Me.MyDataSet, System.ComponentModel.ISupportInitialize).EndInit() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + If Not IsPostBack Then + MyDataAdapter.Fill(MyDataSet) + MyDataGrid.DataBind() + End If + End Sub + + Private Sub MyDataGrid_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles MyDataGrid.SortCommand + ' Reset index, in case on a different page + MyDataGrid.CurrentPageIndex = 0 + ' Change SELECT statement + MyDataAdapter.SelectCommand.CommandText = _ + "SELECT * FROM publishers ORDER BY " & e.SortExpression + ' Refresh data and rebind + MyDataAdapter.Fill(MyDataSet) + MyDataGrid.DataBind() + End Sub +End Class diff --git a/Ch4 - Sorting/_vti_pvt/access.cnf b/Ch4 - Sorting/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch4 - Sorting/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch4 - Sorting/_vti_pvt/deptodoc.btr b/Ch4 - Sorting/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..65ea3b9 Binary files /dev/null and b/Ch4 - Sorting/_vti_pvt/deptodoc.btr differ diff --git a/Ch4 - Sorting/_vti_pvt/doctodep.btr b/Ch4 - Sorting/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch4 - Sorting/_vti_pvt/doctodep.btr differ diff --git a/Ch4 - Sorting/_vti_pvt/service.cnf b/Ch4 - Sorting/_vti_pvt/service.cnf new file mode 100644 index 0000000..017304d --- /dev/null +++ b/Ch4 - Sorting/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|06 Nov 2002 18:53:16 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch4 - Sorting/_vti_pvt/service.lck b/Ch4 - Sorting/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch4 - Sorting/_vti_pvt/services.cnf b/Ch4 - Sorting/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch4 - Sorting/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch4 - Sorting/bin/Ch4 - Sorting.dll b/Ch4 - Sorting/bin/Ch4 - Sorting.dll new file mode 100644 index 0000000..0f36027 Binary files /dev/null and b/Ch4 - Sorting/bin/Ch4 - Sorting.dll differ diff --git a/Ch4 - Sorting/bin/Ch4 - Sorting.pdb b/Ch4 - Sorting/bin/Ch4 - Sorting.pdb new file mode 100644 index 0000000..1aeef74 Binary files /dev/null and b/Ch4 - Sorting/bin/Ch4 - Sorting.pdb differ diff --git a/Ch4 - Web Grid/AssemblyInfo.vb b/Ch4 - Web Grid/AssemblyInfo.vb new file mode 100644 index 0000000..46e3b95 --- /dev/null +++ b/Ch4 - Web Grid/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch4 - Web Grid/Ch4 - Web Grid.sln b/Ch4 - Web Grid/Ch4 - Web Grid.sln new file mode 100644 index 0000000..75e2519 --- /dev/null +++ b/Ch4 - Web Grid/Ch4 - Web Grid.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch4 - Web Grid", "http://localhost/Ch4 - Web Grid/Ch4 - Web Grid.vbproj", "{26648A90-6D4B-4F58-BE2A-AD589ECCAF4C}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {26648A90-6D4B-4F58-BE2A-AD589ECCAF4C}.Debug.ActiveCfg = Debug|.NET + {26648A90-6D4B-4F58-BE2A-AD589ECCAF4C}.Debug.Build.0 = Debug|.NET + {26648A90-6D4B-4F58-BE2A-AD589ECCAF4C}.Release.ActiveCfg = Release|.NET + {26648A90-6D4B-4F58-BE2A-AD589ECCAF4C}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch4 - Web Grid/Ch4 - Web Grid.suo b/Ch4 - Web Grid/Ch4 - Web Grid.suo new file mode 100644 index 0000000..5bbc916 Binary files /dev/null and b/Ch4 - Web Grid/Ch4 - Web Grid.suo differ diff --git a/Ch4 - Web Grid/Ch4 - Web Grid.vbproj b/Ch4 - Web Grid/Ch4 - Web Grid.vbproj new file mode 100644 index 0000000..9782a5e --- /dev/null +++ b/Ch4 - Web Grid/Ch4 - Web Grid.vbproj @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Web Grid/Ch4 - Web Grid.vbproj.webinfo b/Ch4 - Web Grid/Ch4 - Web Grid.vbproj.webinfo new file mode 100644 index 0000000..b5a5382 --- /dev/null +++ b/Ch4 - Web Grid/Ch4 - Web Grid.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch4 - Web Grid/Ch4 - Web Grid.vsdisco b/Ch4 - Web Grid/Ch4 - Web Grid.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch4 - Web Grid/Ch4 - Web Grid.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch4 - Web Grid/Global.asax b/Ch4 - Web Grid/Global.asax new file mode 100644 index 0000000..bd5b9d9 --- /dev/null +++ b/Ch4 - Web Grid/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch4___Web_Grid.Global" %> \ No newline at end of file diff --git a/Ch4 - Web Grid/Global.asax.resx b/Ch4 - Web Grid/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch4 - Web Grid/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch4 - Web Grid/Global.asax.vb b/Ch4 - Web Grid/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch4 - Web Grid/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch4 - Web Grid/Publisher.vb b/Ch4 - Web Grid/Publisher.vb new file mode 100644 index 0000000..516aa41 --- /dev/null +++ b/Ch4 - Web Grid/Publisher.vb @@ -0,0 +1,455 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version: 1.0.3705.288 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict Off +Option Explicit On + +Imports System +Imports System.Data +Imports System.Runtime.Serialization +Imports System.Xml + + + _ +Public Class Publisher + Inherits DataSet + + Private tablepublishers As publishersDataTable + + Public Sub New() + MyBase.New + Me.InitClass + Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged + AddHandler Me.Tables.CollectionChanged, schemaChangedHandler + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler + End Sub + + Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext) + MyBase.New + Dim strSchema As String = CType(info.GetValue("XmlSchema", GetType(System.String)),String) + If (Not (strSchema) Is Nothing) Then + Dim ds As DataSet = New DataSet + ds.ReadXmlSchema(New XmlTextReader(New System.IO.StringReader(strSchema))) + If (Not (ds.Tables("publishers")) Is Nothing) Then + Me.Tables.Add(New publishersDataTable(ds.Tables("publishers"))) + End If + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.Namespace = ds.Namespace + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) + Me.InitVars + Else + Me.InitClass + End If + Me.GetSerializationData(info, context) + Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged + AddHandler Me.Tables.CollectionChanged, schemaChangedHandler + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler + End Sub + + _ + Public ReadOnly Property publishers As publishersDataTable + Get + Return Me.tablepublishers + End Get + End Property + + Public Overrides Function Clone() As DataSet + Dim cln As Publisher = CType(MyBase.Clone,Publisher) + cln.InitVars + Return cln + End Function + + Protected Overrides Function ShouldSerializeTables() As Boolean + Return false + End Function + + Protected Overrides Function ShouldSerializeRelations() As Boolean + Return false + End Function + + Protected Overrides Sub ReadXmlSerializable(ByVal reader As XmlReader) + Me.Reset + Dim ds As DataSet = New DataSet + ds.ReadXml(reader) + If (Not (ds.Tables("publishers")) Is Nothing) Then + Me.Tables.Add(New publishersDataTable(ds.Tables("publishers"))) + End If + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.Namespace = ds.Namespace + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) + Me.InitVars + End Sub + + Protected Overrides Function GetSchemaSerializable() As System.Xml.Schema.XmlSchema + Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream + Me.WriteXmlSchema(New XmlTextWriter(stream, Nothing)) + stream.Position = 0 + Return System.Xml.Schema.XmlSchema.Read(New XmlTextReader(stream), Nothing) + End Function + + Friend Sub InitVars() + Me.tablepublishers = CType(Me.Tables("publishers"),publishersDataTable) + If (Not (Me.tablepublishers) Is Nothing) Then + Me.tablepublishers.InitVars + End If + End Sub + + Private Sub InitClass() + Me.DataSetName = "Publisher" + Me.Prefix = "" + Me.Namespace = "http://www.tempuri.org/Publisher.xsd" + Me.Locale = New System.Globalization.CultureInfo("en-GB") + Me.CaseSensitive = false + Me.EnforceConstraints = true + Me.tablepublishers = New publishersDataTable + Me.Tables.Add(Me.tablepublishers) + End Sub + + Private Function ShouldSerializepublishers() As Boolean + Return false + End Function + + Private Sub SchemaChanged(ByVal sender As Object, ByVal e As System.ComponentModel.CollectionChangeEventArgs) + If (e.Action = System.ComponentModel.CollectionChangeAction.Remove) Then + Me.InitVars + End If + End Sub + + Public Delegate Sub publishersRowChangeEventHandler(ByVal sender As Object, ByVal e As publishersRowChangeEvent) + + _ + Public Class publishersDataTable + Inherits DataTable + Implements System.Collections.IEnumerable + + Private columnpub_id As DataColumn + + Private columnpub_name As DataColumn + + Private columncity As DataColumn + + Private columnstate As DataColumn + + Private columncountry As DataColumn + + Friend Sub New() + MyBase.New("publishers") + Me.InitClass + End Sub + + Friend Sub New(ByVal table As DataTable) + MyBase.New(table.TableName) + If (table.CaseSensitive <> table.DataSet.CaseSensitive) Then + Me.CaseSensitive = table.CaseSensitive + End If + If (table.Locale.ToString <> table.DataSet.Locale.ToString) Then + Me.Locale = table.Locale + End If + If (table.Namespace <> table.DataSet.Namespace) Then + Me.Namespace = table.Namespace + End If + Me.Prefix = table.Prefix + Me.MinimumCapacity = table.MinimumCapacity + Me.DisplayExpression = table.DisplayExpression + End Sub + + _ + Public ReadOnly Property Count As Integer + Get + Return Me.Rows.Count + End Get + End Property + + Friend ReadOnly Property pub_idColumn As DataColumn + Get + Return Me.columnpub_id + End Get + End Property + + Friend ReadOnly Property pub_nameColumn As DataColumn + Get + Return Me.columnpub_name + End Get + End Property + + Friend ReadOnly Property cityColumn As DataColumn + Get + Return Me.columncity + End Get + End Property + + Friend ReadOnly Property stateColumn As DataColumn + Get + Return Me.columnstate + End Get + End Property + + Friend ReadOnly Property countryColumn As DataColumn + Get + Return Me.columncountry + End Get + End Property + + Public Default ReadOnly Property Item(ByVal index As Integer) As publishersRow + Get + Return CType(Me.Rows(index),publishersRow) + End Get + End Property + + Public Event publishersRowChanged As publishersRowChangeEventHandler + + Public Event publishersRowChanging As publishersRowChangeEventHandler + + Public Event publishersRowDeleted As publishersRowChangeEventHandler + + Public Event publishersRowDeleting As publishersRowChangeEventHandler + + Public Overloads Sub AddpublishersRow(ByVal row As publishersRow) + Me.Rows.Add(row) + End Sub + + Public Overloads Function AddpublishersRow(ByVal pub_id As String, ByVal pub_name As String, ByVal city As String, ByVal state As String, ByVal country As String) As publishersRow + Dim rowpublishersRow As publishersRow = CType(Me.NewRow,publishersRow) + rowpublishersRow.ItemArray = New Object() {pub_id, pub_name, city, state, country} + Me.Rows.Add(rowpublishersRow) + Return rowpublishersRow + End Function + + Public Function FindBypub_id(ByVal pub_id As String) As publishersRow + Return CType(Me.Rows.Find(New Object() {pub_id}),publishersRow) + End Function + + Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator + Return Me.Rows.GetEnumerator + End Function + + Public Overrides Function Clone() As DataTable + Dim cln As publishersDataTable = CType(MyBase.Clone,publishersDataTable) + cln.InitVars + Return cln + End Function + + Protected Overrides Function CreateInstance() As DataTable + Return New publishersDataTable + End Function + + Friend Sub InitVars() + Me.columnpub_id = Me.Columns("pub_id") + Me.columnpub_name = Me.Columns("pub_name") + Me.columncity = Me.Columns("city") + Me.columnstate = Me.Columns("state") + Me.columncountry = Me.Columns("country") + End Sub + + Private Sub InitClass() + Me.columnpub_id = New DataColumn("pub_id", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnpub_id) + Me.columnpub_name = New DataColumn("pub_name", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnpub_name) + Me.columncity = New DataColumn("city", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columncity) + Me.columnstate = New DataColumn("state", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columnstate) + Me.columncountry = New DataColumn("country", GetType(System.String), Nothing, System.Data.MappingType.Element) + Me.Columns.Add(Me.columncountry) + Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnpub_id}, true)) + Me.columnpub_id.AllowDBNull = false + Me.columnpub_id.Unique = true + End Sub + + Public Function NewpublishersRow() As publishersRow + Return CType(Me.NewRow,publishersRow) + End Function + + Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow + Return New publishersRow(builder) + End Function + + Protected Overrides Function GetRowType() As System.Type + Return GetType(publishersRow) + End Function + + Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanged(e) + If (Not (Me.publishersRowChangedEvent) Is Nothing) Then + RaiseEvent publishersRowChanged(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowChanging(e) + If (Not (Me.publishersRowChangingEvent) Is Nothing) Then + RaiseEvent publishersRowChanging(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleted(e) + If (Not (Me.publishersRowDeletedEvent) Is Nothing) Then + RaiseEvent publishersRowDeleted(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs) + MyBase.OnRowDeleting(e) + If (Not (Me.publishersRowDeletingEvent) Is Nothing) Then + RaiseEvent publishersRowDeleting(Me, New publishersRowChangeEvent(CType(e.Row,publishersRow), e.Action)) + End If + End Sub + + Public Sub RemovepublishersRow(ByVal row As publishersRow) + Me.Rows.Remove(row) + End Sub + End Class + + _ + Public Class publishersRow + Inherits DataRow + + Private tablepublishers As publishersDataTable + + Friend Sub New(ByVal rb As DataRowBuilder) + MyBase.New(rb) + Me.tablepublishers = CType(Me.Table,publishersDataTable) + End Sub + + Public Property pub_id As String + Get + Return CType(Me(Me.tablepublishers.pub_idColumn),String) + End Get + Set + Me(Me.tablepublishers.pub_idColumn) = value + End Set + End Property + + Public Property pub_name As String + Get + Try + Return CType(Me(Me.tablepublishers.pub_nameColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.pub_nameColumn) = value + End Set + End Property + + Public Property city As String + Get + Try + Return CType(Me(Me.tablepublishers.cityColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.cityColumn) = value + End Set + End Property + + Public Property state As String + Get + Try + Return CType(Me(Me.tablepublishers.stateColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.stateColumn) = value + End Set + End Property + + Public Property country As String + Get + Try + Return CType(Me(Me.tablepublishers.countryColumn),String) + Catch e As InvalidCastException + Throw New StrongTypingException("Cannot get value because it is DBNull.", e) + End Try + End Get + Set + Me(Me.tablepublishers.countryColumn) = value + End Set + End Property + + Public Function Ispub_nameNull() As Boolean + Return Me.IsNull(Me.tablepublishers.pub_nameColumn) + End Function + + Public Sub Setpub_nameNull() + Me(Me.tablepublishers.pub_nameColumn) = System.Convert.DBNull + End Sub + + Public Function IscityNull() As Boolean + Return Me.IsNull(Me.tablepublishers.cityColumn) + End Function + + Public Sub SetcityNull() + Me(Me.tablepublishers.cityColumn) = System.Convert.DBNull + End Sub + + Public Function IsstateNull() As Boolean + Return Me.IsNull(Me.tablepublishers.stateColumn) + End Function + + Public Sub SetstateNull() + Me(Me.tablepublishers.stateColumn) = System.Convert.DBNull + End Sub + + Public Function IscountryNull() As Boolean + Return Me.IsNull(Me.tablepublishers.countryColumn) + End Function + + Public Sub SetcountryNull() + Me(Me.tablepublishers.countryColumn) = System.Convert.DBNull + End Sub + End Class + + _ + Public Class publishersRowChangeEvent + Inherits EventArgs + + Private eventRow As publishersRow + + Private eventAction As DataRowAction + + Public Sub New(ByVal row As publishersRow, ByVal action As DataRowAction) + MyBase.New + Me.eventRow = row + Me.eventAction = action + End Sub + + Public ReadOnly Property Row As publishersRow + Get + Return Me.eventRow + End Get + End Property + + Public ReadOnly Property Action As DataRowAction + Get + Return Me.eventAction + End Get + End Property + End Class +End Class diff --git a/Ch4 - Web Grid/Publisher.xsd b/Ch4 - Web Grid/Publisher.xsd new file mode 100644 index 0000000..e13f8f9 --- /dev/null +++ b/Ch4 - Web Grid/Publisher.xsd @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ch4 - Web Grid/Read Me First.txt b/Ch4 - Web Grid/Read Me First.txt new file mode 100644 index 0000000..243d649 --- /dev/null +++ b/Ch4 - Web Grid/Read Me First.txt @@ -0,0 +1,12 @@ +Note! +====== + +This is a Web project and therefore will require a little setting up before it will work properly. + + * In Windows Explorer, right-click on this project folder and select Properites + + * Select the Web Sharing tab and click 'Share the folder' + + * Stick with the default folder name, then click OK + + * Double-click on the solution inside the folder (the .SLN file) to open in Visual Studio .NET! \ No newline at end of file diff --git a/Ch4 - Web Grid/Styles.css b/Ch4 - Web Grid/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch4 - Web Grid/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch4 - Web Grid/Web.config b/Ch4 - Web Grid/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch4 - Web Grid/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch4 - Web Grid/WebForm1.aspx b/Ch4 - Web Grid/WebForm1.aspx new file mode 100644 index 0000000..b6ab1f7 --- /dev/null +++ b/Ch4 - Web Grid/WebForm1.aspx @@ -0,0 +1,32 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch4___Web_Grid.WebForm1"%> + + + + Nine Steps to a Quick, Editable Web Grid + + + + + + +
+ + + + + + + + + + + + + + + + + You may need to change the ConnectionString property of MyConnection before starting! +
+ + diff --git a/Ch4 - Web Grid/WebForm1.aspx.resx b/Ch4 - Web Grid/WebForm1.aspx.resx new file mode 100644 index 0000000..7461cab --- /dev/null +++ b/Ch4 - Web Grid/WebForm1.aspx.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + 17, 17 + + + False + + + 145, 17 + + + False + + + 17, 17 + + + False + + + False + + + 17, 17 + + + False + + + False + + + 17, 17 + + + False + + + 17, 17 + + + 266, 17 + + \ No newline at end of file diff --git a/Ch4 - Web Grid/WebForm1.aspx.vb b/Ch4 - Web Grid/WebForm1.aspx.vb new file mode 100644 index 0000000..d73eba5 --- /dev/null +++ b/Ch4 - Web Grid/WebForm1.aspx.vb @@ -0,0 +1,265 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlUpdateCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents SqlDeleteCommand1 As System.Data.SqlClient.SqlCommand + Protected WithEvents MyConnection As System.Data.SqlClient.SqlConnection + Protected WithEvents MyDataGrid As System.Web.UI.WebControls.DataGrid + Protected WithEvents MyDataSet As Ch4___Web_Grid.Publisher + Protected WithEvents Button1 As System.Web.UI.WebControls.Button + Protected WithEvents Button2 As System.Web.UI.WebControls.Button + Protected WithEvents Button3 As System.Web.UI.WebControls.Button + Protected WithEvents Button4 As System.Web.UI.WebControls.Button + Protected WithEvents Button5 As System.Web.UI.WebControls.Button + Protected WithEvents Button6 As System.Web.UI.WebControls.Button + Protected WithEvents Label1 As System.Web.UI.WebControls.Label + Protected WithEvents MyDataAdapter As System.Data.SqlClient.SqlDataAdapter + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand() + Me.MyConnection = New System.Data.SqlClient.SqlConnection() + Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand() + Me.SqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand() + Me.MyDataAdapter = New System.Data.SqlClient.SqlDataAdapter() + Me.MyDataSet = New Ch4___Web_Grid.Publisher() + CType(Me.MyDataSet, System.ComponentModel.ISupportInitialize).BeginInit() + ' + 'SqlSelectCommand1 + ' + Me.SqlSelectCommand1.CommandText = "SELECT pub_id, pub_name, city, state, country FROM publishers" + Me.SqlSelectCommand1.Connection = Me.MyConnection + ' + 'MyConnection + ' + Me.MyConnection.ConnectionString = "data source=.;initial catalog=pubs;persist security info=False;user id=sa;packet " & _ + "size=4096;password=;" + ' + 'SqlInsertCommand1 + ' + Me.SqlInsertCommand1.CommandText = "INSERT INTO publishers(pub_id, pub_name, city, state, country) VALUES (@pub_id, @" & _ + "pub_name, @city, @state, @country); SELECT pub_id, pub_name, city, state, countr" & _ + "y FROM publishers WHERE (pub_id = @pub_id)" + Me.SqlInsertCommand1.Connection = Me.MyConnection + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_id", System.Data.SqlDbType.VarChar, 4, "pub_id")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_name", System.Data.SqlDbType.VarChar, 40, "pub_name")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@city", System.Data.SqlDbType.VarChar, 20, "city")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@state", System.Data.SqlDbType.VarChar, 2, "state")) + Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@country", System.Data.SqlDbType.VarChar, 30, "country")) + ' + 'SqlUpdateCommand1 + ' + Me.SqlUpdateCommand1.CommandText = "UPDATE publishers SET pub_id = @pub_id, pub_name = @pub_name, city = @city, state" & _ + " = @state, country = @country WHERE (pub_id = @Original_pub_id) AND (city = @Ori" & _ + "ginal_city OR @Original_city IS NULL AND city IS NULL) AND (country = @Original_" & _ + "country OR @Original_country IS NULL AND country IS NULL) AND (pub_name = @Origi" & _ + "nal_pub_name OR @Original_pub_name IS NULL AND pub_name IS NULL) AND (state = @O" & _ + "riginal_state OR @Original_state IS NULL AND state IS NULL); SELECT pub_id, pub_" & _ + "name, city, state, country FROM publishers WHERE (pub_id = @pub_id)" + Me.SqlUpdateCommand1.Connection = Me.MyConnection + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_id", System.Data.SqlDbType.VarChar, 4, "pub_id")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@pub_name", System.Data.SqlDbType.VarChar, 40, "pub_name")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@city", System.Data.SqlDbType.VarChar, 20, "city")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@state", System.Data.SqlDbType.VarChar, 2, "state")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@country", System.Data.SqlDbType.VarChar, 30, "country")) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_id", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_city", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "city", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_country", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "country", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_name", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_name", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_state", System.Data.SqlDbType.VarChar, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "state", System.Data.DataRowVersion.Original, Nothing)) + ' + 'SqlDeleteCommand1 + ' + Me.SqlDeleteCommand1.CommandText = "DELETE FROM publishers WHERE (pub_id = @Original_pub_id) AND (city = @Original_ci" & _ + "ty OR @Original_city IS NULL AND city IS NULL) AND (country = @Original_country " & _ + "OR @Original_country IS NULL AND country IS NULL) AND (pub_name = @Original_pub_" & _ + "name OR @Original_pub_name IS NULL AND pub_name IS NULL) AND (state = @Original_" & _ + "state OR @Original_state IS NULL AND state IS NULL)" + Me.SqlDeleteCommand1.Connection = Me.MyConnection + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_id", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_id", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_city", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "city", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_country", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "country", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_pub_name", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "pub_name", System.Data.DataRowVersion.Original, Nothing)) + Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_state", System.Data.SqlDbType.VarChar, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "state", System.Data.DataRowVersion.Original, Nothing)) + ' + 'MyDataAdapter + ' + Me.MyDataAdapter.DeleteCommand = Me.SqlDeleteCommand1 + Me.MyDataAdapter.InsertCommand = Me.SqlInsertCommand1 + Me.MyDataAdapter.SelectCommand = Me.SqlSelectCommand1 + Me.MyDataAdapter.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "publishers", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("pub_id", "pub_id"), New System.Data.Common.DataColumnMapping("pub_name", "pub_name"), New System.Data.Common.DataColumnMapping("city", "city"), New System.Data.Common.DataColumnMapping("state", "state"), New System.Data.Common.DataColumnMapping("country", "country")})}) + Me.MyDataAdapter.UpdateCommand = Me.SqlUpdateCommand1 + ' + 'MyDataSet + ' + Me.MyDataSet.DataSetName = "Publisher" + Me.MyDataSet.Locale = New System.Globalization.CultureInfo("en-GB") + Me.MyDataSet.Namespace = "http://www.tempuri.org/Publisher.xsd" + CType(Me.MyDataSet, System.ComponentModel.ISupportInitialize).EndInit() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + ' TODO: Change the ConnectionString property of MyConnection to get sample to work correctly + + If Not IsPostBack Then + MyDataAdapter.Fill(MyDataSet) + MyDataGrid.DataSource = MyDataSet + MyDataGrid.DataBind() + DataSave(MyDataSet) + ' The DataSave function will be added later. + ' Remove this line and stop here if you want + ' a read-only DataGrid + End If + End Sub + + Private Sub DataGrid1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyDataGrid.SelectedIndexChanged + Dim intCount As Integer + For intCount = 1 To MyDataGrid.Items.Count + MyDataGrid.Items(intCount - 1).BorderStyle = BorderStyle.Groove + Next + MyDataGrid.SelectedItem.BorderStyle = BorderStyle.Dashed + End Sub + + Public Sub DataSave(ByVal DataSet As DataSet) + If DataExists() Then + ViewState.Item("__Data") = DataSet + Else + ViewState.Add("__Data", DataSet) + End If + End Sub + + Public Function DataRetrieve() As DataSet + Return CType(ViewState.Item("__Data"), DataSet) + End Function + + Public Function DataExists() As Boolean + If Not ViewState.Item("__Data") Is Nothing Then Return True + End Function + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + ' Code to respond to the Click event of the ADD button: + ' Desc: Adds a new row to the DataSet, rebinds to the + ' DataGrid, then makes the row editable + If DataExists() = False Then Exit Sub + MyDataSet = DataRetrieve() + Dim rowNew As System.Data.DataRow = MyDataSet.Tables(0).NewRow + ' Enter sample values for non-null fields here + ' ie, rowNew.Item("uniqueTag") = "sample" + ' Alternatively, use separate text boxes for input + ' and add field values in code, as above. + + rowNew.Item("pub_id") = 0 + ' Note: This database requires the pub_id field + ' to be within a specified range. When changing + ' this default of zero, try specifying a new ID + ' among the existing ranges - ie, 9985 + + MyDataSet.Tables(0).Rows.Add(rowNew) + MyDataGrid.EditItemIndex = MyDataGrid.Items.Count + MyDataGrid.DataSource = MyDataSet + MyDataGrid.DataBind() + DataSave(MyDataSet) + End Sub + + Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click + ' Code to respond to the Click event of the DELETE button: + ' Desc: Deletes the selected row, updates the DataSet, then rebinds + If DataExists() = False Then Exit Sub + If MyDataGrid.SelectedIndex = -1 Then Exit Sub + MyDataSet = DataRetrieve() + MyDataSet.Tables(0).Rows(MyDataGrid.SelectedIndex).Delete() + MyDataGrid.EditItemIndex = -1 + MyDataGrid.SelectedIndex = -1 + MyDataGrid.DataSource = MyDataSet + MyDataGrid.DataBind() + DataSave(MyDataSet) + End Sub + + Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click + ' Code to respond to the Click event of the EDIT button: + ' Desc: Makes the selected row editable, then rebinds + If DataExists() = False Then Exit Sub + If MyDataGrid.SelectedIndex = -1 Then Exit Sub + Dim MyDataSet As DataSet = DataRetrieve() + MyDataGrid.DataSource = MyDataSet + MyDataGrid.EditItemIndex = MyDataGrid.SelectedIndex + MyDataGrid.DataBind() + End Sub + + Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click + ' Code to respond to the Click event of the OK button: + ' Desc: Cycles through the TextBox controls used during a standard edit, + ' puts the values back in the DataSet, then rebinds. Add error handling + ' as appropriate. + ' NOTE: This code relies on the first column being a selection (>) button + ' (it starts counting the cells from position 1, not 0). If you remove that + ' button, you may have to change this code. + If DataExists() = False Then Exit Sub + If MyDataGrid.EditItemIndex = -1 Then Exit Sub + Dim intCount As Integer + Dim MyDataSet As DataSet = DataRetrieve() + With MyDataGrid + For intCount = 1 To .Items(.EditItemIndex).Cells.Count + If intCount = .Items(.EditItemIndex).Cells.Count Then Exit For + ' Check that a control exists in this position + If .Items(.EditItemIndex).Cells(intCount).Controls.Count Then + ' Check for a standard TextBox + If TypeOf (.Items(.EditItemIndex).Cells(intCount).Controls(0)) _ + Is TextBox Then + Dim strValue As String = CType(.Items(.EditItemIndex). _ + Cells(intCount).Controls(0), TextBox).Text + If strValue <> "" Then + ' This isn't null, so store value + MyDataSet.Tables(0).Rows(.EditItemIndex).Item( _ + intCount - 1) = strValue + Else + ' Treat empty value as null + MyDataSet.Tables(0).Rows(.EditItemIndex).Item( _ + intCount - 1) = System.DBNull.Value + End If + End If + End If + Next + .SelectedIndex = -1 + .EditItemIndex = -1 + DataSave(MyDataSet) + .DataSource = MyDataSet + .DataBind() + End With + End Sub + + Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click + ' Code to respond to the Click event of the CANCEL button: + ' Desc: Used to cancel an edit. Deselects an selected rows and + ' exists the edit mode, then rebinds. + If DataExists() = False Then Exit Sub + MyDataGrid.SelectedIndex = -1 + MyDataGrid.EditItemIndex = -1 + MyDataGrid.DataSource = DataRetrieve() + MyDataGrid.DataBind() + End Sub + + Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click + ' Code to respond to the Click event of the UPDATE button: + ' Desc: Updates the underlying database, then rebinds. + ' Add error handling code as appropriate. + If DataExists() = False Then Exit Sub + MyDataAdapter.Update(DataRetrieve) + MyDataGrid.DataSource = DataRetrieve() + MyDataGrid.DataBind() + End Sub +End Class diff --git a/Ch4 - Web Grid/_vti_pvt/access.cnf b/Ch4 - Web Grid/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch4 - Web Grid/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch4 - Web Grid/_vti_pvt/deptodoc.btr b/Ch4 - Web Grid/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..65ea3b9 Binary files /dev/null and b/Ch4 - Web Grid/_vti_pvt/deptodoc.btr differ diff --git a/Ch4 - Web Grid/_vti_pvt/doctodep.btr b/Ch4 - Web Grid/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch4 - Web Grid/_vti_pvt/doctodep.btr differ diff --git a/Ch4 - Web Grid/_vti_pvt/service.cnf b/Ch4 - Web Grid/_vti_pvt/service.cnf new file mode 100644 index 0000000..21c0978 --- /dev/null +++ b/Ch4 - Web Grid/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|06 Nov 2002 16:12:50 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch4 - Web Grid/_vti_pvt/service.lck b/Ch4 - Web Grid/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch4 - Web Grid/_vti_pvt/services.cnf b/Ch4 - Web Grid/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch4 - Web Grid/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch4 - Web Grid/bin/Ch4 - Web Grid.dll b/Ch4 - Web Grid/bin/Ch4 - Web Grid.dll new file mode 100644 index 0000000..524ff8f Binary files /dev/null and b/Ch4 - Web Grid/bin/Ch4 - Web Grid.dll differ diff --git a/Ch4 - Web Grid/bin/Ch4 - Web Grid.pdb b/Ch4 - Web Grid/bin/Ch4 - Web Grid.pdb new file mode 100644 index 0000000..a7c3241 Binary files /dev/null and b/Ch4 - Web Grid/bin/Ch4 - Web Grid.pdb differ diff --git a/Ch5 - Amazon/AssemblyInfo.vb b/Ch5 - Amazon/AssemblyInfo.vb new file mode 100644 index 0000000..e6fb84d --- /dev/null +++ b/Ch5 - Amazon/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch5 - Amazon/Ch5 - Amazon.sln b/Ch5 - Amazon/Ch5 - Amazon.sln new file mode 100644 index 0000000..336871f --- /dev/null +++ b/Ch5 - Amazon/Ch5 - Amazon.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch5 - Amazon", "Ch5 - Amazon.vbproj", "{420B73FF-621B-467E-A827-0E33B375F756}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {420B73FF-621B-467E-A827-0E33B375F756}.Debug.ActiveCfg = Debug|.NET + {420B73FF-621B-467E-A827-0E33B375F756}.Debug.Build.0 = Debug|.NET + {420B73FF-621B-467E-A827-0E33B375F756}.Release.ActiveCfg = Release|.NET + {420B73FF-621B-467E-A827-0E33B375F756}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch5 - Amazon/Ch5 - Amazon.suo b/Ch5 - Amazon/Ch5 - Amazon.suo new file mode 100644 index 0000000..6e1c1a3 Binary files /dev/null and b/Ch5 - Amazon/Ch5 - Amazon.suo differ diff --git a/Ch5 - Amazon/Ch5 - Amazon.vbproj b/Ch5 - Amazon/Ch5 - Amazon.vbproj new file mode 100644 index 0000000..dc1312a --- /dev/null +++ b/Ch5 - Amazon/Ch5 - Amazon.vbproj @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch5 - Amazon/Ch5 - Amazon.vbproj.user b/Ch5 - Amazon/Ch5 - Amazon.vbproj.user new file mode 100644 index 0000000..c168d10 --- /dev/null +++ b/Ch5 - Amazon/Ch5 - Amazon.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch5 - Amazon/Form1.resx b/Ch5 - Amazon/Form1.resx new file mode 100644 index 0000000..a999729 --- /dev/null +++ b/Ch5 - Amazon/Form1.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch5 - Amazon/Form1.vb b/Ch5 - Amazon/Form1.vb new file mode 100644 index 0000000..fb07142 --- /dev/null +++ b/Ch5 - Amazon/Form1.vb @@ -0,0 +1,216 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents Label2 As System.Windows.Forms.Label + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents txtResults As System.Windows.Forms.TextBox + Friend WithEvents lnkAmazon As System.Windows.Forms.LinkLabel + Friend WithEvents Button2 As System.Windows.Forms.Button + Friend WithEvents Label3 As System.Windows.Forms.Label + Friend WithEvents Label4 As System.Windows.Forms.Label + Friend WithEvents TextBox2 As System.Windows.Forms.TextBox + Friend WithEvents ListBox1 As System.Windows.Forms.ListBox + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.Label2 = New System.Windows.Forms.Label() + Me.Label1 = New System.Windows.Forms.Label() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.txtResults = New System.Windows.Forms.TextBox() + Me.lnkAmazon = New System.Windows.Forms.LinkLabel() + Me.Button2 = New System.Windows.Forms.Button() + Me.Label3 = New System.Windows.Forms.Label() + Me.Label4 = New System.Windows.Forms.Label() + Me.TextBox2 = New System.Windows.Forms.TextBox() + Me.ListBox1 = New System.Windows.Forms.ListBox() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(344, 48) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(48, 24) + Me.Button1.TabIndex = 7 + Me.Button1.Text = "Go" + ' + 'Label2 + ' + Me.Label2.Location = New System.Drawing.Point(48, 48) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(88, 16) + Me.Label2.TabIndex = 6 + Me.Label2.Text = "Enter an ISBN:" + ' + 'Label1 + ' + Me.Label1.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label1.Location = New System.Drawing.Point(16, 16) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(184, 24) + Me.Label1.TabIndex = 5 + Me.Label1.Text = "ISBN Lookup" + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(144, 48) + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(176, 20) + Me.TextBox1.TabIndex = 4 + Me.TextBox1.Text = "159059021X" + ' + 'txtResults + ' + Me.txtResults.Location = New System.Drawing.Point(48, 96) + Me.txtResults.Multiline = True + Me.txtResults.Name = "txtResults" + Me.txtResults.Size = New System.Drawing.Size(352, 40) + Me.txtResults.TabIndex = 8 + Me.txtResults.Text = "" + ' + 'lnkAmazon + ' + Me.lnkAmazon.Location = New System.Drawing.Point(48, 144) + Me.lnkAmazon.Name = "lnkAmazon" + Me.lnkAmazon.Size = New System.Drawing.Size(272, 23) + Me.lnkAmazon.TabIndex = 9 + Me.lnkAmazon.TabStop = True + Me.lnkAmazon.Text = "Click here for more information" + Me.lnkAmazon.Visible = False + ' + 'Button2 + ' + Me.Button2.Location = New System.Drawing.Point(344, 216) + Me.Button2.Name = "Button2" + Me.Button2.Size = New System.Drawing.Size(48, 24) + Me.Button2.TabIndex = 13 + Me.Button2.Text = "Go" + ' + 'Label3 + ' + Me.Label3.Location = New System.Drawing.Point(48, 216) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(88, 16) + Me.Label3.TabIndex = 12 + Me.Label3.Text = "Enter a term:" + ' + 'Label4 + ' + Me.Label4.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label4.Location = New System.Drawing.Point(16, 184) + Me.Label4.Name = "Label4" + Me.Label4.Size = New System.Drawing.Size(184, 24) + Me.Label4.TabIndex = 11 + Me.Label4.Text = "Book Search" + ' + 'TextBox2 + ' + Me.TextBox2.Location = New System.Drawing.Point(144, 216) + Me.TextBox2.Name = "TextBox2" + Me.TextBox2.Size = New System.Drawing.Size(176, 20) + Me.TextBox2.TabIndex = 10 + Me.TextBox2.Text = "Angela Lansbury" + ' + 'ListBox1 + ' + Me.ListBox1.Location = New System.Drawing.Point(56, 264) + Me.ListBox1.Name = "ListBox1" + Me.ListBox1.Size = New System.Drawing.Size(344, 69) + Me.ListBox1.TabIndex = 14 + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(440, 358) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.ListBox1, Me.Button2, Me.Label3, Me.Label4, Me.TextBox2, Me.lnkAmazon, Me.txtResults, Me.Button1, Me.Label2, Me.Label1, Me.TextBox1}) + Me.Name = "Form1" + Me.Text = "Querying the Amazon.com Web Service" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + ' Create new search service object + Dim objSearch As New _ + com.amazon.soap.AmazonSearchService() + ' Define properties for a new ASIN request + Dim objASIN As New com.amazon.soap.AsinRequest() + With objASIN + .asin = TextBox1.Text + .devtag = "XXXXXX" + .type = "lite" + .tag = "your-assoc-id" + End With + ' Perform ASIN search request and + ' return ProductInfo object + Dim objProductInfo As New com.amazon.soap.ProductInfo() + objProductInfo = objSearch.AsinSearchRequest(objASIN) + ' Retrieve various details + txtResults.Text = objProductInfo.Details(0).ProductName & _ + ", Price: " & objProductInfo.Details(0).OurPrice + txtResults.Text += vbNewLine & "Author(s): " & _ + Join(objProductInfo.Details(0).Authors, ", ") + lnkAmazon.Visible = True + lnkAmazon.Tag = objProductInfo.Details(0).Url + End Sub + + Private Sub lnkAmazon_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkAmazon.LinkClicked + System.Diagnostics.Process.Start(lnkAmazon.Tag) + End Sub + + Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click + ' Create new search service object + Dim objSearch As New _ + com.amazon.soap.AmazonSearchService() + ' Define properties for a new keyword request + Dim objKeyword As New com.amazon.soap.KeywordRequest() + With objKeyword + .keyword = TextBox2.Text + .devtag = "XXXXXX" + .mode = "books" + .type = "heavy" + .tag = "your-assoc-id" + .page = "1" + End With + ' Perform keyword search request and + ' return ProductInfo object + Dim objProductInfo As New com.amazon.soap.ProductInfo() + objProductInfo = objSearch.KeywordSearchRequest(objKeyword) + ' Cycle through results + Dim shtCount As Short + ListBox1.Items.Clear() + For shtCount = 0 To objProductInfo.Details.Length - 1 + ListBox1.Items.Add(objProductInfo.Details(shtCount).OurPrice & " > " & objProductInfo.Details(shtCount).ProductName) + Next + End Sub +End Class diff --git a/Ch5 - Amazon/Web References/com.amazon.soap/AmazonSearch.wsdl b/Ch5 - Amazon/Web References/com.amazon.soap/AmazonSearch.wsdl new file mode 100644 index 0000000..84eb665 --- /dev/null +++ b/Ch5 - Amazon/Web References/com.amazon.soap/AmazonSearch.wsdl @@ -0,0 +1,990 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ch5 - Amazon/Web References/com.amazon.soap/Reference.map b/Ch5 - Amazon/Web References/com.amazon.soap/Reference.map new file mode 100644 index 0000000..39ef830 --- /dev/null +++ b/Ch5 - Amazon/Web References/com.amazon.soap/Reference.map @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Ch5 - Amazon/Web References/com.amazon.soap/Reference.vb b/Ch5 - Amazon/Web References/com.amazon.soap/Reference.vb new file mode 100644 index 0000000..2779c9a --- /dev/null +++ b/Ch5 - Amazon/Web References/com.amazon.soap/Reference.vb @@ -0,0 +1,1411 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version: 1.0.3705.288 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict Off +Option Explicit On + +Imports System +Imports System.ComponentModel +Imports System.Diagnostics +Imports System.Web.Services +Imports System.Web.Services.Protocols +Imports System.Xml.Serialization + +' +'This source code was auto-generated by Microsoft.VSDesigner, Version 1.0.3705.288. +' +Namespace com.amazon.soap + + ' + _ + Public Class AmazonSearchService + Inherits System.Web.Services.Protocols.SoapHttpClientProtocol + + ' + Public Sub New() + MyBase.New + Me.Url = "http://soap.amazon.com/onca/soap2" + End Sub + + ' + _ + Public Function KeywordSearchRequest( ByVal KeywordSearchRequest1 As KeywordRequest) As ProductInfo + Dim results() As Object = Me.Invoke("KeywordSearchRequest", New Object() {KeywordSearchRequest1}) + Return CType(results(0),ProductInfo) + End Function + + ' + Public Function BeginKeywordSearchRequest(ByVal KeywordSearchRequest1 As KeywordRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("KeywordSearchRequest", New Object() {KeywordSearchRequest1}, callback, asyncState) + End Function + + ' + Public Function EndKeywordSearchRequest(ByVal asyncResult As System.IAsyncResult) As ProductInfo + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ProductInfo) + End Function + + ' + _ + Public Function PowerSearchRequest( ByVal PowerSearchRequest1 As PowerRequest) As ProductInfo + Dim results() As Object = Me.Invoke("PowerSearchRequest", New Object() {PowerSearchRequest1}) + Return CType(results(0),ProductInfo) + End Function + + ' + Public Function BeginPowerSearchRequest(ByVal PowerSearchRequest1 As PowerRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("PowerSearchRequest", New Object() {PowerSearchRequest1}, callback, asyncState) + End Function + + ' + Public Function EndPowerSearchRequest(ByVal asyncResult As System.IAsyncResult) As ProductInfo + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ProductInfo) + End Function + + ' + _ + Public Function BrowseNodeSearchRequest( ByVal BrowseNodeSearchRequest1 As BrowseNodeRequest) As ProductInfo + Dim results() As Object = Me.Invoke("BrowseNodeSearchRequest", New Object() {BrowseNodeSearchRequest1}) + Return CType(results(0),ProductInfo) + End Function + + ' + Public Function BeginBrowseNodeSearchRequest(ByVal BrowseNodeSearchRequest1 As BrowseNodeRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("BrowseNodeSearchRequest", New Object() {BrowseNodeSearchRequest1}, callback, asyncState) + End Function + + ' + Public Function EndBrowseNodeSearchRequest(ByVal asyncResult As System.IAsyncResult) As ProductInfo + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ProductInfo) + End Function + + ' + _ + Public Function AsinSearchRequest( ByVal AsinSearchRequest1 As AsinRequest) As ProductInfo + Dim results() As Object = Me.Invoke("AsinSearchRequest", New Object() {AsinSearchRequest1}) + Return CType(results(0),ProductInfo) + End Function + + ' + Public Function BeginAsinSearchRequest(ByVal AsinSearchRequest1 As AsinRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("AsinSearchRequest", New Object() {AsinSearchRequest1}, callback, asyncState) + End Function + + ' + Public Function EndAsinSearchRequest(ByVal asyncResult As System.IAsyncResult) As ProductInfo + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ProductInfo) + End Function + + ' + _ + Public Function UpcSearchRequest( ByVal UpcSearchRequest1 As UpcRequest) As ProductInfo + Dim results() As Object = Me.Invoke("UpcSearchRequest", New Object() {UpcSearchRequest1}) + Return CType(results(0),ProductInfo) + End Function + + ' + Public Function BeginUpcSearchRequest(ByVal UpcSearchRequest1 As UpcRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("UpcSearchRequest", New Object() {UpcSearchRequest1}, callback, asyncState) + End Function + + ' + Public Function EndUpcSearchRequest(ByVal asyncResult As System.IAsyncResult) As ProductInfo + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ProductInfo) + End Function + + ' + _ + Public Function AuthorSearchRequest( ByVal AuthorSearchRequest1 As AuthorRequest) As ProductInfo + Dim results() As Object = Me.Invoke("AuthorSearchRequest", New Object() {AuthorSearchRequest1}) + Return CType(results(0),ProductInfo) + End Function + + ' + Public Function BeginAuthorSearchRequest(ByVal AuthorSearchRequest1 As AuthorRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("AuthorSearchRequest", New Object() {AuthorSearchRequest1}, callback, asyncState) + End Function + + ' + Public Function EndAuthorSearchRequest(ByVal asyncResult As System.IAsyncResult) As ProductInfo + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ProductInfo) + End Function + + ' + _ + Public Function ArtistSearchRequest( ByVal ArtistSearchRequest1 As ArtistRequest) As ProductInfo + Dim results() As Object = Me.Invoke("ArtistSearchRequest", New Object() {ArtistSearchRequest1}) + Return CType(results(0),ProductInfo) + End Function + + ' + Public Function BeginArtistSearchRequest(ByVal ArtistSearchRequest1 As ArtistRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("ArtistSearchRequest", New Object() {ArtistSearchRequest1}, callback, asyncState) + End Function + + ' + Public Function EndArtistSearchRequest(ByVal asyncResult As System.IAsyncResult) As ProductInfo + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ProductInfo) + End Function + + ' + _ + Public Function ActorSearchRequest( ByVal ActorSearchRequest1 As ActorRequest) As ProductInfo + Dim results() As Object = Me.Invoke("ActorSearchRequest", New Object() {ActorSearchRequest1}) + Return CType(results(0),ProductInfo) + End Function + + ' + Public Function BeginActorSearchRequest(ByVal ActorSearchRequest1 As ActorRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("ActorSearchRequest", New Object() {ActorSearchRequest1}, callback, asyncState) + End Function + + ' + Public Function EndActorSearchRequest(ByVal asyncResult As System.IAsyncResult) As ProductInfo + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ProductInfo) + End Function + + ' + _ + Public Function ManufacturerSearchRequest( ByVal ManufacturerSearchRequest1 As ManufacturerRequest) As ProductInfo + Dim results() As Object = Me.Invoke("ManufacturerSearchRequest", New Object() {ManufacturerSearchRequest1}) + Return CType(results(0),ProductInfo) + End Function + + ' + Public Function BeginManufacturerSearchRequest(ByVal ManufacturerSearchRequest1 As ManufacturerRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("ManufacturerSearchRequest", New Object() {ManufacturerSearchRequest1}, callback, asyncState) + End Function + + ' + Public Function EndManufacturerSearchRequest(ByVal asyncResult As System.IAsyncResult) As ProductInfo + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ProductInfo) + End Function + + ' + _ + Public Function DirectorSearchRequest( ByVal DirectorSearchRequest1 As DirectorRequest) As ProductInfo + Dim results() As Object = Me.Invoke("DirectorSearchRequest", New Object() {DirectorSearchRequest1}) + Return CType(results(0),ProductInfo) + End Function + + ' + Public Function BeginDirectorSearchRequest(ByVal DirectorSearchRequest1 As DirectorRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("DirectorSearchRequest", New Object() {DirectorSearchRequest1}, callback, asyncState) + End Function + + ' + Public Function EndDirectorSearchRequest(ByVal asyncResult As System.IAsyncResult) As ProductInfo + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ProductInfo) + End Function + + ' + _ + Public Function ListManiaSearchRequest( ByVal ListManiaSearchRequest1 As ListManiaRequest) As ProductInfo + Dim results() As Object = Me.Invoke("ListManiaSearchRequest", New Object() {ListManiaSearchRequest1}) + Return CType(results(0),ProductInfo) + End Function + + ' + Public Function BeginListManiaSearchRequest(ByVal ListManiaSearchRequest1 As ListManiaRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("ListManiaSearchRequest", New Object() {ListManiaSearchRequest1}, callback, asyncState) + End Function + + ' + Public Function EndListManiaSearchRequest(ByVal asyncResult As System.IAsyncResult) As ProductInfo + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ProductInfo) + End Function + + ' + _ + Public Function WishlistSearchRequest( ByVal WishlistSearchRequest1 As WishlistRequest) As ProductInfo + Dim results() As Object = Me.Invoke("WishlistSearchRequest", New Object() {WishlistSearchRequest1}) + Return CType(results(0),ProductInfo) + End Function + + ' + Public Function BeginWishlistSearchRequest(ByVal WishlistSearchRequest1 As WishlistRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("WishlistSearchRequest", New Object() {WishlistSearchRequest1}, callback, asyncState) + End Function + + ' + Public Function EndWishlistSearchRequest(ByVal asyncResult As System.IAsyncResult) As ProductInfo + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ProductInfo) + End Function + + ' + _ + Public Function ExchangeSearchRequest( ByVal ExchangeSearchRequest1 As ExchangeRequest) As ListingProductDetails + Dim results() As Object = Me.Invoke("ExchangeSearchRequest", New Object() {ExchangeSearchRequest1}) + Return CType(results(0),ListingProductDetails) + End Function + + ' + Public Function BeginExchangeSearchRequest(ByVal ExchangeSearchRequest1 As ExchangeRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("ExchangeSearchRequest", New Object() {ExchangeSearchRequest1}, callback, asyncState) + End Function + + ' + Public Function EndExchangeSearchRequest(ByVal asyncResult As System.IAsyncResult) As ListingProductDetails + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ListingProductDetails) + End Function + + ' + _ + Public Function SellerProfileSearchRequest( ByVal SellerProfileSearchRequest1 As SellerProfileRequest) As SellerProfile + Dim results() As Object = Me.Invoke("SellerProfileSearchRequest", New Object() {SellerProfileSearchRequest1}) + Return CType(results(0),SellerProfile) + End Function + + ' + Public Function BeginSellerProfileSearchRequest(ByVal SellerProfileSearchRequest1 As SellerProfileRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("SellerProfileSearchRequest", New Object() {SellerProfileSearchRequest1}, callback, asyncState) + End Function + + ' + Public Function EndSellerProfileSearchRequest(ByVal asyncResult As System.IAsyncResult) As SellerProfile + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),SellerProfile) + End Function + + ' + _ + Public Function SellerSearchRequest( ByVal SellerSearchRequest1 As SellerRequest) As SellerSearch + Dim results() As Object = Me.Invoke("SellerSearchRequest", New Object() {SellerSearchRequest1}) + Return CType(results(0),SellerSearch) + End Function + + ' + Public Function BeginSellerSearchRequest(ByVal SellerSearchRequest1 As SellerRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("SellerSearchRequest", New Object() {SellerSearchRequest1}, callback, asyncState) + End Function + + ' + Public Function EndSellerSearchRequest(ByVal asyncResult As System.IAsyncResult) As SellerSearch + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),SellerSearch) + End Function + + ' + _ + Public Function SimilaritySearchRequest( ByVal SimilaritySearchRequest1 As SimilarityRequest) As ProductInfo + Dim results() As Object = Me.Invoke("SimilaritySearchRequest", New Object() {SimilaritySearchRequest1}) + Return CType(results(0),ProductInfo) + End Function + + ' + Public Function BeginSimilaritySearchRequest(ByVal SimilaritySearchRequest1 As SimilarityRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("SimilaritySearchRequest", New Object() {SimilaritySearchRequest1}, callback, asyncState) + End Function + + ' + Public Function EndSimilaritySearchRequest(ByVal asyncResult As System.IAsyncResult) As ProductInfo + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ProductInfo) + End Function + + ' + _ + Public Function GetShoppingCartRequest( ByVal GetShoppingCartRequest1 As GetShoppingCartRequest) As ShoppingCart + Dim results() As Object = Me.Invoke("GetShoppingCartRequest", New Object() {GetShoppingCartRequest1}) + Return CType(results(0),ShoppingCart) + End Function + + ' + Public Function BeginGetShoppingCartRequest(ByVal GetShoppingCartRequest1 As GetShoppingCartRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("GetShoppingCartRequest", New Object() {GetShoppingCartRequest1}, callback, asyncState) + End Function + + ' + Public Function EndGetShoppingCartRequest(ByVal asyncResult As System.IAsyncResult) As ShoppingCart + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ShoppingCart) + End Function + + ' + _ + Public Function ClearShoppingCartRequest( ByVal ClearShoppingCartRequest1 As ClearShoppingCartRequest) As ShoppingCart + Dim results() As Object = Me.Invoke("ClearShoppingCartRequest", New Object() {ClearShoppingCartRequest1}) + Return CType(results(0),ShoppingCart) + End Function + + ' + Public Function BeginClearShoppingCartRequest(ByVal ClearShoppingCartRequest1 As ClearShoppingCartRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("ClearShoppingCartRequest", New Object() {ClearShoppingCartRequest1}, callback, asyncState) + End Function + + ' + Public Function EndClearShoppingCartRequest(ByVal asyncResult As System.IAsyncResult) As ShoppingCart + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ShoppingCart) + End Function + + ' + _ + Public Function AddShoppingCartItemsRequest( ByVal AddShoppingCartItemsRequest1 As AddShoppingCartItemsRequest) As ShoppingCart + Dim results() As Object = Me.Invoke("AddShoppingCartItemsRequest", New Object() {AddShoppingCartItemsRequest1}) + Return CType(results(0),ShoppingCart) + End Function + + ' + Public Function BeginAddShoppingCartItemsRequest(ByVal AddShoppingCartItemsRequest1 As AddShoppingCartItemsRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("AddShoppingCartItemsRequest", New Object() {AddShoppingCartItemsRequest1}, callback, asyncState) + End Function + + ' + Public Function EndAddShoppingCartItemsRequest(ByVal asyncResult As System.IAsyncResult) As ShoppingCart + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ShoppingCart) + End Function + + ' + _ + Public Function RemoveShoppingCartItemsRequest( ByVal RemoveShoppingCartItemsRequest1 As RemoveShoppingCartItemsRequest) As ShoppingCart + Dim results() As Object = Me.Invoke("RemoveShoppingCartItemsRequest", New Object() {RemoveShoppingCartItemsRequest1}) + Return CType(results(0),ShoppingCart) + End Function + + ' + Public Function BeginRemoveShoppingCartItemsRequest(ByVal RemoveShoppingCartItemsRequest1 As RemoveShoppingCartItemsRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("RemoveShoppingCartItemsRequest", New Object() {RemoveShoppingCartItemsRequest1}, callback, asyncState) + End Function + + ' + Public Function EndRemoveShoppingCartItemsRequest(ByVal asyncResult As System.IAsyncResult) As ShoppingCart + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ShoppingCart) + End Function + + ' + _ + Public Function ModifyShoppingCartItemsRequest( ByVal ModifyShoppingCartItemsRequest1 As ModifyShoppingCartItemsRequest) As ShoppingCart + Dim results() As Object = Me.Invoke("ModifyShoppingCartItemsRequest", New Object() {ModifyShoppingCartItemsRequest1}) + Return CType(results(0),ShoppingCart) + End Function + + ' + Public Function BeginModifyShoppingCartItemsRequest(ByVal ModifyShoppingCartItemsRequest1 As ModifyShoppingCartItemsRequest, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("ModifyShoppingCartItemsRequest", New Object() {ModifyShoppingCartItemsRequest1}, callback, asyncState) + End Function + + ' + Public Function EndModifyShoppingCartItemsRequest(ByVal asyncResult As System.IAsyncResult) As ShoppingCart + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ShoppingCart) + End Function + End Class + + ' + _ + Public Class KeywordRequest + + ' + Public keyword As String + + ' + Public page As String + + ' + Public mode As String + + ' + Public tag As String + + ' + Public type As String + + ' + Public devtag As String + + ' + Public sort As String + End Class + + ' + _ + Public Class ItemQuantity + + ' + Public ItemId As String + + ' + Public Quantity As String + End Class + + ' + _ + Public Class ModifyShoppingCartItemsRequest + + ' + Public tag As String + + ' + Public devtag As String + + ' + Public CartId As String + + ' + Public HMAC As String + + ' + Public Items() As ItemQuantity + End Class + + ' + _ + Public Class RemoveShoppingCartItemsRequest + + ' + Public tag As String + + ' + Public devtag As String + + ' + Public CartId As String + + ' + Public HMAC As String + + ' + Public Items() As String + End Class + + ' + _ + Public Class AddItem + + ' + Public Asin As String + + ' + Public ExchangeId As String + + ' + Public Quantity As String + End Class + + ' + _ + Public Class AddShoppingCartItemsRequest + + ' + Public tag As String + + ' + Public devtag As String + + ' + Public CartId As String + + ' + Public HMAC As String + + ' + Public Items() As AddItem + End Class + + ' + _ + Public Class ClearShoppingCartRequest + + ' + Public tag As String + + ' + Public devtag As String + + ' + Public CartId As String + + ' + Public HMAC As String + End Class + + ' + _ + Public Class Item + + ' + Public ItemId As String + + ' + Public ProductName As String + + ' + Public Catalog As String + + ' + Public Asin As String + + ' + Public ExchangeId As String + + ' + Public Quantity As String + + ' + Public ListPrice As String + + ' + Public OurPrice As String + End Class + + ' + _ + Public Class ShoppingCart + + ' + Public CartId As String + + ' + Public HMAC As String + + ' + Public PurchaseUrl As String + + ' + Public Items() As Item + End Class + + ' + _ + Public Class GetShoppingCartRequest + + ' + Public tag As String + + ' + Public devtag As String + + ' + Public HMAC As String + + ' + Public CartId As String + End Class + + ' + _ + Public Class SimilarityRequest + + ' + Public asin As String + + ' + Public tag As String + + ' + Public type As String + + ' + Public devtag As String + End Class + + ' + _ + Public Class ListingProductInfo + + ' + Public ListingProductDetails() As ListingProductDetails + End Class + + ' + _ + Public Class ListingProductDetails + + ' + Public ExchangeId As String + + ' + Public ListingId As String + + ' + Public ExchangeTitle As String + + ' + Public ExchangePrice As String + + ' + Public ExchangeAsin As String + + ' + Public ExchangeEndDate As String + + ' + Public ExchangeTinyImage As String + + ' + Public ExchangeSellerId As String + + ' + Public ExchangeSellerNickname As String + + ' + Public ExchangeStartDate As String + + ' + Public ExchangeStatus As String + + ' + Public ExchangeQuantity As String + + ' + Public ExchangeQuantityAllocated As String + + ' + Public ExchangeFeaturedCategory As String + + ' + Public ExchangeCondition As String + + ' + Public ExchangeConditionType As String + + ' + Public ExchangeAvailability As String + + ' + Public ExchangeOfferingType As String + + ' + Public ExchangeSellerState As String + + ' + Public ExchangeSellerCountry As String + + ' + Public ExchangeSellerRating As String + End Class + + ' + _ + Public Class SellerSearchDetails + + ' + Public SellerNickname As String + + ' + Public StoreId As String + + ' + Public StoreName As String + + ' + Public NumberOfOpenListings As String + + ' + Public ListingProductInfo As ListingProductInfo + End Class + + ' + _ + Public Class SellerSearch + + ' + Public SellerSearchDetails() As SellerSearchDetails + End Class + + ' + _ + Public Class SellerRequest + + ' + Public seller_id As String + + ' + Public tag As String + + ' + Public type As String + + ' + Public devtag As String + + ' + Public offerstatus As String + + ' + Public page As String + + ' + Public seller_browse_id As String + + ' + Public keyword As String + End Class + + ' + _ + Public Class Feedback + + ' + Public FeedbackRating As String + + ' + Public FeedbackComments As String + + ' + Public FeedbackDate As String + + ' + Public FeedbackRater As String + End Class + + ' + _ + Public Class SellerFeedback + + ' + Public Feedback() As Feedback + End Class + + ' + _ + Public Class SellerProfileDetails + + ' + Public SellerNickname As String + + ' + Public OverallFeedbackRating As String + + ' + Public NumberOfFeedback As String + + ' + Public NumberOfCanceledBids As String + + ' + Public NumberOfCanceledAuctions As String + + ' + Public StoreId As String + + ' + Public StoreName As String + + ' + Public SellerFeedback As SellerFeedback + End Class + + ' + _ + Public Class SellerProfile + + ' + Public SellerProfileDetails() As SellerProfileDetails + End Class + + ' + _ + Public Class SellerProfileRequest + + ' + Public seller_id As String + + ' + Public tag As String + + ' + Public type As String + + ' + Public devtag As String + + ' + Public page As String + End Class + + ' + _ + Public Class ExchangeRequest + + ' + Public exchange_id As String + + ' + Public tag As String + + ' + Public type As String + + ' + Public devtag As String + End Class + + ' + _ + Public Class WishlistRequest + + ' + Public wishlist_id As String + + ' + Public page As String + + ' + Public tag As String + + ' + Public type As String + + ' + Public devtag As String + End Class + + ' + _ + Public Class ListManiaRequest + + ' + Public lm_id As String + + ' + Public page As String + + ' + Public tag As String + + ' + Public type As String + + ' + Public devtag As String + End Class + + ' + _ + Public Class DirectorRequest + + ' + Public director As String + + ' + Public page As String + + ' + Public mode As String + + ' + Public tag As String + + ' + Public type As String + + ' + Public devtag As String + + ' + Public sort As String + End Class + + ' + _ + Public Class ManufacturerRequest + + ' + Public manufacturer As String + + ' + Public page As String + + ' + Public mode As String + + ' + Public tag As String + + ' + Public type As String + + ' + Public devtag As String + + ' + Public sort As String + End Class + + ' + _ + Public Class ActorRequest + + ' + Public actor As String + + ' + Public page As String + + ' + Public mode As String + + ' + Public tag As String + + ' + Public type As String + + ' + Public devtag As String + + ' + Public sort As String + End Class + + ' + _ + Public Class ArtistRequest + + ' + Public artist As String + + ' + Public page As String + + ' + Public mode As String + + ' + Public tag As String + + ' + Public type As String + + ' + Public devtag As String + + ' + Public sort As String + End Class + + ' + _ + Public Class AuthorRequest + + ' + Public author As String + + ' + Public page As String + + ' + Public mode As String + + ' + Public tag As String + + ' + Public type As String + + ' + Public devtag As String + + ' + Public sort As String + End Class + + ' + _ + Public Class UpcRequest + + ' + Public upc As String + + ' + Public mode As String + + ' + Public tag As String + + ' + Public type As String + + ' + Public devtag As String + + ' + Public sort As String + End Class + + ' + _ + Public Class AsinRequest + + ' + Public asin As String + + ' + Public tag As String + + ' + Public type As String + + ' + Public devtag As String + + ' + Public offer As String + + ' + Public offerpage As String + End Class + + ' + _ + Public Class BrowseNodeRequest + + ' + Public browse_node As String + + ' + Public page As String + + ' + Public mode As String + + ' + Public tag As String + + ' + Public type As String + + ' + Public devtag As String + + ' + Public sort As String + End Class + + ' + _ + Public Class PowerRequest + + ' + Public power As String + + ' + Public mode As String + + ' + Public tag As String + + ' + Public type As String + + ' + Public devtag As String + + ' + Public sort As String + End Class + + ' + _ + Public Class CustomerReview + + ' + Public Rating As String + + ' + Public Summary As String + + ' + Public Comment As String + End Class + + ' + _ + Public Class Reviews + + ' + Public AvgCustomerRating As String + + ' + Public CustomerReviews() As CustomerReview + End Class + + ' + _ + Public Class Track + + ' + Public TrackName As String + + ' + Public ByArtist As String + End Class + + ' + _ + Public Class BrowseNode + + ' + Public BrowseId As String + + ' + Public BrowseName As String + End Class + + ' + _ + Public Class ThirdPartyProductDetails + + ' + Public OfferingType As String + + ' + Public SellerId As String + + ' + Public SellerNickname As String + + ' + Public ExchangeId As String + + ' + Public OfferingPrice As String + + ' + Public Condition As String + + ' + Public ConditionType As String + + ' + Public ExchangeAvailability As String + + ' + Public SellerCountry As String + + ' + Public SellerState As String + + ' + Public ShipComments As String + + ' + Public SellerRating As String + End Class + + ' + _ + Public Class ThirdPartyProductInfo + + ' + Public ThirdPartyProductDetails() As ThirdPartyProductDetails + End Class + + ' + _ + Public Class KeyPhrase + + ' + _ + Public KeyPhrase1 As String + + ' + Public Type As String + End Class + + ' + _ + Public Class Details + + ' + Public Url As String + + ' + Public Asin As String + + ' + Public ProductName As String + + ' + Public Catalog As String + + ' + Public KeyPhrases() As KeyPhrase + + ' + Public Artists() As String + + ' + Public Authors() As String + + ' + Public Mpn As String + + ' + Public Starring() As String + + ' + Public Directors() As String + + ' + Public TheatricalReleaseDate As String + + ' + Public ReleaseDate As String + + ' + Public Manufacturer As String + + ' + Public Distributor As String + + ' + Public ImageUrlSmall As String + + ' + Public ImageUrlMedium As String + + ' + Public ImageUrlLarge As String + + ' + Public ListPrice As String + + ' + Public OurPrice As String + + ' + Public UsedPrice As String + + ' + Public RefurbishedPrice As String + + ' + Public CollectiblePrice As String + + ' + Public ThirdPartyNewPrice As String + + ' + Public NumberOfOfferings As String + + ' + Public ThirdPartyNewCount As String + + ' + Public UsedCount As String + + ' + Public CollectibleCount As String + + ' + Public RefurbishedCount As String + + ' + Public ThirdPartyProductInfo As ThirdPartyProductInfo + + ' + Public SalesRank As String + + ' + Public BrowseList() As BrowseNode + + ' + Public Media As String + + ' + Public ReadingLevel As String + + ' + Public Publisher As String + + ' + Public NumMedia As String + + ' + Public Isbn As String + + ' + Public Features() As String + + ' + Public MpaaRating As String + + ' + Public EsrbRating As String + + ' + Public AgeGroup As String + + ' + Public Availability As String + + ' + Public Upc As String + + ' + Public Tracks() As Track + + ' + Public Accessories() As String + + ' + Public Platforms() As String + + ' + Public Encoding As String + + ' + Public Reviews As Reviews + + ' + Public SimilarProducts() As String + + ' + Public Lists() As String + + ' + Public Status As String + End Class + + ' + _ + Public Class ProductInfo + + ' + Public TotalResults As String + + ' + Public ListName As String + + ' + Public Details() As Details + End Class +End Namespace diff --git a/Ch5 - Amazon/bin/Ch5 - Amazon.exe b/Ch5 - Amazon/bin/Ch5 - Amazon.exe new file mode 100644 index 0000000..b8f3fdc Binary files /dev/null and b/Ch5 - Amazon/bin/Ch5 - Amazon.exe differ diff --git a/Ch5 - Amazon/bin/Ch5 - Amazon.pdb b/Ch5 - Amazon/bin/Ch5 - Amazon.pdb new file mode 100644 index 0000000..0424223 Binary files /dev/null and b/Ch5 - Amazon/bin/Ch5 - Amazon.pdb differ diff --git a/Ch5 - Amazon/obj/Debug/Ch5 - Amazon.exe b/Ch5 - Amazon/obj/Debug/Ch5 - Amazon.exe new file mode 100644 index 0000000..b8f3fdc Binary files /dev/null and b/Ch5 - Amazon/obj/Debug/Ch5 - Amazon.exe differ diff --git a/Ch5 - Amazon/obj/Debug/Ch5 - Amazon.pdb b/Ch5 - Amazon/obj/Debug/Ch5 - Amazon.pdb new file mode 100644 index 0000000..0424223 Binary files /dev/null and b/Ch5 - Amazon/obj/Debug/Ch5 - Amazon.pdb differ diff --git a/Ch5 - Amazon/obj/Debug/Ch5___Amazon.Form1.resources b/Ch5 - Amazon/obj/Debug/Ch5___Amazon.Form1.resources new file mode 100644 index 0000000..7993f75 Binary files /dev/null and b/Ch5 - Amazon/obj/Debug/Ch5___Amazon.Form1.resources differ diff --git a/Ch5 - Amazon/obj/Debug/TempPE/Web References.com.amazon.soap.Reference.vb.dll b/Ch5 - Amazon/obj/Debug/TempPE/Web References.com.amazon.soap.Reference.vb.dll new file mode 100644 index 0000000..46b8797 Binary files /dev/null and b/Ch5 - Amazon/obj/Debug/TempPE/Web References.com.amazon.soap.Reference.vb.dll differ diff --git a/Ch5 - Google/AssemblyInfo.vb b/Ch5 - Google/AssemblyInfo.vb new file mode 100644 index 0000000..40af007 --- /dev/null +++ b/Ch5 - Google/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch5 - Google/Ch5 - Google.sln b/Ch5 - Google/Ch5 - Google.sln new file mode 100644 index 0000000..2bd1a91 --- /dev/null +++ b/Ch5 - Google/Ch5 - Google.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch5 - Google", "Ch5 - Google.vbproj", "{75812B98-A125-4F5A-8148-533B1230C123}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {75812B98-A125-4F5A-8148-533B1230C123}.Debug.ActiveCfg = Debug|.NET + {75812B98-A125-4F5A-8148-533B1230C123}.Debug.Build.0 = Debug|.NET + {75812B98-A125-4F5A-8148-533B1230C123}.Release.ActiveCfg = Release|.NET + {75812B98-A125-4F5A-8148-533B1230C123}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch5 - Google/Ch5 - Google.suo b/Ch5 - Google/Ch5 - Google.suo new file mode 100644 index 0000000..e32796e Binary files /dev/null and b/Ch5 - Google/Ch5 - Google.suo differ diff --git a/Ch5 - Google/Ch5 - Google.vbproj b/Ch5 - Google/Ch5 - Google.vbproj new file mode 100644 index 0000000..c65086d --- /dev/null +++ b/Ch5 - Google/Ch5 - Google.vbproj @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch5 - Google/Ch5 - Google.vbproj.user b/Ch5 - Google/Ch5 - Google.vbproj.user new file mode 100644 index 0000000..447fdc6 --- /dev/null +++ b/Ch5 - Google/Ch5 - Google.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch5 - Google/Form1.resx b/Ch5 - Google/Form1.resx new file mode 100644 index 0000000..8f2a7a0 --- /dev/null +++ b/Ch5 - Google/Form1.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch5 - Google/Form1.vb b/Ch5 - Google/Form1.vb new file mode 100644 index 0000000..b3e6b67 --- /dev/null +++ b/Ch5 - Google/Form1.vb @@ -0,0 +1,251 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents Label2 As System.Windows.Forms.Label + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents lstResults As System.Windows.Forms.ListBox + Friend WithEvents Button2 As System.Windows.Forms.Button + Friend WithEvents Label3 As System.Windows.Forms.Label + Friend WithEvents Label4 As System.Windows.Forms.Label + Friend WithEvents TextBox2 As System.Windows.Forms.TextBox + Friend WithEvents lblSuggestion As System.Windows.Forms.Label + Friend WithEvents Button3 As System.Windows.Forms.Button + Friend WithEvents Label6 As System.Windows.Forms.Label + Friend WithEvents Label7 As System.Windows.Forms.Label + Friend WithEvents TextBox3 As System.Windows.Forms.TextBox + Private Sub InitializeComponent() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.Label1 = New System.Windows.Forms.Label() + Me.Label2 = New System.Windows.Forms.Label() + Me.Button1 = New System.Windows.Forms.Button() + Me.lstResults = New System.Windows.Forms.ListBox() + Me.Button2 = New System.Windows.Forms.Button() + Me.Label3 = New System.Windows.Forms.Label() + Me.Label4 = New System.Windows.Forms.Label() + Me.TextBox2 = New System.Windows.Forms.TextBox() + Me.lblSuggestion = New System.Windows.Forms.Label() + Me.Button3 = New System.Windows.Forms.Button() + Me.Label6 = New System.Windows.Forms.Label() + Me.Label7 = New System.Windows.Forms.Label() + Me.TextBox3 = New System.Windows.Forms.TextBox() + Me.SuspendLayout() + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(152, 48) + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(176, 20) + Me.TextBox1.TabIndex = 0 + Me.TextBox1.Text = "Karl Moore" + ' + 'Label1 + ' + Me.Label1.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label1.Location = New System.Drawing.Point(24, 16) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(184, 24) + Me.Label1.TabIndex = 1 + Me.Label1.Text = "Sample Search" + ' + 'Label2 + ' + Me.Label2.Location = New System.Drawing.Point(56, 48) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(88, 16) + Me.Label2.TabIndex = 2 + Me.Label2.Text = "Enter a term:" + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(352, 48) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(48, 24) + Me.Button1.TabIndex = 3 + Me.Button1.Text = "Go" + ' + 'lstResults + ' + Me.lstResults.Location = New System.Drawing.Point(56, 88) + Me.lstResults.Name = "lstResults" + Me.lstResults.Size = New System.Drawing.Size(392, 95) + Me.lstResults.TabIndex = 4 + ' + 'Button2 + ' + Me.Button2.Location = New System.Drawing.Point(352, 232) + Me.Button2.Name = "Button2" + Me.Button2.Size = New System.Drawing.Size(48, 24) + Me.Button2.TabIndex = 8 + Me.Button2.Text = "Go" + ' + 'Label3 + ' + Me.Label3.Location = New System.Drawing.Point(56, 232) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(88, 16) + Me.Label3.TabIndex = 7 + Me.Label3.Text = "Enter a term:" + ' + 'Label4 + ' + Me.Label4.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label4.Location = New System.Drawing.Point(24, 200) + Me.Label4.Name = "Label4" + Me.Label4.Size = New System.Drawing.Size(184, 24) + Me.Label4.TabIndex = 6 + Me.Label4.Text = "Word Suggestion" + ' + 'TextBox2 + ' + Me.TextBox2.Location = New System.Drawing.Point(152, 232) + Me.TextBox2.Name = "TextBox2" + Me.TextBox2.Size = New System.Drawing.Size(176, 20) + Me.TextBox2.TabIndex = 5 + Me.TextBox2.Text = "Britnee Speyers" + ' + 'lblSuggestion + ' + Me.lblSuggestion.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lblSuggestion.Location = New System.Drawing.Point(152, 264) + Me.lblSuggestion.Name = "lblSuggestion" + Me.lblSuggestion.Size = New System.Drawing.Size(248, 16) + Me.lblSuggestion.TabIndex = 9 + ' + 'Button3 + ' + Me.Button3.Location = New System.Drawing.Point(352, 328) + Me.Button3.Name = "Button3" + Me.Button3.Size = New System.Drawing.Size(48, 24) + Me.Button3.TabIndex = 13 + Me.Button3.Text = "Go" + ' + 'Label6 + ' + Me.Label6.Location = New System.Drawing.Point(56, 328) + Me.Label6.Name = "Label6" + Me.Label6.Size = New System.Drawing.Size(88, 16) + Me.Label6.TabIndex = 12 + Me.Label6.Text = "Enter a URL:" + ' + 'Label7 + ' + Me.Label7.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label7.Location = New System.Drawing.Point(24, 296) + Me.Label7.Name = "Label7" + Me.Label7.Size = New System.Drawing.Size(240, 24) + Me.Label7.TabIndex = 11 + Me.Label7.Text = "Retrieve Cached Page" + ' + 'TextBox3 + ' + Me.TextBox3.Location = New System.Drawing.Point(152, 328) + Me.TextBox3.Name = "TextBox3" + Me.TextBox3.Size = New System.Drawing.Size(176, 20) + Me.TextBox3.TabIndex = 10 + Me.TextBox3.Text = "www.karlmoore.com" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(480, 374) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button3, Me.Label6, Me.Label7, Me.TextBox3, Me.lblSuggestion, Me.Button2, Me.Label3, Me.Label4, Me.TextBox2, Me.lstResults, Me.Button1, Me.Label2, Me.Label1, Me.TextBox1}) + Me.Name = "Form1" + Me.Text = "Adding Google Search to your Programs" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + ' Create a new Google search object + Dim objSearch As New _ + com.google.api.GoogleSearchService() + ' Invoke the search method + Dim objResults As _ + com.google.api.GoogleSearchResult = _ + objSearch.doGoogleSearch( _ + "xxxxxxxxxxx", _ + TextBox1.Text, 0, 10, False, "", False, _ + "", "", "") + ' Loop through result elements + Dim shtCount As Short + For shtCount = 0 To objResults.endIndex - 1 + lstResults.Items.Add(StripTags(objResults.resultElements(shtCount).title) & _ + " - " & objResults.resultElements(shtCount).URL) + Next + End Sub + Public Function StripTags(ByVal HTML As String) As String + ' Removes tags from passed HTML + Dim objRegEx As _ + System.Text.RegularExpressions.Regex + Return objRegEx.Replace(HTML, "<[^>]*>", "") + End Function + + Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click + ' Create a new Google search object + Dim objSearch As New _ + com.google.api.GoogleSearchService() + ' Retrieve the suggest spelling, if any + Dim strSuggestion As String + strSuggestion = objSearch.doSpellingSuggestion( _ + "xxxxxxxxxxx", _ + TextBox2.Text) + If strSuggestion <> "" Then + lblSuggestion.Text = "Did you mean " & strSuggestion & "?" + Else + lblSuggestion.Text = "Looks okay to me!" + End If + End Sub + + Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click + ' Create a new Google search object + Dim objSearch As New _ + com.google.api.GoogleSearchService() + ' Retrieve cached version of a page + Dim bytPage() As Byte = _ + objSearch.doGetCachedPage( _ + "xxxxxxxxxxx", _ + TextBox3.Text) + ' Convert base 64 byte array to string + Dim strHTML As String = _ + System.Text.ASCIIEncoding.ASCII.GetString(bytPage) + ' Process HTML + If strHTML.IndexOf("did not match any documents.") = -1 Then + Clipboard.SetDataObject(strHTML) + MessageBox.Show("Cached HTML sent to clipboard") + Else + MessageBox.Show("Can't find cached version of " & TextBox3.Text) + End If + End Sub +End Class diff --git a/Ch5 - Google/Web References/com.google.api/GoogleSearch.wsdl b/Ch5 - Google/Web References/com.google.api/GoogleSearch.wsdl new file mode 100644 index 0000000..975f84e --- /dev/null +++ b/Ch5 - Google/Web References/com.google.api/GoogleSearch.wsdl @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ch5 - Google/Web References/com.google.api/Reference.map b/Ch5 - Google/Web References/com.google.api/Reference.map new file mode 100644 index 0000000..2eaaae9 --- /dev/null +++ b/Ch5 - Google/Web References/com.google.api/Reference.map @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Ch5 - Google/Web References/com.google.api/Reference.vb b/Ch5 - Google/Web References/com.google.api/Reference.vb new file mode 100644 index 0000000..c34f1df --- /dev/null +++ b/Ch5 - Google/Web References/com.google.api/Reference.vb @@ -0,0 +1,175 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version: 1.0.3705.288 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict Off +Option Explicit On + +Imports System +Imports System.ComponentModel +Imports System.Diagnostics +Imports System.Web.Services +Imports System.Web.Services.Protocols +Imports System.Xml.Serialization + +' +'This source code was auto-generated by Microsoft.VSDesigner, Version 1.0.3705.288. +' +Namespace com.google.api + + ' + _ + Public Class GoogleSearchService + Inherits System.Web.Services.Protocols.SoapHttpClientProtocol + + ' + Public Sub New() + MyBase.New + Me.Url = "http://api.google.com/search/beta2" + End Sub + + ' + _ + Public Function doGetCachedPage(ByVal key As String, ByVal url As String) As Byte() + Dim results() As Object = Me.Invoke("doGetCachedPage", New Object() {key, url}) + Return CType(results(0),Byte()) + End Function + + ' + Public Function BegindoGetCachedPage(ByVal key As String, ByVal url As String, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("doGetCachedPage", New Object() {key, url}, callback, asyncState) + End Function + + ' + Public Function EnddoGetCachedPage(ByVal asyncResult As System.IAsyncResult) As Byte() + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),Byte()) + End Function + + ' + _ + Public Function doSpellingSuggestion(ByVal key As String, ByVal phrase As String) As String + Dim results() As Object = Me.Invoke("doSpellingSuggestion", New Object() {key, phrase}) + Return CType(results(0),String) + End Function + + ' + Public Function BegindoSpellingSuggestion(ByVal key As String, ByVal phrase As String, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("doSpellingSuggestion", New Object() {key, phrase}, callback, asyncState) + End Function + + ' + Public Function EnddoSpellingSuggestion(ByVal asyncResult As System.IAsyncResult) As String + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),String) + End Function + + ' + _ + Public Function doGoogleSearch(ByVal key As String, ByVal q As String, ByVal start As Integer, ByVal maxResults As Integer, ByVal filter As Boolean, ByVal restrict As String, ByVal safeSearch As Boolean, ByVal lr As String, ByVal ie As String, ByVal oe As String) As GoogleSearchResult + Dim results() As Object = Me.Invoke("doGoogleSearch", New Object() {key, q, start, maxResults, filter, restrict, safeSearch, lr, ie, oe}) + Return CType(results(0),GoogleSearchResult) + End Function + + ' + Public Function BegindoGoogleSearch(ByVal key As String, ByVal q As String, ByVal start As Integer, ByVal maxResults As Integer, ByVal filter As Boolean, ByVal restrict As String, ByVal safeSearch As Boolean, ByVal lr As String, ByVal ie As String, ByVal oe As String, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("doGoogleSearch", New Object() {key, q, start, maxResults, filter, restrict, safeSearch, lr, ie, oe}, callback, asyncState) + End Function + + ' + Public Function EnddoGoogleSearch(ByVal asyncResult As System.IAsyncResult) As GoogleSearchResult + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),GoogleSearchResult) + End Function + End Class + + ' + _ + Public Class GoogleSearchResult + + ' + Public documentFiltering As Boolean + + ' + Public searchComments As String + + ' + Public estimatedTotalResultsCount As Integer + + ' + Public estimateIsExact As Boolean + + ' + Public resultElements() As ResultElement + + ' + Public searchQuery As String + + ' + Public startIndex As Integer + + ' + Public endIndex As Integer + + ' + Public searchTips As String + + ' + Public directoryCategories() As DirectoryCategory + + ' + Public searchTime As Double + End Class + + ' + _ + Public Class ResultElement + + ' + Public summary As String + + ' + Public URL As String + + ' + Public snippet As String + + ' + Public title As String + + ' + Public cachedSize As String + + ' + Public relatedInformationPresent As Boolean + + ' + Public hostName As String + + ' + Public directoryCategory As DirectoryCategory + + ' + Public directoryTitle As String + End Class + + ' + _ + Public Class DirectoryCategory + + ' + Public fullViewableName As String + + ' + Public specialEncoding As String + End Class +End Namespace diff --git a/Ch5 - Google/bin/Ch5 - Google.exe b/Ch5 - Google/bin/Ch5 - Google.exe new file mode 100644 index 0000000..b70c285 Binary files /dev/null and b/Ch5 - Google/bin/Ch5 - Google.exe differ diff --git a/Ch5 - Google/bin/Ch5 - Google.pdb b/Ch5 - Google/bin/Ch5 - Google.pdb new file mode 100644 index 0000000..c877bb5 Binary files /dev/null and b/Ch5 - Google/bin/Ch5 - Google.pdb differ diff --git a/Ch5 - Google/obj/Debug/Ch5 - Google.exe b/Ch5 - Google/obj/Debug/Ch5 - Google.exe new file mode 100644 index 0000000..b70c285 Binary files /dev/null and b/Ch5 - Google/obj/Debug/Ch5 - Google.exe differ diff --git a/Ch5 - Google/obj/Debug/Ch5 - Google.pdb b/Ch5 - Google/obj/Debug/Ch5 - Google.pdb new file mode 100644 index 0000000..c877bb5 Binary files /dev/null and b/Ch5 - Google/obj/Debug/Ch5 - Google.pdb differ diff --git a/Ch5 - Google/obj/Debug/Ch5___Google.Form1.resources b/Ch5 - Google/obj/Debug/Ch5___Google.Form1.resources new file mode 100644 index 0000000..50f24a6 Binary files /dev/null and b/Ch5 - Google/obj/Debug/Ch5___Google.Form1.resources differ diff --git a/Ch5 - Google/obj/Debug/TempPE/Web References.com.google.api.Reference.vb.dll b/Ch5 - Google/obj/Debug/TempPE/Web References.com.google.api.Reference.vb.dll new file mode 100644 index 0000000..12ec311 Binary files /dev/null and b/Ch5 - Google/obj/Debug/TempPE/Web References.com.google.api.Reference.vb.dll differ diff --git a/Ch5 - TerraServer/AssemblyInfo.vb b/Ch5 - TerraServer/AssemblyInfo.vb new file mode 100644 index 0000000..91030a8 --- /dev/null +++ b/Ch5 - TerraServer/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch5 - TerraServer/Ch5 - TerraServer.sln b/Ch5 - TerraServer/Ch5 - TerraServer.sln new file mode 100644 index 0000000..2900171 --- /dev/null +++ b/Ch5 - TerraServer/Ch5 - TerraServer.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch5 - TerraServer", "Ch5 - TerraServer.vbproj", "{C0A1E42D-6E73-426C-86DF-F94FB11F8F71}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {C0A1E42D-6E73-426C-86DF-F94FB11F8F71}.Debug.ActiveCfg = Debug|.NET + {C0A1E42D-6E73-426C-86DF-F94FB11F8F71}.Debug.Build.0 = Debug|.NET + {C0A1E42D-6E73-426C-86DF-F94FB11F8F71}.Release.ActiveCfg = Release|.NET + {C0A1E42D-6E73-426C-86DF-F94FB11F8F71}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch5 - TerraServer/Ch5 - TerraServer.suo b/Ch5 - TerraServer/Ch5 - TerraServer.suo new file mode 100644 index 0000000..37740a4 Binary files /dev/null and b/Ch5 - TerraServer/Ch5 - TerraServer.suo differ diff --git a/Ch5 - TerraServer/Ch5 - TerraServer.vbproj b/Ch5 - TerraServer/Ch5 - TerraServer.vbproj new file mode 100644 index 0000000..f5730d8 --- /dev/null +++ b/Ch5 - TerraServer/Ch5 - TerraServer.vbproj @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch5 - TerraServer/Ch5 - TerraServer.vbproj.user b/Ch5 - TerraServer/Ch5 - TerraServer.vbproj.user new file mode 100644 index 0000000..eabb41d --- /dev/null +++ b/Ch5 - TerraServer/Ch5 - TerraServer.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch5 - TerraServer/Form1.resx b/Ch5 - TerraServer/Form1.resx new file mode 100644 index 0000000..3e3353e --- /dev/null +++ b/Ch5 - TerraServer/Form1.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch5 - TerraServer/Form1.vb b/Ch5 - TerraServer/Form1.vb new file mode 100644 index 0000000..db83eb6 --- /dev/null +++ b/Ch5 - TerraServer/Form1.vb @@ -0,0 +1,165 @@ +Imports Ch5___TerraServer.net.terraservice + +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents Label2 As System.Windows.Forms.Label + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox + Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.Label2 = New System.Windows.Forms.Label() + Me.Label1 = New System.Windows.Forms.Label() + Me.PictureBox1 = New System.Windows.Forms.PictureBox() + Me.ComboBox1 = New System.Windows.Forms.ComboBox() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(352, 48) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(48, 24) + Me.Button1.TabIndex = 7 + Me.Button1.Text = "Go" + ' + 'Label2 + ' + Me.Label2.Location = New System.Drawing.Point(56, 48) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(88, 16) + Me.Label2.TabIndex = 6 + Me.Label2.Text = "Enter a site:" + ' + 'Label1 + ' + Me.Label1.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label1.Location = New System.Drawing.Point(24, 16) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(184, 24) + Me.Label1.TabIndex = 5 + Me.Label1.Text = "Place Search" + ' + 'PictureBox1 + ' + Me.PictureBox1.Location = New System.Drawing.Point(40, 96) + Me.PictureBox1.Name = "PictureBox1" + Me.PictureBox1.Size = New System.Drawing.Size(368, 216) + Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage + Me.PictureBox1.TabIndex = 8 + Me.PictureBox1.TabStop = False + ' + 'ComboBox1 + ' + Me.ComboBox1.Items.AddRange(New Object() {"Statue of Liberty", "Pentagon", "White House", "Hoover Dam"}) + Me.ComboBox1.Location = New System.Drawing.Point(176, 48) + Me.ComboBox1.Name = "ComboBox1" + Me.ComboBox1.Size = New System.Drawing.Size(121, 21) + Me.ComboBox1.TabIndex = 9 + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(440, 334) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.ComboBox1, Me.PictureBox1, Me.Button1, Me.Label2, Me.Label1}) + Me.Name = "Form1" + Me.Text = "View the Real World in your Application, with TerraServer" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Public Sub CreateBitmapFromPlaceName( _ + ByVal PlaceName As String, ByVal Filename As String) + ' Size of image to create + Const WIDTH As Integer = 600 + Const HEIGHT As Integer = 400 + ' Setup objects to use + Dim objTheme As New Theme() + Dim objScale As New Scale() + Dim objTS As New TerraService() + Dim objABB As AreaBoundingBox + Dim imgImage As Image + Dim objPF() As PlaceFacts + Try + ' Retrieve list of matching points + objPF = objTS.GetPlaceList(PlaceName, 1, False) + ' If no matches, exit + If objPF.Length = 0 Then Exit Sub + ' Settings - type of image and scale + objTheme = Theme.Photo + objScale = objScale.Scale2m + ' Gets details of the final full image AreaBoundingBox + objABB = objTS.GetAreaFromPt(objPF(0).Center, _ + objTheme, objScale, WIDTH, HEIGHT) + ' Create objects to handle image in memory + Dim objPFmt As System.Drawing.Imaging.PixelFormat = _ + System.Drawing.Imaging.PixelFormat.Format32bppRgb + Dim imgTemp As Image = New Bitmap(WIDTH, HEIGHT, objPFmt) + Dim objGraphics As Graphics = Graphics.FromImage(imgTemp) + ' Create objects to store current locations + Dim intStartX As Integer = objABB.NorthWest.TileMeta.Id.X + Dim intStartY As Integer = objABB.NorthWest.TileMeta.Id.Y + Dim x, y As Integer + ' Cycle through the portions of our whole AreaBoundingBox, + ' incrementally retrieving and stiching together our image + For x = intStartX To objABB.NorthEast.TileMeta.Id.X + For y = intStartY To objABB.SouthWest.TileMeta.Id.Y Step -1 + Dim objTID As TileId + Dim imgTile As Image + objTID = objABB.NorthWest.TileMeta.Id + objTID.X = x + objTID.Y = y + imgTile = Image.FromStream(New System.IO.MemoryStream( _ + objTS.GetTile(objTID))) + objGraphics.DrawImage(imgTile, _ + (x - intStartX) * imgTile.Width - _ + objABB.NorthWest.Offset.XOffset, _ + (intStartY - y) * imgTile.Height - _ + objABB.NorthWest.Offset.YOffset, _ + imgTile.Width, imgTile.Height) + Next + Next + ' Finally, save to the passed filename + imgTemp.Save(Filename, System.Drawing.Imaging.ImageFormat.Bmp) + Catch + Return + End Try + End Sub + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + CreateBitmapFromPlaceName(ComboBox1.Text, "c:\" & ComboBox1.Text & ".bmp") + PictureBox1.Image = New Bitmap("c:\" & ComboBox1.Text & ".bmp") + + End Sub +End Class diff --git a/Ch5 - TerraServer/Web References/net.terraservice/Reference.map b/Ch5 - TerraServer/Web References/net.terraservice/Reference.map new file mode 100644 index 0000000..e81fec6 --- /dev/null +++ b/Ch5 - TerraServer/Web References/net.terraservice/Reference.map @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Ch5 - TerraServer/Web References/net.terraservice/Reference.vb b/Ch5 - TerraServer/Web References/net.terraservice/Reference.vb new file mode 100644 index 0000000..66a168b --- /dev/null +++ b/Ch5 - TerraServer/Web References/net.terraservice/Reference.vb @@ -0,0 +1,756 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version: 1.0.3705.288 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict Off +Option Explicit On + +Imports System +Imports System.ComponentModel +Imports System.Diagnostics +Imports System.Web.Services +Imports System.Web.Services.Protocols +Imports System.Xml.Serialization + +' +'This source code was auto-generated by Microsoft.VSDesigner, Version 1.0.3705.288. +' +Namespace net.terraservice + + ' + _ + Public Class TerraService + Inherits System.Web.Services.Protocols.SoapHttpClientProtocol + + ' + Public Sub New() + MyBase.New + Me.Url = "http://terraservice.net/TerraService.asmx" + End Sub + + ' + _ + Public Function ConvertLonLatPtToNearestPlace(ByVal point As LonLatPt) As String + Dim results() As Object = Me.Invoke("ConvertLonLatPtToNearestPlace", New Object() {point}) + Return CType(results(0),String) + End Function + + ' + Public Function BeginConvertLonLatPtToNearestPlace(ByVal point As LonLatPt, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("ConvertLonLatPtToNearestPlace", New Object() {point}, callback, asyncState) + End Function + + ' + Public Function EndConvertLonLatPtToNearestPlace(ByVal asyncResult As System.IAsyncResult) As String + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),String) + End Function + + ' + _ + Public Function ConvertLonLatPtToUtmPt(ByVal point As LonLatPt) As UtmPt + Dim results() As Object = Me.Invoke("ConvertLonLatPtToUtmPt", New Object() {point}) + Return CType(results(0),UtmPt) + End Function + + ' + Public Function BeginConvertLonLatPtToUtmPt(ByVal point As LonLatPt, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("ConvertLonLatPtToUtmPt", New Object() {point}, callback, asyncState) + End Function + + ' + Public Function EndConvertLonLatPtToUtmPt(ByVal asyncResult As System.IAsyncResult) As UtmPt + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),UtmPt) + End Function + + ' + _ + Public Function ConvertUtmPtToLonLatPt(ByVal utm As UtmPt) As LonLatPt + Dim results() As Object = Me.Invoke("ConvertUtmPtToLonLatPt", New Object() {utm}) + Return CType(results(0),LonLatPt) + End Function + + ' + Public Function BeginConvertUtmPtToLonLatPt(ByVal utm As UtmPt, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("ConvertUtmPtToLonLatPt", New Object() {utm}, callback, asyncState) + End Function + + ' + Public Function EndConvertUtmPtToLonLatPt(ByVal asyncResult As System.IAsyncResult) As LonLatPt + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),LonLatPt) + End Function + + ' + _ + Public Function ConvertPlaceToLonLatPt(ByVal place As Place) As LonLatPt + Dim results() As Object = Me.Invoke("ConvertPlaceToLonLatPt", New Object() {place}) + Return CType(results(0),LonLatPt) + End Function + + ' + Public Function BeginConvertPlaceToLonLatPt(ByVal place As Place, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("ConvertPlaceToLonLatPt", New Object() {place}, callback, asyncState) + End Function + + ' + Public Function EndConvertPlaceToLonLatPt(ByVal asyncResult As System.IAsyncResult) As LonLatPt + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),LonLatPt) + End Function + + ' + _ + Public Function CountPlacesInRect(ByVal upperleft As LonLatPt, ByVal lowerright As LonLatPt, ByVal ptype As PlaceType) As Integer + Dim results() As Object = Me.Invoke("CountPlacesInRect", New Object() {upperleft, lowerright, ptype}) + Return CType(results(0),Integer) + End Function + + ' + Public Function BeginCountPlacesInRect(ByVal upperleft As LonLatPt, ByVal lowerright As LonLatPt, ByVal ptype As PlaceType, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("CountPlacesInRect", New Object() {upperleft, lowerright, ptype}, callback, asyncState) + End Function + + ' + Public Function EndCountPlacesInRect(ByVal asyncResult As System.IAsyncResult) As Integer + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),Integer) + End Function + + ' + _ + Public Function GetAreaFromPt(ByVal center As LonLatPt, ByVal theme As Theme, ByVal scale As Scale, ByVal displayPixWidth As Integer, ByVal displayPixHeight As Integer) As AreaBoundingBox + Dim results() As Object = Me.Invoke("GetAreaFromPt", New Object() {center, theme, scale, displayPixWidth, displayPixHeight}) + Return CType(results(0),AreaBoundingBox) + End Function + + ' + Public Function BeginGetAreaFromPt(ByVal center As LonLatPt, ByVal theme As Theme, ByVal scale As Scale, ByVal displayPixWidth As Integer, ByVal displayPixHeight As Integer, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("GetAreaFromPt", New Object() {center, theme, scale, displayPixWidth, displayPixHeight}, callback, asyncState) + End Function + + ' + Public Function EndGetAreaFromPt(ByVal asyncResult As System.IAsyncResult) As AreaBoundingBox + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),AreaBoundingBox) + End Function + + ' + _ + Public Function GetAreaFromRect(ByVal upperLeft As LonLatPt, ByVal lowerRight As LonLatPt, ByVal theme As Theme, ByVal scale As Scale) As AreaBoundingBox + Dim results() As Object = Me.Invoke("GetAreaFromRect", New Object() {upperLeft, lowerRight, theme, scale}) + Return CType(results(0),AreaBoundingBox) + End Function + + ' + Public Function BeginGetAreaFromRect(ByVal upperLeft As LonLatPt, ByVal lowerRight As LonLatPt, ByVal theme As Theme, ByVal scale As Scale, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("GetAreaFromRect", New Object() {upperLeft, lowerRight, theme, scale}, callback, asyncState) + End Function + + ' + Public Function EndGetAreaFromRect(ByVal asyncResult As System.IAsyncResult) As AreaBoundingBox + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),AreaBoundingBox) + End Function + + ' + _ + Public Function GetAreaFromTileId(ByVal id As TileId, ByVal displayPixWidth As Integer, ByVal displayPixHeight As Integer) As AreaBoundingBox + Dim results() As Object = Me.Invoke("GetAreaFromTileId", New Object() {id, displayPixWidth, displayPixHeight}) + Return CType(results(0),AreaBoundingBox) + End Function + + ' + Public Function BeginGetAreaFromTileId(ByVal id As TileId, ByVal displayPixWidth As Integer, ByVal displayPixHeight As Integer, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("GetAreaFromTileId", New Object() {id, displayPixWidth, displayPixHeight}, callback, asyncState) + End Function + + ' + Public Function EndGetAreaFromTileId(ByVal asyncResult As System.IAsyncResult) As AreaBoundingBox + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),AreaBoundingBox) + End Function + + ' + _ + Public Function GetLatLonMetrics(ByVal point As LonLatPt) As ThemeBoundingBox() + Dim results() As Object = Me.Invoke("GetLatLonMetrics", New Object() {point}) + Return CType(results(0),ThemeBoundingBox()) + End Function + + ' + Public Function BeginGetLatLonMetrics(ByVal point As LonLatPt, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("GetLatLonMetrics", New Object() {point}, callback, asyncState) + End Function + + ' + Public Function EndGetLatLonMetrics(ByVal asyncResult As System.IAsyncResult) As ThemeBoundingBox() + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ThemeBoundingBox()) + End Function + + ' + _ + Public Function GetPlaceFacts(ByVal place As Place) As PlaceFacts + Dim results() As Object = Me.Invoke("GetPlaceFacts", New Object() {place}) + Return CType(results(0),PlaceFacts) + End Function + + ' + Public Function BeginGetPlaceFacts(ByVal place As Place, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("GetPlaceFacts", New Object() {place}, callback, asyncState) + End Function + + ' + Public Function EndGetPlaceFacts(ByVal asyncResult As System.IAsyncResult) As PlaceFacts + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),PlaceFacts) + End Function + + ' + _ + Public Function GetPlaceList(ByVal placeName As String, ByVal MaxItems As Integer, ByVal imagePresence As Boolean) As PlaceFacts() + Dim results() As Object = Me.Invoke("GetPlaceList", New Object() {placeName, MaxItems, imagePresence}) + Return CType(results(0),PlaceFacts()) + End Function + + ' + Public Function BeginGetPlaceList(ByVal placeName As String, ByVal MaxItems As Integer, ByVal imagePresence As Boolean, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("GetPlaceList", New Object() {placeName, MaxItems, imagePresence}, callback, asyncState) + End Function + + ' + Public Function EndGetPlaceList(ByVal asyncResult As System.IAsyncResult) As PlaceFacts() + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),PlaceFacts()) + End Function + + ' + _ + Public Function GetPlaceListInRect(ByVal upperleft As LonLatPt, ByVal lowerright As LonLatPt, ByVal ptype As PlaceType, ByVal MaxItems As Integer) As PlaceFacts() + Dim results() As Object = Me.Invoke("GetPlaceListInRect", New Object() {upperleft, lowerright, ptype, MaxItems}) + Return CType(results(0),PlaceFacts()) + End Function + + ' + Public Function BeginGetPlaceListInRect(ByVal upperleft As LonLatPt, ByVal lowerright As LonLatPt, ByVal ptype As PlaceType, ByVal MaxItems As Integer, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("GetPlaceListInRect", New Object() {upperleft, lowerright, ptype, MaxItems}, callback, asyncState) + End Function + + ' + Public Function EndGetPlaceListInRect(ByVal asyncResult As System.IAsyncResult) As PlaceFacts() + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),PlaceFacts()) + End Function + + ' + _ + Public Function GetTheme(ByVal theme As Theme) As ThemeInfo + Dim results() As Object = Me.Invoke("GetTheme", New Object() {theme}) + Return CType(results(0),ThemeInfo) + End Function + + ' + Public Function BeginGetTheme(ByVal theme As Theme, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("GetTheme", New Object() {theme}, callback, asyncState) + End Function + + ' + Public Function EndGetTheme(ByVal asyncResult As System.IAsyncResult) As ThemeInfo + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),ThemeInfo) + End Function + + ' + _ + Public Function GetTileMetaFromLonLatPt(ByVal point As LonLatPt, ByVal theme As Theme, ByVal scale As Scale) As TileMeta + Dim results() As Object = Me.Invoke("GetTileMetaFromLonLatPt", New Object() {point, theme, scale}) + Return CType(results(0),TileMeta) + End Function + + ' + Public Function BeginGetTileMetaFromLonLatPt(ByVal point As LonLatPt, ByVal theme As Theme, ByVal scale As Scale, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("GetTileMetaFromLonLatPt", New Object() {point, theme, scale}, callback, asyncState) + End Function + + ' + Public Function EndGetTileMetaFromLonLatPt(ByVal asyncResult As System.IAsyncResult) As TileMeta + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),TileMeta) + End Function + + ' + _ + Public Function GetTileMetaFromTileId(ByVal id As TileId) As TileMeta + Dim results() As Object = Me.Invoke("GetTileMetaFromTileId", New Object() {id}) + Return CType(results(0),TileMeta) + End Function + + ' + Public Function BeginGetTileMetaFromTileId(ByVal id As TileId, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("GetTileMetaFromTileId", New Object() {id}, callback, asyncState) + End Function + + ' + Public Function EndGetTileMetaFromTileId(ByVal asyncResult As System.IAsyncResult) As TileMeta + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),TileMeta) + End Function + + ' + _ + Public Function GetTile(ByVal id As TileId) As Byte() + Dim results() As Object = Me.Invoke("GetTile", New Object() {id}) + Return CType(results(0),Byte()) + End Function + + ' + Public Function BeginGetTile(ByVal id As TileId, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult + Return Me.BeginInvoke("GetTile", New Object() {id}, callback, asyncState) + End Function + + ' + Public Function EndGetTile(ByVal asyncResult As System.IAsyncResult) As Byte() + Dim results() As Object = Me.EndInvoke(asyncResult) + Return CType(results(0),Byte()) + End Function + End Class + + ' + _ + Public Class LonLatPt + + ' + Public Lon As Double + + ' + Public Lat As Double + End Class + + ' + _ + Public Class ThemeInfo + + ' + Public Theme As Theme + + ' + Public Name As String + + ' + Public Description As String + + ' + Public Supplier As String + + ' + Public LoScale As Scale + + ' + Public HiScale As Scale + + ' + Public ProjectionId As ProjectionType + + ' + Public ProjectionName As String + + ' + Public CopyrightNotice As String + End Class + + ' + _ + Public Enum Theme + + ' + Photo + + ' + Topo + + ' + Relief + End Enum + + ' + _ + Public Enum Scale + + ' + Scale1mm + + ' + Scale2mm + + ' + Scale4mm + + ' + Scale8mm + + ' + Scale16mm + + ' + Scale32mm + + ' + Scale63mm + + ' + Scale125mm + + ' + Scale250mm + + ' + Scale500mm + + ' + Scale1m + + ' + Scale2m + + ' + Scale4m + + ' + Scale8m + + ' + Scale16m + + ' + Scale32m + + ' + Scale64m + + ' + Scale128m + + ' + Scale256m + + ' + Scale512m + + ' + Scale1km + + ' + Scale2km + + ' + Scale4km + + ' + Scale8km + + ' + Scale16km + End Enum + + ' + _ + Public Enum ProjectionType + + ' + Geographic + + ' + UtmNad27 + + ' + UtmNad83 + End Enum + + ' + _ + Public Class PlaceFacts + + ' + Public Place As Place + + ' + Public Center As LonLatPt + + ' + Public AvailableThemeMask As Themes + + ' + Public PlaceTypeId As PlaceType + + ' + Public Population As Integer + End Class + + ' + _ + Public Class Place + + ' + Public City As String + + ' + Public State As String + + ' + Public Country As String + End Class + + ' + _ + Public Enum Themes + + ' + Photo = 1 + + ' + Topo = 2 + + ' + Relief = 4 + End Enum + + ' + _ + Public Enum PlaceType + + ' + UnknownPlaceType + + ' + AirRailStation + + ' + BayGulf + + ' + CapePeninsula + + ' + CityTown + + ' + HillMountain + + ' + Island + + ' + Lake + + ' + OtherLandFeature + + ' + OtherWaterFeature + + ' + ParkBeach + + ' + PointOfInterest + + ' + River + End Enum + + ' + _ + Public Class ThemeBoundingBox + + ' + Public Theme As Theme + + ' + Public ThemeName As String + + ' + Public Sparseness As Integer + + ' + Public LoScale As Scale + + ' + Public HiScale As Scale + + ' + Public ProjectionId As ProjectionType + + ' + Public ProjectionName As String + + ' + Public WestLongitude As Double + + ' + Public NorthLatitude As Double + + ' + Public EastLongitude As Double + + ' + Public SouthLatitude As Double + End Class + + ' + _ + Public Class OverlappingThemeInfo + + ' + Public LocalTheme As Boolean + + ' + Public Theme As Theme + + ' + Public Point As LonLatPt + + ' + Public ThemeName As String + + ' + Public Capture As Date + + ' + Public ProjectionId As ProjectionType + + ' + Public LoScale As Scale + + ' + Public HiScale As Scale + + ' + Public Url As String + End Class + + ' + _ + Public Class LonLatPtOffset + + ' + Public Point As LonLatPt + + ' + Public XOffset As Integer + + ' + Public YOffset As Integer + End Class + + ' + _ + Public Class TileId + + ' + Public Theme As Theme + + ' + Public Scale As Scale + + ' + Public Scene As Integer + + ' + Public X As Integer + + ' + Public Y As Integer + End Class + + ' + _ + Public Class TileMeta + + ' + Public Id As TileId + + ' + Public TileExists As Boolean + + ' + Public NorthWest As LonLatPt + + ' + Public NorthEast As LonLatPt + + ' + Public SouthWest As LonLatPt + + ' + Public SouthEast As LonLatPt + + ' + Public Center As LonLatPt + + ' + Public Capture As Date + End Class + + ' + _ + Public Class AreaCoordinate + + ' + Public TileMeta As TileMeta + + ' + Public Offset As LonLatPtOffset + End Class + + ' + _ + Public Class AreaBoundingBox + + ' + Public NorthWest As AreaCoordinate + + ' + Public NorthEast As AreaCoordinate + + ' + Public SouthWest As AreaCoordinate + + ' + Public SouthEast As AreaCoordinate + + ' + Public Center As AreaCoordinate + + ' + Public NearestPlace As String + + ' + _ + Public OverlappingThemeInfos() As OverlappingThemeInfo + End Class + + ' + _ + Public Class UtmPt + + ' + Public Zone As Integer + + ' + Public X As Double + + ' + Public Y As Double + End Class +End Namespace diff --git a/Ch5 - TerraServer/Web References/net.terraservice/TerraService.disco b/Ch5 - TerraServer/Web References/net.terraservice/TerraService.disco new file mode 100644 index 0000000..f038ebd --- /dev/null +++ b/Ch5 - TerraServer/Web References/net.terraservice/TerraService.disco @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Ch5 - TerraServer/Web References/net.terraservice/TerraService.wsdl b/Ch5 - TerraServer/Web References/net.terraservice/TerraService.wsdl new file mode 100644 index 0000000..185fd59 --- /dev/null +++ b/Ch5 - TerraServer/Web References/net.terraservice/TerraService.wsdl @@ -0,0 +1,862 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ch5 - TerraServer/bin/Ch5 - TerraServer.exe b/Ch5 - TerraServer/bin/Ch5 - TerraServer.exe new file mode 100644 index 0000000..3dee2e7 Binary files /dev/null and b/Ch5 - TerraServer/bin/Ch5 - TerraServer.exe differ diff --git a/Ch5 - TerraServer/bin/Ch5 - TerraServer.pdb b/Ch5 - TerraServer/bin/Ch5 - TerraServer.pdb new file mode 100644 index 0000000..ca985d5 Binary files /dev/null and b/Ch5 - TerraServer/bin/Ch5 - TerraServer.pdb differ diff --git a/Ch5 - TerraServer/obj/Debug/Ch5 - TerraServer.exe b/Ch5 - TerraServer/obj/Debug/Ch5 - TerraServer.exe new file mode 100644 index 0000000..3dee2e7 Binary files /dev/null and b/Ch5 - TerraServer/obj/Debug/Ch5 - TerraServer.exe differ diff --git a/Ch5 - TerraServer/obj/Debug/Ch5 - TerraServer.pdb b/Ch5 - TerraServer/obj/Debug/Ch5 - TerraServer.pdb new file mode 100644 index 0000000..ca985d5 Binary files /dev/null and b/Ch5 - TerraServer/obj/Debug/Ch5 - TerraServer.pdb differ diff --git a/Ch5 - TerraServer/obj/Debug/Ch5___TerraServer.Form1.resources b/Ch5 - TerraServer/obj/Debug/Ch5___TerraServer.Form1.resources new file mode 100644 index 0000000..e30700f Binary files /dev/null and b/Ch5 - TerraServer/obj/Debug/Ch5___TerraServer.Form1.resources differ diff --git a/Ch5 - TerraServer/obj/Debug/TempPE/Web References.net.terraservice.Reference.vb.dll b/Ch5 - TerraServer/obj/Debug/TempPE/Web References.net.terraservice.Reference.vb.dll new file mode 100644 index 0000000..203c912 Binary files /dev/null and b/Ch5 - TerraServer/obj/Debug/TempPE/Web References.net.terraservice.Reference.vb.dll differ diff --git a/Ch7 - Adding Favorites/AssemblyInfo.vb b/Ch7 - Adding Favorites/AssemblyInfo.vb new file mode 100644 index 0000000..f02ba4e --- /dev/null +++ b/Ch7 - Adding Favorites/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Adding Favorites/Ch7 - Adding Favorites.sln b/Ch7 - Adding Favorites/Ch7 - Adding Favorites.sln new file mode 100644 index 0000000..e752935 --- /dev/null +++ b/Ch7 - Adding Favorites/Ch7 - Adding Favorites.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Adding Favorites", "Ch7 - Adding Favorites.vbproj", "{EF85C7A4-1B92-4513-AE82-A0BC64F88E91}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {EF85C7A4-1B92-4513-AE82-A0BC64F88E91}.Debug.ActiveCfg = Debug|.NET + {EF85C7A4-1B92-4513-AE82-A0BC64F88E91}.Debug.Build.0 = Debug|.NET + {EF85C7A4-1B92-4513-AE82-A0BC64F88E91}.Release.ActiveCfg = Release|.NET + {EF85C7A4-1B92-4513-AE82-A0BC64F88E91}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Adding Favorites/Ch7 - Adding Favorites.suo b/Ch7 - Adding Favorites/Ch7 - Adding Favorites.suo new file mode 100644 index 0000000..aa759aa Binary files /dev/null and b/Ch7 - Adding Favorites/Ch7 - Adding Favorites.suo differ diff --git a/Ch7 - Adding Favorites/Ch7 - Adding Favorites.vbproj b/Ch7 - Adding Favorites/Ch7 - Adding Favorites.vbproj new file mode 100644 index 0000000..0cf94da --- /dev/null +++ b/Ch7 - Adding Favorites/Ch7 - Adding Favorites.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Adding Favorites/Ch7 - Adding Favorites.vbproj.user b/Ch7 - Adding Favorites/Ch7 - Adding Favorites.vbproj.user new file mode 100644 index 0000000..447fdc6 --- /dev/null +++ b/Ch7 - Adding Favorites/Ch7 - Adding Favorites.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Adding Favorites/Form1.resx b/Ch7 - Adding Favorites/Form1.resx new file mode 100644 index 0000000..e25f8ab --- /dev/null +++ b/Ch7 - Adding Favorites/Form1.resx @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Adding Favorites/Form1.vb b/Ch7 - Adding Favorites/Form1.vb new file mode 100644 index 0000000..0bdcf2e --- /dev/null +++ b/Ch7 - Adding Favorites/Form1.vb @@ -0,0 +1,80 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(56, 40) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(344, 48) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Click here to add a couple of sample Favorites to your machine!" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(448, 150) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1}) + Me.Name = "Form1" + Me.Text = "Adding a Web Shortcut to the Favorites" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + CreateShortcut("Karl Moore.com", "http://www.karlmoore.com/") + CreateShortcut("White Cliff Computing Ltd", "http://www.whitecliff.net/") + End Sub + + Public Sub CreateShortcut(ByVal Title As String, ByVal URL As String) + ' Creates a shortcut in the users Favorites folder + Dim strFavoriteFolder As String + ' Retrieve the favorite folder + strFavoriteFolder = System.Environment.GetFolderPath( _ + Environment.SpecialFolder.Favorites) + ' Create shortcut file, based on Title + Dim objWriter As System.IO.StreamWriter = _ + System.IO.File.CreateText(strFavoriteFolder & _ + "\" & Title & ".url") + ' Write URL to file + objWriter.WriteLine("[InternetShortcut]") + objWriter.WriteLine("URL=" & URL) + ' Close file + objWriter.Close() + End Sub + +End Class diff --git a/Ch7 - Adding Favorites/bin/Ch7 - Adding Favorites.exe b/Ch7 - Adding Favorites/bin/Ch7 - Adding Favorites.exe new file mode 100644 index 0000000..71ae7ba Binary files /dev/null and b/Ch7 - Adding Favorites/bin/Ch7 - Adding Favorites.exe differ diff --git a/Ch7 - Adding Favorites/bin/Ch7 - Adding Favorites.pdb b/Ch7 - Adding Favorites/bin/Ch7 - Adding Favorites.pdb new file mode 100644 index 0000000..a8f384e Binary files /dev/null and b/Ch7 - Adding Favorites/bin/Ch7 - Adding Favorites.pdb differ diff --git a/Ch7 - Adding Favorites/obj/Debug/Ch7 - Adding Favorites.exe b/Ch7 - Adding Favorites/obj/Debug/Ch7 - Adding Favorites.exe new file mode 100644 index 0000000..71ae7ba Binary files /dev/null and b/Ch7 - Adding Favorites/obj/Debug/Ch7 - Adding Favorites.exe differ diff --git a/Ch7 - Adding Favorites/obj/Debug/Ch7 - Adding Favorites.pdb b/Ch7 - Adding Favorites/obj/Debug/Ch7 - Adding Favorites.pdb new file mode 100644 index 0000000..a8f384e Binary files /dev/null and b/Ch7 - Adding Favorites/obj/Debug/Ch7 - Adding Favorites.pdb differ diff --git a/Ch7 - Adding Favorites/obj/Debug/Ch7___Adding_Favorites.Form1.resources b/Ch7 - Adding Favorites/obj/Debug/Ch7___Adding_Favorites.Form1.resources new file mode 100644 index 0000000..ad3ef8f Binary files /dev/null and b/Ch7 - Adding Favorites/obj/Debug/Ch7___Adding_Favorites.Form1.resources differ diff --git a/Ch7 - Check Files Are Identical/AssemblyInfo.vb b/Ch7 - Check Files Are Identical/AssemblyInfo.vb new file mode 100644 index 0000000..4c7b5c0 --- /dev/null +++ b/Ch7 - Check Files Are Identical/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Check Files Are Identical/Ch7 - Check Files Are Identical.sln b/Ch7 - Check Files Are Identical/Ch7 - Check Files Are Identical.sln new file mode 100644 index 0000000..20e9619 --- /dev/null +++ b/Ch7 - Check Files Are Identical/Ch7 - Check Files Are Identical.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Check Files Are Identical", "Ch7 - Check Files Are Identical.vbproj", "{DD2D9181-EE00-4DAF-A8E2-8D273527F19F}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {DD2D9181-EE00-4DAF-A8E2-8D273527F19F}.Debug.ActiveCfg = Debug|.NET + {DD2D9181-EE00-4DAF-A8E2-8D273527F19F}.Debug.Build.0 = Debug|.NET + {DD2D9181-EE00-4DAF-A8E2-8D273527F19F}.Release.ActiveCfg = Release|.NET + {DD2D9181-EE00-4DAF-A8E2-8D273527F19F}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Check Files Are Identical/Ch7 - Check Files Are Identical.suo b/Ch7 - Check Files Are Identical/Ch7 - Check Files Are Identical.suo new file mode 100644 index 0000000..18e2077 Binary files /dev/null and b/Ch7 - Check Files Are Identical/Ch7 - Check Files Are Identical.suo differ diff --git a/Ch7 - Check Files Are Identical/Ch7 - Check Files Are Identical.vbproj b/Ch7 - Check Files Are Identical/Ch7 - Check Files Are Identical.vbproj new file mode 100644 index 0000000..2108ff8 --- /dev/null +++ b/Ch7 - Check Files Are Identical/Ch7 - Check Files Are Identical.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Check Files Are Identical/Ch7 - Check Files Are Identical.vbproj.user b/Ch7 - Check Files Are Identical/Ch7 - Check Files Are Identical.vbproj.user new file mode 100644 index 0000000..eabb41d --- /dev/null +++ b/Ch7 - Check Files Are Identical/Ch7 - Check Files Are Identical.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Check Files Are Identical/Form1.resx b/Ch7 - Check Files Are Identical/Form1.resx new file mode 100644 index 0000000..e25f8ab --- /dev/null +++ b/Ch7 - Check Files Are Identical/Form1.resx @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Check Files Are Identical/Form1.vb b/Ch7 - Check Files Are Identical/Form1.vb new file mode 100644 index 0000000..baf5153 --- /dev/null +++ b/Ch7 - Check Files Are Identical/Form1.vb @@ -0,0 +1,96 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(96, 72) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(248, 56) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Click here to compare 1.jpg and 2.jpg" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(456, 214) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1}) + Me.Name = "Form1" + Me.Text = "Check whether two files are identical..." + Me.ResumeLayout(False) + + End Sub + +#End Region + + Public Function CompareFiles(ByVal File1 As String, _ + ByVal File2 As String) As Boolean + ' Compares two files, byte by byte + ' and returns true if no differences + Dim blnIdentical As Boolean = True + Dim objFS1 As System.IO.FileStream = _ + New System.IO.FileStream(File1, System.IO.FileMode.Open) + Dim objFS2 As System.IO.FileStream = _ + New System.IO.FileStream(File2, System.IO.FileMode.Open) + ' Begin by checking length + If (objFS1.Length <> objFS2.Length) Then + blnIdentical = False + Else + ' Start looping through, comparing bytes + Dim intByteF1 As Integer + Dim intByteF2 As Integer + Do + intByteF1 = objFS1.ReadByte() + intByteF2 = objFS2.ReadByte() + If intByteF1 <> intByteF2 Then + blnIdentical = False + Exit Do + End If + Loop While (intByteF1 <> -1) + End If + ' Close files and set return value + objFS1.Close() + objFS2.Close() + Return blnIdentical + End Function + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + If CompareFiles(Application.StartupPath & "\1.jpg", Application.StartupPath & "\2.jpg") Then + MessageBox.Show("Files are identical!") + Else + MessageBox.Show("Files do not match!") + End If + End Sub +End Class diff --git a/Ch7 - Check Files Are Identical/bin/1.JPG b/Ch7 - Check Files Are Identical/bin/1.JPG new file mode 100644 index 0000000..0838f60 Binary files /dev/null and b/Ch7 - Check Files Are Identical/bin/1.JPG differ diff --git a/Ch7 - Check Files Are Identical/bin/2.JPG b/Ch7 - Check Files Are Identical/bin/2.JPG new file mode 100644 index 0000000..0838f60 Binary files /dev/null and b/Ch7 - Check Files Are Identical/bin/2.JPG differ diff --git a/Ch7 - Check Files Are Identical/bin/Ch7 - Check Files Are Identical.exe b/Ch7 - Check Files Are Identical/bin/Ch7 - Check Files Are Identical.exe new file mode 100644 index 0000000..fff9269 Binary files /dev/null and b/Ch7 - Check Files Are Identical/bin/Ch7 - Check Files Are Identical.exe differ diff --git a/Ch7 - Check Files Are Identical/bin/Ch7 - Check Files Are Identical.pdb b/Ch7 - Check Files Are Identical/bin/Ch7 - Check Files Are Identical.pdb new file mode 100644 index 0000000..35802a2 Binary files /dev/null and b/Ch7 - Check Files Are Identical/bin/Ch7 - Check Files Are Identical.pdb differ diff --git a/Ch7 - Check Files Are Identical/obj/Debug/Ch7 - Check Files Are Identical.exe b/Ch7 - Check Files Are Identical/obj/Debug/Ch7 - Check Files Are Identical.exe new file mode 100644 index 0000000..fff9269 Binary files /dev/null and b/Ch7 - Check Files Are Identical/obj/Debug/Ch7 - Check Files Are Identical.exe differ diff --git a/Ch7 - Check Files Are Identical/obj/Debug/Ch7 - Check Files Are Identical.pdb b/Ch7 - Check Files Are Identical/obj/Debug/Ch7 - Check Files Are Identical.pdb new file mode 100644 index 0000000..35802a2 Binary files /dev/null and b/Ch7 - Check Files Are Identical/obj/Debug/Ch7 - Check Files Are Identical.pdb differ diff --git a/Ch7 - Check Files Are Identical/obj/Debug/Ch7___Check_Files_Are_Identical.Form1.resources b/Ch7 - Check Files Are Identical/obj/Debug/Ch7___Check_Files_Are_Identical.Form1.resources new file mode 100644 index 0000000..ad3ef8f Binary files /dev/null and b/Ch7 - Check Files Are Identical/obj/Debug/Ch7___Check_Files_Are_Identical.Form1.resources differ diff --git a/Ch7 - Convert Image Format/AssemblyInfo.vb b/Ch7 - Convert Image Format/AssemblyInfo.vb new file mode 100644 index 0000000..abff2a4 --- /dev/null +++ b/Ch7 - Convert Image Format/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Convert Image Format/Ch7 - Convert Image Format.sln b/Ch7 - Convert Image Format/Ch7 - Convert Image Format.sln new file mode 100644 index 0000000..8ea3da4 --- /dev/null +++ b/Ch7 - Convert Image Format/Ch7 - Convert Image Format.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Convert Image Format", "Ch7 - Convert Image Format.vbproj", "{8F9DC8AA-5EA2-452C-B606-4EAED3FB9B6D}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {8F9DC8AA-5EA2-452C-B606-4EAED3FB9B6D}.Debug.ActiveCfg = Debug|.NET + {8F9DC8AA-5EA2-452C-B606-4EAED3FB9B6D}.Debug.Build.0 = Debug|.NET + {8F9DC8AA-5EA2-452C-B606-4EAED3FB9B6D}.Release.ActiveCfg = Release|.NET + {8F9DC8AA-5EA2-452C-B606-4EAED3FB9B6D}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Convert Image Format/Ch7 - Convert Image Format.suo b/Ch7 - Convert Image Format/Ch7 - Convert Image Format.suo new file mode 100644 index 0000000..35aba1a Binary files /dev/null and b/Ch7 - Convert Image Format/Ch7 - Convert Image Format.suo differ diff --git a/Ch7 - Convert Image Format/Ch7 - Convert Image Format.vbproj b/Ch7 - Convert Image Format/Ch7 - Convert Image Format.vbproj new file mode 100644 index 0000000..8fd2b21 --- /dev/null +++ b/Ch7 - Convert Image Format/Ch7 - Convert Image Format.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Convert Image Format/Ch7 - Convert Image Format.vbproj.user b/Ch7 - Convert Image Format/Ch7 - Convert Image Format.vbproj.user new file mode 100644 index 0000000..447fdc6 --- /dev/null +++ b/Ch7 - Convert Image Format/Ch7 - Convert Image Format.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Convert Image Format/Form1.resx b/Ch7 - Convert Image Format/Form1.resx new file mode 100644 index 0000000..e25f8ab --- /dev/null +++ b/Ch7 - Convert Image Format/Form1.resx @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Convert Image Format/Form1.vb b/Ch7 - Convert Image Format/Form1.vb new file mode 100644 index 0000000..8d30799 --- /dev/null +++ b/Ch7 - Convert Image Format/Form1.vb @@ -0,0 +1,76 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(56, 48) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(352, 56) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Button1" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(488, 150) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1}) + Me.Name = "Form1" + Me.Text = "Convert image format" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + ConvertImage(Application.StartupPath & "\sample.gif", _ + System.Drawing.Imaging.ImageFormat.Bmp, "c:\newimage.bmp") + End Sub + + Public Sub ConvertImage(ByVal Filename As String, _ + ByVal DesiredFormat As System.Drawing.Imaging.ImageFormat, _ + ByVal NewFilename As String) + ' Takes a filename and saves the file in a new format + Try + Dim imgFile As System.Drawing.Image = _ + System.Drawing.Image.FromFile(Filename) + imgFile.Save(NewFilename, DesiredFormat) + Catch ex As Exception + Throw ex + End Try + End Sub + +End Class diff --git a/Ch7 - Convert Image Format/bin/Ch7 - Convert Image Format.exe b/Ch7 - Convert Image Format/bin/Ch7 - Convert Image Format.exe new file mode 100644 index 0000000..2af91e9 Binary files /dev/null and b/Ch7 - Convert Image Format/bin/Ch7 - Convert Image Format.exe differ diff --git a/Ch7 - Convert Image Format/bin/Ch7 - Convert Image Format.pdb b/Ch7 - Convert Image Format/bin/Ch7 - Convert Image Format.pdb new file mode 100644 index 0000000..b2abae4 Binary files /dev/null and b/Ch7 - Convert Image Format/bin/Ch7 - Convert Image Format.pdb differ diff --git a/Ch7 - Convert Image Format/bin/sample.gif b/Ch7 - Convert Image Format/bin/sample.gif new file mode 100644 index 0000000..61eb1be Binary files /dev/null and b/Ch7 - Convert Image Format/bin/sample.gif differ diff --git a/Ch7 - Convert Image Format/obj/Debug/Ch7 - Convert Image Format.exe b/Ch7 - Convert Image Format/obj/Debug/Ch7 - Convert Image Format.exe new file mode 100644 index 0000000..2af91e9 Binary files /dev/null and b/Ch7 - Convert Image Format/obj/Debug/Ch7 - Convert Image Format.exe differ diff --git a/Ch7 - Convert Image Format/obj/Debug/Ch7 - Convert Image Format.pdb b/Ch7 - Convert Image Format/obj/Debug/Ch7 - Convert Image Format.pdb new file mode 100644 index 0000000..b2abae4 Binary files /dev/null and b/Ch7 - Convert Image Format/obj/Debug/Ch7 - Convert Image Format.pdb differ diff --git a/Ch7 - Convert Image Format/obj/Debug/Ch7___Convert_Image_Format.Form1.resources b/Ch7 - Convert Image Format/obj/Debug/Ch7___Convert_Image_Format.Form1.resources new file mode 100644 index 0000000..ad3ef8f Binary files /dev/null and b/Ch7 - Convert Image Format/obj/Debug/Ch7___Convert_Image_Format.Form1.resources differ diff --git a/Ch7 - Drawing/AssemblyInfo.vb b/Ch7 - Drawing/AssemblyInfo.vb new file mode 100644 index 0000000..345de7b --- /dev/null +++ b/Ch7 - Drawing/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Drawing/Ch7 - Drawing.sln b/Ch7 - Drawing/Ch7 - Drawing.sln new file mode 100644 index 0000000..d4ba34b --- /dev/null +++ b/Ch7 - Drawing/Ch7 - Drawing.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Drawing", "Ch7 - Drawing.vbproj", "{EDD23C48-43FE-42E4-9958-6797472B9F43}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {EDD23C48-43FE-42E4-9958-6797472B9F43}.Debug.ActiveCfg = Debug|.NET + {EDD23C48-43FE-42E4-9958-6797472B9F43}.Debug.Build.0 = Debug|.NET + {EDD23C48-43FE-42E4-9958-6797472B9F43}.Release.ActiveCfg = Release|.NET + {EDD23C48-43FE-42E4-9958-6797472B9F43}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Drawing/Ch7 - Drawing.suo b/Ch7 - Drawing/Ch7 - Drawing.suo new file mode 100644 index 0000000..3cdb13c Binary files /dev/null and b/Ch7 - Drawing/Ch7 - Drawing.suo differ diff --git a/Ch7 - Drawing/Ch7 - Drawing.vbproj b/Ch7 - Drawing/Ch7 - Drawing.vbproj new file mode 100644 index 0000000..1602a17 --- /dev/null +++ b/Ch7 - Drawing/Ch7 - Drawing.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Drawing/Ch7 - Drawing.vbproj.user b/Ch7 - Drawing/Ch7 - Drawing.vbproj.user new file mode 100644 index 0000000..c168d10 --- /dev/null +++ b/Ch7 - Drawing/Ch7 - Drawing.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Drawing/Form1.resx b/Ch7 - Drawing/Form1.resx new file mode 100644 index 0000000..e25f8ab --- /dev/null +++ b/Ch7 - Drawing/Form1.resx @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Drawing/Form1.vb b/Ch7 - Drawing/Form1.vb new file mode 100644 index 0000000..addc4c4 --- /dev/null +++ b/Ch7 - Drawing/Form1.vb @@ -0,0 +1,85 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(328, 192) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(104, 32) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Draw sample" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(448, 238) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1}) + Me.Name = "Form1" + Me.Text = "Drawing with Windows Forms" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + + ' Get Graphics object, our "sheet of drawing paper" + Dim objGraphics As System.Drawing.Graphics = Me.CreateGraphics + + ' Create new Pen, color blue, width 10 + Dim objPen As New Pen(Color.Blue, 10) + ' Draw line using pen from + ' 45 across, 45 down to 95 across, 95 down + objGraphics.DrawLine(objPen, 45, 45, 95, 95) + + ' Draw arc, this time using built-in green pen + ' 8 across, 10 down to 30 across, 30 down + ' with a 90 degree start angle and 180 degree sweep + objGraphics.DrawArc(Pens.Green, 8, 10, 30, 30, 90, 180) + + ' Create new Brush-based object, color purple + Dim objBrush As New SolidBrush(Color.Purple) + ' Draw rectangle area using brush + ' start at 100 across, 100 down, + ' carry on for 50 across, 50 down + objGraphics.FillRectangle(objBrush, 100, 100, 50, 50) + + ' Draw ellipse, this time using built-in orange brush + objGraphics.FillEllipse(Brushes.Orange, 10, 10, 30, 30) + + End Sub +End Class diff --git a/Ch7 - Drawing/bin/Ch7 - Drawing.exe b/Ch7 - Drawing/bin/Ch7 - Drawing.exe new file mode 100644 index 0000000..992b28b Binary files /dev/null and b/Ch7 - Drawing/bin/Ch7 - Drawing.exe differ diff --git a/Ch7 - Drawing/bin/Ch7 - Drawing.pdb b/Ch7 - Drawing/bin/Ch7 - Drawing.pdb new file mode 100644 index 0000000..84aeedf Binary files /dev/null and b/Ch7 - Drawing/bin/Ch7 - Drawing.pdb differ diff --git a/Ch7 - Drawing/obj/Debug/Ch7 - Drawing.exe b/Ch7 - Drawing/obj/Debug/Ch7 - Drawing.exe new file mode 100644 index 0000000..992b28b Binary files /dev/null and b/Ch7 - Drawing/obj/Debug/Ch7 - Drawing.exe differ diff --git a/Ch7 - Drawing/obj/Debug/Ch7 - Drawing.pdb b/Ch7 - Drawing/obj/Debug/Ch7 - Drawing.pdb new file mode 100644 index 0000000..84aeedf Binary files /dev/null and b/Ch7 - Drawing/obj/Debug/Ch7 - Drawing.pdb differ diff --git a/Ch7 - Drawing/obj/Debug/Ch7___Drawing.Form1.resources b/Ch7 - Drawing/obj/Debug/Ch7___Drawing.Form1.resources new file mode 100644 index 0000000..ad3ef8f Binary files /dev/null and b/Ch7 - Drawing/obj/Debug/Ch7___Drawing.Form1.resources differ diff --git a/Ch7 - English File Size/AssemblyInfo.vb b/Ch7 - English File Size/AssemblyInfo.vb new file mode 100644 index 0000000..cbe33fd --- /dev/null +++ b/Ch7 - English File Size/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - English File Size/Ch7 - English File Size.sln b/Ch7 - English File Size/Ch7 - English File Size.sln new file mode 100644 index 0000000..480137e --- /dev/null +++ b/Ch7 - English File Size/Ch7 - English File Size.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - English File Size", "Ch7 - English File Size.vbproj", "{AA338B34-33A6-4F4E-9CDB-F8ECA36031AA}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {AA338B34-33A6-4F4E-9CDB-F8ECA36031AA}.Debug.ActiveCfg = Debug|.NET + {AA338B34-33A6-4F4E-9CDB-F8ECA36031AA}.Debug.Build.0 = Debug|.NET + {AA338B34-33A6-4F4E-9CDB-F8ECA36031AA}.Release.ActiveCfg = Release|.NET + {AA338B34-33A6-4F4E-9CDB-F8ECA36031AA}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - English File Size/Ch7 - English File Size.suo b/Ch7 - English File Size/Ch7 - English File Size.suo new file mode 100644 index 0000000..02fd6b8 Binary files /dev/null and b/Ch7 - English File Size/Ch7 - English File Size.suo differ diff --git a/Ch7 - English File Size/Ch7 - English File Size.vbproj b/Ch7 - English File Size/Ch7 - English File Size.vbproj new file mode 100644 index 0000000..bf32f0e --- /dev/null +++ b/Ch7 - English File Size/Ch7 - English File Size.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - English File Size/Ch7 - English File Size.vbproj.user b/Ch7 - English File Size/Ch7 - English File Size.vbproj.user new file mode 100644 index 0000000..eabb41d --- /dev/null +++ b/Ch7 - English File Size/Ch7 - English File Size.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - English File Size/Form1.resx b/Ch7 - English File Size/Form1.resx new file mode 100644 index 0000000..1f8a3d4 --- /dev/null +++ b/Ch7 - English File Size/Form1.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + 17, 17 + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - English File Size/Form1.vb b/Ch7 - English File Size/Form1.vb new file mode 100644 index 0000000..4333c8e --- /dev/null +++ b/Ch7 - English File Size/Form1.vb @@ -0,0 +1,101 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents OFD As System.Windows.Forms.OpenFileDialog + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents Label2 As System.Windows.Forms.Label + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.OFD = New System.Windows.Forms.OpenFileDialog() + Me.Label1 = New System.Windows.Forms.Label() + Me.Label2 = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(24, 24) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(360, 32) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Click here and select any file!" + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(24, 72) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(272, 24) + Me.Label1.TabIndex = 1 + ' + 'Label2 + ' + Me.Label2.Font = New System.Drawing.Font("Arial", 18.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label2.Location = New System.Drawing.Point(248, 128) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(144, 48) + Me.Label2.TabIndex = 2 + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(408, 182) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label2, Me.Label1, Me.Button1}) + Me.Name = "Form1" + Me.Text = "How Big Is That File – In English?" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Public Function ConvertBytes(ByVal Bytes As Long) As String + ' Converts bytes into a readable "1.44 MB", etc. string + If Bytes >= 1073741824 Then + Return Format(Bytes / 1024 / 1024 / 1024, "#0.00") _ + & " GB" + ElseIf Bytes >= 1048576 Then + Return Format(Bytes / 1024 / 1024, "#0.00") & " MB" + ElseIf Bytes >= 1024 Then + Return Format(Bytes / 1024, "#0.00") & " KB" + ElseIf Bytes > 0 And Bytes < 1024 Then + Return Fix(Bytes) & " Bytes" + Else + Return "0 Bytes" + End If + End Function + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + OFD.ShowDialog() + Dim objInfo As New System.IO.FileInfo(OFD.FileName) + Label1.Text = "The file is " & objInfo.Length & " bytes, which is..." + Label2.Text = ConvertBytes(objInfo.Length) + End Sub +End Class diff --git a/Ch7 - English File Size/bin/Ch7 - English File Size.exe b/Ch7 - English File Size/bin/Ch7 - English File Size.exe new file mode 100644 index 0000000..0ccf577 Binary files /dev/null and b/Ch7 - English File Size/bin/Ch7 - English File Size.exe differ diff --git a/Ch7 - English File Size/bin/Ch7 - English File Size.pdb b/Ch7 - English File Size/bin/Ch7 - English File Size.pdb new file mode 100644 index 0000000..bd30d7a Binary files /dev/null and b/Ch7 - English File Size/bin/Ch7 - English File Size.pdb differ diff --git a/Ch7 - English File Size/obj/Debug/Ch7 - English File Size.exe b/Ch7 - English File Size/obj/Debug/Ch7 - English File Size.exe new file mode 100644 index 0000000..0ccf577 Binary files /dev/null and b/Ch7 - English File Size/obj/Debug/Ch7 - English File Size.exe differ diff --git a/Ch7 - English File Size/obj/Debug/Ch7 - English File Size.pdb b/Ch7 - English File Size/obj/Debug/Ch7 - English File Size.pdb new file mode 100644 index 0000000..bd30d7a Binary files /dev/null and b/Ch7 - English File Size/obj/Debug/Ch7 - English File Size.pdb differ diff --git a/Ch7 - English File Size/obj/Debug/Ch7___English_File_Size.Form1.resources b/Ch7 - English File Size/obj/Debug/Ch7___English_File_Size.Form1.resources new file mode 100644 index 0000000..fbf331a Binary files /dev/null and b/Ch7 - English File Size/obj/Debug/Ch7___English_File_Size.Form1.resources differ diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/AssemblyInfo.vb b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/AssemblyInfo.vb new file mode 100644 index 0000000..96268b3 --- /dev/null +++ b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Ch7 - Enum Binding.vbproj b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Ch7 - Enum Binding.vbproj new file mode 100644 index 0000000..1a61e0b --- /dev/null +++ b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Ch7 - Enum Binding.vbproj @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Ch7 - Enum Binding.vbproj.webinfo b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Ch7 - Enum Binding.vbproj.webinfo new file mode 100644 index 0000000..13709be --- /dev/null +++ b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Ch7 - Enum Binding.vbproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Ch7 - Enum Binding.vsdisco b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Ch7 - Enum Binding.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Ch7 - Enum Binding.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Global.asax b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Global.asax new file mode 100644 index 0000000..c315702 --- /dev/null +++ b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="Ch7___Enum_Binding.Global" %> \ No newline at end of file diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Global.asax.resx b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Global.asax.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Global.asax.vb b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Global.asax.vb new file mode 100644 index 0000000..25e6587 --- /dev/null +++ b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Global.asax.vb @@ -0,0 +1,59 @@ +Imports System.Web +Imports System.Web.SessionState + +Public Class Global + Inherits System.Web.HttpApplication + +#Region " Component Designer Generated Code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Component Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Required by the Component Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Component Designer + 'It can be modified using the Component Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + components = New System.ComponentModel.Container() + End Sub + +#End Region + + Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application is started + End Sub + + Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session is started + End Sub + + Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires at the beginning of each request + End Sub + + Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + ' Fires upon attempting to authenticate the use + End Sub + + Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when an error occurs + End Sub + + Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the session ends + End Sub + + Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + ' Fires when the application ends + End Sub + +End Class diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Styles.css b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Styles.css new file mode 100644 index 0000000..8fe2cd9 --- /dev/null +++ b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Styles.css @@ -0,0 +1,163 @@ +/* Default CSS Stylesheet for a new Web Application project */ + +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: Verdana, Helvetica, sans-serif; + FONT-SIZE: .8em; + FONT-WEIGHT: normal; + LETTER-SPACING: normal; + TEXT-TRANSFORM: none; + WORD-SPACING: normal +} + +H1, H2, H3, H4, H5, TH, THEAD, TFOOT +{ + COLOR: #003366; +} +H1 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 2em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H2 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.75em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H3 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.58em; + font-weight: 500; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H4 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1.33em; + font-weight: 500; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H5, DT { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 1em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +H6 { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .8em; + font-weight: 700; + font-style: normal; + text-decoration: none; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + } + +TFOOT, THEAD { + font-size: 1em; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + +TH { + vertical-align: baseline; + font-size: 1em; + font-weight: bold; + word-spacing: normal; + letter-spacing: normal; + text-transform: none; + font-family: Arial, Helvetica, sans-serif; + } + + +A:link { + text-decoration: none; + color: #3333cc; + } + +A:visited { + text-decoration: none; + color: #333399; + } + +A:active { + text-decoration: none; + color: #333399; + } + +A:hover { + text-decoration: underline; + color: #3333cc; + } + +SMALL { + font-size: .7em; + } + +BIG { + font-size: 1.17em; + } + +BLOCKQUOTE, PRE { + font-family: Courier New, monospace; + } + + +UL LI { + list-style-type: square ; + } + +UL LI LI { + list-style-type: disc; + } + +UL LI LI LI { + list-style-type: circle; + } + +OL LI { + list-style-type: decimal; + } + +OL OL LI { + list-style-type: lower-alpha; + } + +OL OL OL LI { + list-style-type: lower-roman; + } + +IMG { + margin-top: 5px; + margin-left: 10px; + margin-right: 10px; + } diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Web.config b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Web.config new file mode 100644 index 0000000..227fa61 --- /dev/null +++ b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/Web.config @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/WebForm1.aspx b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/WebForm1.aspx new file mode 100644 index 0000000..6b287da --- /dev/null +++ b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/WebForm1.aspx @@ -0,0 +1,17 @@ +<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Ch7___Enum_Binding.WebForm1"%> + + + + WebForm1 + + + + + + +
+ + +
+ + diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/WebForm1.aspx.resx b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/WebForm1.aspx.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/WebForm1.aspx.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/WebForm1.aspx.vb b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/WebForm1.aspx.vb new file mode 100644 index 0000000..5075a64 --- /dev/null +++ b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/WebForm1.aspx.vb @@ -0,0 +1,47 @@ +Public Class WebForm1 + Inherits System.Web.UI.Page + Protected WithEvents Button1 As System.Web.UI.WebControls.Button + Protected WithEvents ListBox1 As System.Web.UI.WebControls.ListBox + +#Region " Web Form Designer Generated Code " + + 'This call is required by the Web Form Designer. + Private Sub InitializeComponent() + + End Sub + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + 'CODEGEN: This method call is required by the Web Form Designer + 'Do not modify it using the code editor. + InitializeComponent() + End Sub + +#End Region + + Public Enum Test + ABC = 1 + DEF = 2 + GHI = 3 + End Enum + + Public Sub AddEnumToList(ByVal GetSystemType As System.Type, _ + ByVal List As System.Web.UI.WebControls.ListControl) + ' Populates the specified list with the + ' names and values of the passed system type + Dim strNames As String(), arrValues As System.Array + Dim intCount As Integer + strNames = [Enum].GetNames(GetSystemType) + arrValues = [Enum].GetValues(GetSystemType) + List.Items.Clear() + For intCount = LBound(strNames) To UBound(strNames) + List.Items.Add(New _ + System.Web.UI.WebControls.ListItem(strNames(intCount), _ + arrValues.GetValue(intCount))) + Next + End Sub + + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + AddEnumToList(GetType(Test), ListBox1) + End Sub +End Class diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/_vti_pvt/access.cnf b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/_vti_pvt/access.cnf new file mode 100644 index 0000000..1928a4d --- /dev/null +++ b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:cerberus +InheritPermissions:true +PasswordDir:c:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/_vti_pvt/deptodoc.btr b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..5245e73 Binary files /dev/null and b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/_vti_pvt/deptodoc.btr differ diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/_vti_pvt/doctodep.btr b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/_vti_pvt/doctodep.btr differ diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/_vti_pvt/service.cnf b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/_vti_pvt/service.cnf new file mode 100644 index 0000000..c252cf5 --- /dev/null +++ b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.actproj.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.h.hpp.hxx.i.idl.inc.inl.jsl.kci.lgn.lst.mak.map.mk.odh.odl.prc.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vap.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|07 May 2003 20:16:05 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/_vti_pvt/service.lck b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/_vti_pvt/services.cnf b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/bin/Ch7 - Enum Binding.dll b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/bin/Ch7 - Enum Binding.dll new file mode 100644 index 0000000..00e8f41 Binary files /dev/null and b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/bin/Ch7 - Enum Binding.dll differ diff --git a/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/bin/Ch7 - Enum Binding.pdb b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/bin/Ch7 - Enum Binding.pdb new file mode 100644 index 0000000..2697088 Binary files /dev/null and b/Ch7 - Enum Binding/Web/Ch7 - Enum Binding/bin/Ch7 - Enum Binding.pdb differ diff --git a/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/AssemblyInfo.vb b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/AssemblyInfo.vb new file mode 100644 index 0000000..983ea88 --- /dev/null +++ b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/Ch7 - Enum Binding.sln b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/Ch7 - Enum Binding.sln new file mode 100644 index 0000000..c0effc9 --- /dev/null +++ b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/Ch7 - Enum Binding.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Enum Binding", "Ch7 - Enum Binding.vbproj", "{7FBF482C-DAF3-4FA1-8FEA-D5FDFCD42CFA}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {7FBF482C-DAF3-4FA1-8FEA-D5FDFCD42CFA}.Debug.ActiveCfg = Debug|.NET + {7FBF482C-DAF3-4FA1-8FEA-D5FDFCD42CFA}.Debug.Build.0 = Debug|.NET + {7FBF482C-DAF3-4FA1-8FEA-D5FDFCD42CFA}.Release.ActiveCfg = Release|.NET + {7FBF482C-DAF3-4FA1-8FEA-D5FDFCD42CFA}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/Ch7 - Enum Binding.suo b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/Ch7 - Enum Binding.suo new file mode 100644 index 0000000..165f6b8 Binary files /dev/null and b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/Ch7 - Enum Binding.suo differ diff --git a/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/Ch7 - Enum Binding.vbproj b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/Ch7 - Enum Binding.vbproj new file mode 100644 index 0000000..5ca0dfb --- /dev/null +++ b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/Ch7 - Enum Binding.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/Ch7 - Enum Binding.vbproj.user b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/Ch7 - Enum Binding.vbproj.user new file mode 100644 index 0000000..eabb41d --- /dev/null +++ b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/Ch7 - Enum Binding.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/Form1.resx b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/Form1.resx new file mode 100644 index 0000000..a79d82a --- /dev/null +++ b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/Form1.resx @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/Form1.vb b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/Form1.vb new file mode 100644 index 0000000..c3a1a8b --- /dev/null +++ b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/Form1.vb @@ -0,0 +1,94 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents ListBox1 As System.Windows.Forms.ListBox + Friend WithEvents Button2 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.ListBox1 = New System.Windows.Forms.ListBox() + Me.Button2 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(104, 24) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(184, 24) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Bind to Enum" + ' + 'ListBox1 + ' + Me.ListBox1.Location = New System.Drawing.Point(104, 112) + Me.ListBox1.Name = "ListBox1" + Me.ListBox1.Size = New System.Drawing.Size(184, 82) + Me.ListBox1.TabIndex = 1 + ' + 'Button2 + ' + Me.Button2.Location = New System.Drawing.Point(104, 64) + Me.Button2.Name = "Button2" + Me.Button2.Size = New System.Drawing.Size(184, 24) + Me.Button2.TabIndex = 2 + Me.Button2.Text = "Display Value of Selected" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(392, 246) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button2, Me.ListBox1, Me.Button1}) + Me.Name = "Form1" + Me.Text = "Form1" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Public Enum Test + ABC = 1 + DEF = 2 + GHI = 3 + End Enum + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + ListBox1.DataSource = System.Enum.GetNames(GetType(Test)) + End Sub + + Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click + Dim strNames As Array = _ + System.Enum.GetValues(GetType(Test)) + Dim strValue As String = _ + strNames(ListBox1.SelectedIndex) + MessageBox.Show(strValue) + End Sub +End Class diff --git a/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/bin/Ch7 - Enum Binding.exe b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/bin/Ch7 - Enum Binding.exe new file mode 100644 index 0000000..9f7687f Binary files /dev/null and b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/bin/Ch7 - Enum Binding.exe differ diff --git a/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/bin/Ch7 - Enum Binding.pdb b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/bin/Ch7 - Enum Binding.pdb new file mode 100644 index 0000000..802ea89 Binary files /dev/null and b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/bin/Ch7 - Enum Binding.pdb differ diff --git a/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/obj/Debug/Ch7 - Enum Binding.exe b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/obj/Debug/Ch7 - Enum Binding.exe new file mode 100644 index 0000000..9f7687f Binary files /dev/null and b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/obj/Debug/Ch7 - Enum Binding.exe differ diff --git a/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/obj/Debug/Ch7 - Enum Binding.pdb b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/obj/Debug/Ch7 - Enum Binding.pdb new file mode 100644 index 0000000..802ea89 Binary files /dev/null and b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/obj/Debug/Ch7 - Enum Binding.pdb differ diff --git a/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/obj/Debug/Ch7___Enum_Binding.Form1.resources b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/obj/Debug/Ch7___Enum_Binding.Form1.resources new file mode 100644 index 0000000..91400f4 Binary files /dev/null and b/Ch7 - Enum Binding/Windows/Ch7 - Enum Binding/obj/Debug/Ch7___Enum_Binding.Form1.resources differ diff --git a/Ch7 - Event Log/AssemblyInfo.vb b/Ch7 - Event Log/AssemblyInfo.vb new file mode 100644 index 0000000..c582ed1 --- /dev/null +++ b/Ch7 - Event Log/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Event Log/Ch7 - Event Log.sln b/Ch7 - Event Log/Ch7 - Event Log.sln new file mode 100644 index 0000000..d2acd03 --- /dev/null +++ b/Ch7 - Event Log/Ch7 - Event Log.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Event Log", "Ch7 - Event Log.vbproj", "{D77AFD90-15B7-44BE-84B7-BBF480A0E4B5}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {D77AFD90-15B7-44BE-84B7-BBF480A0E4B5}.Debug.ActiveCfg = Debug|.NET + {D77AFD90-15B7-44BE-84B7-BBF480A0E4B5}.Debug.Build.0 = Debug|.NET + {D77AFD90-15B7-44BE-84B7-BBF480A0E4B5}.Release.ActiveCfg = Release|.NET + {D77AFD90-15B7-44BE-84B7-BBF480A0E4B5}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Event Log/Ch7 - Event Log.suo b/Ch7 - Event Log/Ch7 - Event Log.suo new file mode 100644 index 0000000..6957d66 Binary files /dev/null and b/Ch7 - Event Log/Ch7 - Event Log.suo differ diff --git a/Ch7 - Event Log/Ch7 - Event Log.vbproj b/Ch7 - Event Log/Ch7 - Event Log.vbproj new file mode 100644 index 0000000..e9e3a89 --- /dev/null +++ b/Ch7 - Event Log/Ch7 - Event Log.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Event Log/Ch7 - Event Log.vbproj.user b/Ch7 - Event Log/Ch7 - Event Log.vbproj.user new file mode 100644 index 0000000..c168d10 --- /dev/null +++ b/Ch7 - Event Log/Ch7 - Event Log.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Event Log/Form1.resx b/Ch7 - Event Log/Form1.resx new file mode 100644 index 0000000..e25f8ab --- /dev/null +++ b/Ch7 - Event Log/Form1.resx @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Event Log/Form1.vb b/Ch7 - Event Log/Form1.vb new file mode 100644 index 0000000..631d855 --- /dev/null +++ b/Ch7 - Event Log/Form1.vb @@ -0,0 +1,91 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(72, 40) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(240, 56) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Run sample event log code" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(384, 150) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1}) + Me.Name = "Form1" + Me.Text = "Putting Messages in the Event Log" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + End Sub + + Public Function WriteToEventLog(ByVal Entry As String, _ + Optional ByVal AppName As String = "VB.NET Application", _ + Optional ByVal EventType As _ + EventLogEntryType = EventLogEntryType.Information, _ + Optional ByVal LogName As String = "Application") As Boolean + ' Writes an entry to the Event Log + Dim objEventLog As New EventLog() + Try + ' Register app as an Event Source + If Not objEventLog.SourceExists(AppName) Then + objEventLog.CreateEventSource(AppName, LogName) + End If + objEventLog.Source = AppName + ' Send entry + objEventLog.WriteEntry(Entry, EventType) + Return True + Catch Ex As Exception + Return False + End Try + End Function + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + ' Simple event log addition + WriteToEventLog("Application has failed to find STARTUP.INI") + + ' Slightly more complex sample + WriteToEventLog("Unable to parse request LOGON", _ + "Authenticator", EventLogEntryType.Error, "Special Log") + End Sub +End Class diff --git a/Ch7 - Event Log/bin/Ch7 - Event Log.exe b/Ch7 - Event Log/bin/Ch7 - Event Log.exe new file mode 100644 index 0000000..3127a73 Binary files /dev/null and b/Ch7 - Event Log/bin/Ch7 - Event Log.exe differ diff --git a/Ch7 - Event Log/bin/Ch7 - Event Log.pdb b/Ch7 - Event Log/bin/Ch7 - Event Log.pdb new file mode 100644 index 0000000..5b4f21a Binary files /dev/null and b/Ch7 - Event Log/bin/Ch7 - Event Log.pdb differ diff --git a/Ch7 - Event Log/obj/Debug/Ch7 - Event Log.exe b/Ch7 - Event Log/obj/Debug/Ch7 - Event Log.exe new file mode 100644 index 0000000..3127a73 Binary files /dev/null and b/Ch7 - Event Log/obj/Debug/Ch7 - Event Log.exe differ diff --git a/Ch7 - Event Log/obj/Debug/Ch7 - Event Log.pdb b/Ch7 - Event Log/obj/Debug/Ch7 - Event Log.pdb new file mode 100644 index 0000000..5b4f21a Binary files /dev/null and b/Ch7 - Event Log/obj/Debug/Ch7 - Event Log.pdb differ diff --git a/Ch7 - Event Log/obj/Debug/Ch7___Event_Log.Form1.resources b/Ch7 - Event Log/obj/Debug/Ch7___Event_Log.Form1.resources new file mode 100644 index 0000000..ad3ef8f Binary files /dev/null and b/Ch7 - Event Log/obj/Debug/Ch7___Event_Log.Form1.resources differ diff --git a/Ch7 - File Associations/AssemblyInfo.vb b/Ch7 - File Associations/AssemblyInfo.vb new file mode 100644 index 0000000..30d4210 --- /dev/null +++ b/Ch7 - File Associations/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - File Associations/Ch7 - File Associations.sln b/Ch7 - File Associations/Ch7 - File Associations.sln new file mode 100644 index 0000000..9a25a3c --- /dev/null +++ b/Ch7 - File Associations/Ch7 - File Associations.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - File Associations", "Ch7 - File Associations.vbproj", "{6C56F32E-DE9D-4B91-A430-88EA476DFDFD}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {6C56F32E-DE9D-4B91-A430-88EA476DFDFD}.Debug.ActiveCfg = Debug|.NET + {6C56F32E-DE9D-4B91-A430-88EA476DFDFD}.Debug.Build.0 = Debug|.NET + {6C56F32E-DE9D-4B91-A430-88EA476DFDFD}.Release.ActiveCfg = Release|.NET + {6C56F32E-DE9D-4B91-A430-88EA476DFDFD}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - File Associations/Ch7 - File Associations.suo b/Ch7 - File Associations/Ch7 - File Associations.suo new file mode 100644 index 0000000..bdc783c Binary files /dev/null and b/Ch7 - File Associations/Ch7 - File Associations.suo differ diff --git a/Ch7 - File Associations/Ch7 - File Associations.vbproj b/Ch7 - File Associations/Ch7 - File Associations.vbproj new file mode 100644 index 0000000..d962f1e --- /dev/null +++ b/Ch7 - File Associations/Ch7 - File Associations.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - File Associations/Ch7 - File Associations.vbproj.user b/Ch7 - File Associations/Ch7 - File Associations.vbproj.user new file mode 100644 index 0000000..eabb41d --- /dev/null +++ b/Ch7 - File Associations/Ch7 - File Associations.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - File Associations/Form1.resx b/Ch7 - File Associations/Form1.resx new file mode 100644 index 0000000..79c51b0 --- /dev/null +++ b/Ch7 - File Associations/Form1.resx @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - File Associations/Form1.vb b/Ch7 - File Associations/Form1.vb new file mode 100644 index 0000000..9fd24d7 --- /dev/null +++ b/Ch7 - File Associations/Form1.vb @@ -0,0 +1,129 @@ +Imports Microsoft.Win32 + +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents Label2 As System.Windows.Forms.Label + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.Label1 = New System.Windows.Forms.Label() + Me.Label2 = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(24, 64) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(168, 32) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Click to retrieve" + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(128, 24) + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(64, 20) + Me.TextBox1.TabIndex = 1 + Me.TextBox1.Text = "" + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(24, 24) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(120, 23) + Me.Label1.TabIndex = 2 + Me.Label1.Text = "Enter an extension:" + ' + 'Label2 + ' + Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label2.Location = New System.Drawing.Point(24, 120) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(384, 24) + Me.Label2.TabIndex = 3 + Me.Label2.Text = "(path will appear here)" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(424, 174) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label2, Me.TextBox1, Me.Label1, Me.Button1}) + Me.Name = "Form1" + Me.Text = "Retrieving the program associated with a file extension" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + Dim strPath As String = GetAssociatedProgram(TextBox1.Text) + If strPath <> "" Then + Label2.Text = strPath + Else + Label2.Text = "No associated application found!" + End If + End Sub + + Public Function GetAssociatedProgram(ByVal FileExtension As String) As String + ' Returns the application associated with the specified FileExtension + ' ie, path\denenv.exe for "VB" files + Dim objExtReg As Microsoft.Win32.RegistryKey = _ + Microsoft.Win32.Registry.ClassesRoot + Dim objAppReg As Microsoft.Win32.RegistryKey = _ + Microsoft.Win32.Registry.ClassesRoot + Dim strExtValue As String + Try + ' Add trailing period if doesn't exist + If FileExtension.Substring(0, 1) <> "." Then _ + FileExtension = "." & FileExtension + ' Open registry areas containing launching app details + objExtReg = objExtReg.OpenSubKey(FileExtension.Trim) + strExtValue = objExtReg.GetValue("") + objAppReg = objAppReg.OpenSubKey(strExtValue & "\shell\open\command") + ' Parse out, tidy up and return result + Dim SplitArray() As String + SplitArray = Split(objAppReg.GetValue(Nothing), """") + If SplitArray(0).Trim.Length > 0 Then + Return SplitArray(0).Replace("%1", "") + Else + Return SplitArray(1).Replace("%1", "") + End If + Catch + Return "" + End Try + End Function + +End Class diff --git a/Ch7 - File Associations/bin/Ch7 - File Associations.exe b/Ch7 - File Associations/bin/Ch7 - File Associations.exe new file mode 100644 index 0000000..c119d8e Binary files /dev/null and b/Ch7 - File Associations/bin/Ch7 - File Associations.exe differ diff --git a/Ch7 - File Associations/bin/Ch7 - File Associations.pdb b/Ch7 - File Associations/bin/Ch7 - File Associations.pdb new file mode 100644 index 0000000..778fa6f Binary files /dev/null and b/Ch7 - File Associations/bin/Ch7 - File Associations.pdb differ diff --git a/Ch7 - File Associations/obj/Debug/Ch7 - File Associations.exe b/Ch7 - File Associations/obj/Debug/Ch7 - File Associations.exe new file mode 100644 index 0000000..c119d8e Binary files /dev/null and b/Ch7 - File Associations/obj/Debug/Ch7 - File Associations.exe differ diff --git a/Ch7 - File Associations/obj/Debug/Ch7 - File Associations.pdb b/Ch7 - File Associations/obj/Debug/Ch7 - File Associations.pdb new file mode 100644 index 0000000..778fa6f Binary files /dev/null and b/Ch7 - File Associations/obj/Debug/Ch7 - File Associations.pdb differ diff --git a/Ch7 - File Associations/obj/Debug/Ch7___File_Associations.Form1.resources b/Ch7 - File Associations/obj/Debug/Ch7___File_Associations.Form1.resources new file mode 100644 index 0000000..c0ee42f Binary files /dev/null and b/Ch7 - File Associations/obj/Debug/Ch7___File_Associations.Form1.resources differ diff --git a/Ch7 - Get Drive Serial/AssemblyInfo.vb b/Ch7 - Get Drive Serial/AssemblyInfo.vb new file mode 100644 index 0000000..aa88d35 --- /dev/null +++ b/Ch7 - Get Drive Serial/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Get Drive Serial/Ch7 - Get Drive Serial.sln b/Ch7 - Get Drive Serial/Ch7 - Get Drive Serial.sln new file mode 100644 index 0000000..0b6d41a --- /dev/null +++ b/Ch7 - Get Drive Serial/Ch7 - Get Drive Serial.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Get Drive Serial", "Ch7 - Get Drive Serial.vbproj", "{09F5C8D1-0135-425E-B361-A7D97CDBAEAF}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {09F5C8D1-0135-425E-B361-A7D97CDBAEAF}.Debug.ActiveCfg = Debug|.NET + {09F5C8D1-0135-425E-B361-A7D97CDBAEAF}.Debug.Build.0 = Debug|.NET + {09F5C8D1-0135-425E-B361-A7D97CDBAEAF}.Release.ActiveCfg = Release|.NET + {09F5C8D1-0135-425E-B361-A7D97CDBAEAF}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Get Drive Serial/Ch7 - Get Drive Serial.suo b/Ch7 - Get Drive Serial/Ch7 - Get Drive Serial.suo new file mode 100644 index 0000000..48a2ac7 Binary files /dev/null and b/Ch7 - Get Drive Serial/Ch7 - Get Drive Serial.suo differ diff --git a/Ch7 - Get Drive Serial/Ch7 - Get Drive Serial.vbproj b/Ch7 - Get Drive Serial/Ch7 - Get Drive Serial.vbproj new file mode 100644 index 0000000..9834cb0 --- /dev/null +++ b/Ch7 - Get Drive Serial/Ch7 - Get Drive Serial.vbproj @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Get Drive Serial/Ch7 - Get Drive Serial.vbproj.user b/Ch7 - Get Drive Serial/Ch7 - Get Drive Serial.vbproj.user new file mode 100644 index 0000000..eabb41d --- /dev/null +++ b/Ch7 - Get Drive Serial/Ch7 - Get Drive Serial.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Get Drive Serial/Form1.resx b/Ch7 - Get Drive Serial/Form1.resx new file mode 100644 index 0000000..7002970 --- /dev/null +++ b/Ch7 - Get Drive Serial/Form1.resx @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Get Drive Serial/Form1.vb b/Ch7 - Get Drive Serial/Form1.vb new file mode 100644 index 0000000..58414d6 --- /dev/null +++ b/Ch7 - Get Drive Serial/Form1.vb @@ -0,0 +1,82 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel + Private Sub InitializeComponent() + Me.Label1 = New System.Windows.Forms.Label() + Me.LinkLabel1 = New System.Windows.Forms.LinkLabel() + Me.SuspendLayout() + ' + 'Label1 + ' + Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 20.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label1.Location = New System.Drawing.Point(48, 72) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(320, 56) + Me.Label1.TabIndex = 0 + ' + 'LinkLabel1 + ' + Me.LinkLabel1.Location = New System.Drawing.Point(40, 24) + Me.LinkLabel1.Name = "LinkLabel1" + Me.LinkLabel1.Size = New System.Drawing.Size(256, 23) + Me.LinkLabel1.TabIndex = 1 + Me.LinkLabel1.TabStop = True + Me.LinkLabel1.Text = "Click here to retrieve serial for C: drive" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(416, 190) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.LinkLabel1, Me.Label1}) + Me.Name = "Form1" + Me.Text = "Retrieving a drive serial number" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Public Function GetDriveSerial(ByVal DriveLetter As String) As String + ' Returns the serial number of the specified drive + ' ie, GetDriveSerial("c:") + Dim strSelectText As String = "Win32_logicaldisk='" & DriveLetter & "'" + Dim objMO As New System.Management.ManagementObject(strSelectText) + objMO.Get() + Return CType(objMO.Properties("VolumeSerialNumber").Value, String) + End Function + + + Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked + Label1.Text = GetDriveSerial("C:") + End Sub +End Class diff --git a/Ch7 - Get Drive Serial/bin/Ch7 - Get Drive Serial.exe b/Ch7 - Get Drive Serial/bin/Ch7 - Get Drive Serial.exe new file mode 100644 index 0000000..72d2893 Binary files /dev/null and b/Ch7 - Get Drive Serial/bin/Ch7 - Get Drive Serial.exe differ diff --git a/Ch7 - Get Drive Serial/bin/Ch7 - Get Drive Serial.pdb b/Ch7 - Get Drive Serial/bin/Ch7 - Get Drive Serial.pdb new file mode 100644 index 0000000..91d64a9 Binary files /dev/null and b/Ch7 - Get Drive Serial/bin/Ch7 - Get Drive Serial.pdb differ diff --git a/Ch7 - Get Drive Serial/obj/Debug/Ch7 - Get Drive Serial.exe b/Ch7 - Get Drive Serial/obj/Debug/Ch7 - Get Drive Serial.exe new file mode 100644 index 0000000..72d2893 Binary files /dev/null and b/Ch7 - Get Drive Serial/obj/Debug/Ch7 - Get Drive Serial.exe differ diff --git a/Ch7 - Get Drive Serial/obj/Debug/Ch7 - Get Drive Serial.pdb b/Ch7 - Get Drive Serial/obj/Debug/Ch7 - Get Drive Serial.pdb new file mode 100644 index 0000000..91d64a9 Binary files /dev/null and b/Ch7 - Get Drive Serial/obj/Debug/Ch7 - Get Drive Serial.pdb differ diff --git a/Ch7 - Get Drive Serial/obj/Debug/Ch7___Get_Drive_Serial.Form1.resources b/Ch7 - Get Drive Serial/obj/Debug/Ch7___Get_Drive_Serial.Form1.resources new file mode 100644 index 0000000..0c1c06c Binary files /dev/null and b/Ch7 - Get Drive Serial/obj/Debug/Ch7___Get_Drive_Serial.Form1.resources differ diff --git a/Ch7 - Gradient/AssemblyInfo.vb b/Ch7 - Gradient/AssemblyInfo.vb new file mode 100644 index 0000000..7bb001e --- /dev/null +++ b/Ch7 - Gradient/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Gradient/Ch7 - Gradient.sln b/Ch7 - Gradient/Ch7 - Gradient.sln new file mode 100644 index 0000000..a065c95 --- /dev/null +++ b/Ch7 - Gradient/Ch7 - Gradient.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Gradient", "Ch7 - Gradient.vbproj", "{A3343F4A-0F3B-497F-9B5D-09C2E31209C0}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {A3343F4A-0F3B-497F-9B5D-09C2E31209C0}.Debug.ActiveCfg = Debug|.NET + {A3343F4A-0F3B-497F-9B5D-09C2E31209C0}.Debug.Build.0 = Debug|.NET + {A3343F4A-0F3B-497F-9B5D-09C2E31209C0}.Release.ActiveCfg = Release|.NET + {A3343F4A-0F3B-497F-9B5D-09C2E31209C0}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Gradient/Ch7 - Gradient.suo b/Ch7 - Gradient/Ch7 - Gradient.suo new file mode 100644 index 0000000..f46bfe9 Binary files /dev/null and b/Ch7 - Gradient/Ch7 - Gradient.suo differ diff --git a/Ch7 - Gradient/Ch7 - Gradient.vbproj b/Ch7 - Gradient/Ch7 - Gradient.vbproj new file mode 100644 index 0000000..97bf10c --- /dev/null +++ b/Ch7 - Gradient/Ch7 - Gradient.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Gradient/Ch7 - Gradient.vbproj.user b/Ch7 - Gradient/Ch7 - Gradient.vbproj.user new file mode 100644 index 0000000..eabb41d --- /dev/null +++ b/Ch7 - Gradient/Ch7 - Gradient.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Gradient/Form1.resx b/Ch7 - Gradient/Form1.resx new file mode 100644 index 0000000..e25f8ab --- /dev/null +++ b/Ch7 - Gradient/Form1.resx @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Gradient/Form1.vb b/Ch7 - Gradient/Form1.vb new file mode 100644 index 0000000..48608ba --- /dev/null +++ b/Ch7 - Gradient/Form1.vb @@ -0,0 +1,77 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Button1.Location = New System.Drawing.Point(120, 64) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(160, 32) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Sample Gradient App!" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.BackColor = System.Drawing.Color.Gainsboro + Me.ClientSize = New System.Drawing.Size(400, 182) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1}) + Me.Name = "Form1" + Me.Text = "Add an Exciting Gradient Backdrop, in Code!" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub DrawFormGradient(ByVal TopColor As Color, ByVal BottomColor As Color) + ' Draws a gradient using the specified colors + ' on the entire page + Dim objBrush As New Drawing2D.LinearGradientBrush _ + (Me.DisplayRectangle, _ + TopColor, _ + BottomColor, _ + Drawing2D.LinearGradientMode.Vertical) + Dim objGraphics As Graphics = Me.CreateGraphics() + objGraphics.FillRectangle(objBrush, Me.DisplayRectangle) + objBrush.Dispose() + objGraphics.Dispose() + End Sub + + Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint + DrawFormGradient(Color.Blue, Color.AliceBlue) + End Sub +End Class diff --git a/Ch7 - Gradient/bin/Ch7 - Gradient.exe b/Ch7 - Gradient/bin/Ch7 - Gradient.exe new file mode 100644 index 0000000..66edb98 Binary files /dev/null and b/Ch7 - Gradient/bin/Ch7 - Gradient.exe differ diff --git a/Ch7 - Gradient/bin/Ch7 - Gradient.pdb b/Ch7 - Gradient/bin/Ch7 - Gradient.pdb new file mode 100644 index 0000000..caa0c9a Binary files /dev/null and b/Ch7 - Gradient/bin/Ch7 - Gradient.pdb differ diff --git a/Ch7 - Gradient/obj/Debug/Ch7 - Gradient.exe b/Ch7 - Gradient/obj/Debug/Ch7 - Gradient.exe new file mode 100644 index 0000000..66edb98 Binary files /dev/null and b/Ch7 - Gradient/obj/Debug/Ch7 - Gradient.exe differ diff --git a/Ch7 - Gradient/obj/Debug/Ch7 - Gradient.pdb b/Ch7 - Gradient/obj/Debug/Ch7 - Gradient.pdb new file mode 100644 index 0000000..caa0c9a Binary files /dev/null and b/Ch7 - Gradient/obj/Debug/Ch7 - Gradient.pdb differ diff --git a/Ch7 - Gradient/obj/Debug/Ch7___Gradient.Form1.resources b/Ch7 - Gradient/obj/Debug/Ch7___Gradient.Form1.resources new file mode 100644 index 0000000..ad3ef8f Binary files /dev/null and b/Ch7 - Gradient/obj/Debug/Ch7___Gradient.Form1.resources differ diff --git a/Ch7 - HTML to Text/AssemblyInfo.vb b/Ch7 - HTML to Text/AssemblyInfo.vb new file mode 100644 index 0000000..34243cb --- /dev/null +++ b/Ch7 - HTML to Text/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - HTML to Text/Ch7 - HTML to Text.sln b/Ch7 - HTML to Text/Ch7 - HTML to Text.sln new file mode 100644 index 0000000..059e761 --- /dev/null +++ b/Ch7 - HTML to Text/Ch7 - HTML to Text.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - HTML to Text", "Ch7 - HTML to Text.vbproj", "{91813AC4-5572-4A84-8877-3AD0AE1AD574}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {91813AC4-5572-4A84-8877-3AD0AE1AD574}.Debug.ActiveCfg = Debug|.NET + {91813AC4-5572-4A84-8877-3AD0AE1AD574}.Debug.Build.0 = Debug|.NET + {91813AC4-5572-4A84-8877-3AD0AE1AD574}.Release.ActiveCfg = Release|.NET + {91813AC4-5572-4A84-8877-3AD0AE1AD574}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - HTML to Text/Ch7 - HTML to Text.suo b/Ch7 - HTML to Text/Ch7 - HTML to Text.suo new file mode 100644 index 0000000..c1359e6 Binary files /dev/null and b/Ch7 - HTML to Text/Ch7 - HTML to Text.suo differ diff --git a/Ch7 - HTML to Text/Ch7 - HTML to Text.vbproj b/Ch7 - HTML to Text/Ch7 - HTML to Text.vbproj new file mode 100644 index 0000000..ec9f125 --- /dev/null +++ b/Ch7 - HTML to Text/Ch7 - HTML to Text.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - HTML to Text/Ch7 - HTML to Text.vbproj.user b/Ch7 - HTML to Text/Ch7 - HTML to Text.vbproj.user new file mode 100644 index 0000000..447fdc6 --- /dev/null +++ b/Ch7 - HTML to Text/Ch7 - HTML to Text.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - HTML to Text/Form1.resx b/Ch7 - HTML to Text/Form1.resx new file mode 100644 index 0000000..0d7bc21 --- /dev/null +++ b/Ch7 - HTML to Text/Form1.resx @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - HTML to Text/Form1.vb b/Ch7 - HTML to Text/Form1.vb new file mode 100644 index 0000000..73ea309 --- /dev/null +++ b/Ch7 - HTML to Text/Form1.vb @@ -0,0 +1,112 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents Button2 As System.Windows.Forms.Button + Friend WithEvents TextBox2 As System.Windows.Forms.TextBox + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.Button2 = New System.Windows.Forms.Button() + Me.TextBox2 = New System.Windows.Forms.TextBox() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(16, 16) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(440, 24) + Me.Button1.TabIndex = 3 + Me.Button1.Text = "Click here to retrieve sample HTML from bbc.co.uk" + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(16, 48) + Me.TextBox1.Multiline = True + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(440, 56) + Me.TextBox1.TabIndex = 2 + Me.TextBox1.Text = "" + ' + 'Button2 + ' + Me.Button2.Location = New System.Drawing.Point(16, 120) + Me.Button2.Name = "Button2" + Me.Button2.Size = New System.Drawing.Size(440, 24) + Me.Button2.TabIndex = 5 + Me.Button2.Text = "Click here to convert HTML to text" + ' + 'TextBox2 + ' + Me.TextBox2.Location = New System.Drawing.Point(16, 152) + Me.TextBox2.Multiline = True + Me.TextBox2.Name = "TextBox2" + Me.TextBox2.ScrollBars = System.Windows.Forms.ScrollBars.Vertical + Me.TextBox2.Size = New System.Drawing.Size(440, 136) + Me.TextBox2.TabIndex = 4 + Me.TextBox2.Text = "" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(472, 302) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button2, Me.TextBox2, Me.Button1, Me.TextBox1}) + Me.Name = "Form1" + Me.Text = "Converting HTML to Text, Easily" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click + TextBox2.Text = StripTags(TextBox1.Text) + End Sub + + Public Function StripTags(ByVal HTML As String) As String + ' Removes tags from passed HTML + Dim objRegEx As _ + System.Text.RegularExpressions.Regex + Return objRegEx.Replace(HTML, "<[^>]*>", "") + End Function + + Public Function GetPageHTML(ByVal URL As String) As String + ' Retrieves the HTML from the specified URL + Dim objWC As New System.Net.WebClient() + Return New System.Text.UTF8Encoding().GetString( _ + objWC.DownloadData(URL)) + End Function + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + TextBox1.Text = GetPageHTML("http://www.bbc.co.uk/") + End Sub +End Class diff --git a/Ch7 - HTML to Text/bin/Ch7 - HTML to Text.exe b/Ch7 - HTML to Text/bin/Ch7 - HTML to Text.exe new file mode 100644 index 0000000..76629ca Binary files /dev/null and b/Ch7 - HTML to Text/bin/Ch7 - HTML to Text.exe differ diff --git a/Ch7 - HTML to Text/bin/Ch7 - HTML to Text.pdb b/Ch7 - HTML to Text/bin/Ch7 - HTML to Text.pdb new file mode 100644 index 0000000..5c89b81 Binary files /dev/null and b/Ch7 - HTML to Text/bin/Ch7 - HTML to Text.pdb differ diff --git a/Ch7 - HTML to Text/obj/Debug/Ch7 - HTML to Text.exe b/Ch7 - HTML to Text/obj/Debug/Ch7 - HTML to Text.exe new file mode 100644 index 0000000..76629ca Binary files /dev/null and b/Ch7 - HTML to Text/obj/Debug/Ch7 - HTML to Text.exe differ diff --git a/Ch7 - HTML to Text/obj/Debug/Ch7 - HTML to Text.pdb b/Ch7 - HTML to Text/obj/Debug/Ch7 - HTML to Text.pdb new file mode 100644 index 0000000..5c89b81 Binary files /dev/null and b/Ch7 - HTML to Text/obj/Debug/Ch7 - HTML to Text.pdb differ diff --git a/Ch7 - HTML to Text/obj/Debug/Ch7___HTML_to_Text.Form1.resources b/Ch7 - HTML to Text/obj/Debug/Ch7___HTML_to_Text.Form1.resources new file mode 100644 index 0000000..ddd221e Binary files /dev/null and b/Ch7 - HTML to Text/obj/Debug/Ch7___HTML_to_Text.Form1.resources differ diff --git a/Ch7 - INI Files/AssemblyInfo.vb b/Ch7 - INI Files/AssemblyInfo.vb new file mode 100644 index 0000000..4fc4504 --- /dev/null +++ b/Ch7 - INI Files/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - INI Files/Ch7 - INI Files.sln b/Ch7 - INI Files/Ch7 - INI Files.sln new file mode 100644 index 0000000..ea351c0 --- /dev/null +++ b/Ch7 - INI Files/Ch7 - INI Files.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - INI Files", "Ch7 - INI Files.vbproj", "{B9880892-AE14-47A2-BE69-749EEEFBB2CB}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {B9880892-AE14-47A2-BE69-749EEEFBB2CB}.Debug.ActiveCfg = Debug|.NET + {B9880892-AE14-47A2-BE69-749EEEFBB2CB}.Debug.Build.0 = Debug|.NET + {B9880892-AE14-47A2-BE69-749EEEFBB2CB}.Release.ActiveCfg = Release|.NET + {B9880892-AE14-47A2-BE69-749EEEFBB2CB}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - INI Files/Ch7 - INI Files.suo b/Ch7 - INI Files/Ch7 - INI Files.suo new file mode 100644 index 0000000..fb631e4 Binary files /dev/null and b/Ch7 - INI Files/Ch7 - INI Files.suo differ diff --git a/Ch7 - INI Files/Ch7 - INI Files.vbproj b/Ch7 - INI Files/Ch7 - INI Files.vbproj new file mode 100644 index 0000000..4f835c3 --- /dev/null +++ b/Ch7 - INI Files/Ch7 - INI Files.vbproj @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - INI Files/Ch7 - INI Files.vbproj.user b/Ch7 - INI Files/Ch7 - INI Files.vbproj.user new file mode 100644 index 0000000..eabb41d --- /dev/null +++ b/Ch7 - INI Files/Ch7 - INI Files.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - INI Files/Form1.resx b/Ch7 - INI Files/Form1.resx new file mode 100644 index 0000000..e25f8ab --- /dev/null +++ b/Ch7 - INI Files/Form1.resx @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - INI Files/Form1.vb b/Ch7 - INI Files/Form1.vb new file mode 100644 index 0000000..c7917aa --- /dev/null +++ b/Ch7 - INI Files/Form1.vb @@ -0,0 +1,64 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(96, 32) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(232, 40) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Run sample INI file code" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(432, 118) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1}) + Me.Name = "Form1" + Me.Text = "INI Files Will Never Die: How To in .NET" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + Dim objIniFile As New IniFile("c:\data.ini") + objIniFile.WriteString("Settings", "ClockTime", "12:59") + Dim strData As String = _ + objIniFile.GetString("Settings", "ClockTime", "(none)") + End Sub +End Class diff --git a/Ch7 - INI Files/INIClass.vb b/Ch7 - INI Files/INIClass.vb new file mode 100644 index 0000000..76ac21d --- /dev/null +++ b/Ch7 - INI Files/INIClass.vb @@ -0,0 +1,91 @@ +Public Class IniFile + ' API functions + Private Declare Ansi Function GetPrivateProfileString _ + Lib "kernel32.dll" Alias "GetPrivateProfileStringA" _ + (ByVal lpApplicationName As String, _ + ByVal lpKeyName As String, ByVal lpDefault As String, _ + ByVal lpReturnedString As System.Text.StringBuilder, _ + ByVal nSize As Integer, ByVal lpFileName As String) _ + As Integer + Private Declare Ansi Function WritePrivateProfileString _ + Lib "kernel32.dll" Alias "WritePrivateProfileStringA" _ + (ByVal lpApplicationName As String, _ + ByVal lpKeyName As String, ByVal lpString As String, _ + ByVal lpFileName As String) As Integer + Private Declare Ansi Function GetPrivateProfileInt _ + Lib "kernel32.dll" Alias "GetPrivateProfileIntA" _ + (ByVal lpApplicationName As String, _ + ByVal lpKeyName As String, ByVal nDefault As Integer, _ + ByVal lpFileName As String) As Integer + Private Declare Ansi Function FlushPrivateProfileString _ + Lib "kernel32.dll" Alias "WritePrivateProfileStringA" _ + (ByVal lpApplicationName As Integer, _ + ByVal lpKeyName As Integer, ByVal lpString As Integer, _ + ByVal lpFileName As String) As Integer + + Dim strFilename As String + + ' Constructor, accepting a filename + Public Sub New(ByVal Filename As String) + strFilename = Filename + End Sub + + ' Read-only filename property + ReadOnly Property FileName() As String + Get + Return strFilename + End Get + End Property + + Public Function GetString(ByVal Section As String, _ + ByVal Key As String, ByVal [Default] As String) As String + ' Returns a string from your INI file + Dim intCharCount As Integer + Dim objResult As New System.Text.StringBuilder(256) + intCharCount = GetPrivateProfileString(Section, Key, _ + [Default], objResult, objResult.Capacity, strFilename) + If intCharCount > 0 Then GetString = _ + Left(objResult.ToString, intCharCount) + End Function + + Public Function GetInteger(ByVal Section As String, _ + ByVal Key As String, ByVal [Default] As Integer) As Integer + ' Returns an integer from your INI file + Return GetPrivateProfileInt(Section, Key, _ + [Default], strFilename) + End Function + + Public Function GetBoolean(ByVal Section As String, _ + ByVal Key As String, ByVal [Default] As Boolean) As Boolean + ' Returns a boolean from your INI file + Return (GetPrivateProfileInt(Section, Key, _ + CInt([Default]), strFilename) = 1) + End Function + + Public Sub WriteString(ByVal Section As String, _ + ByVal Key As String, ByVal Value As String) + ' Writes a string to your INI file + WritePrivateProfileString(Section, Key, Value, strFilename) + Flush() + End Sub + + Public Sub WriteInteger(ByVal Section As String, _ + ByVal Key As String, ByVal Value As Integer) + ' Writes an integer to your INI file + WriteString(Section, Key, CStr(Value)) + Flush() + End Sub + + Public Sub WriteBoolean(ByVal Section As String, _ + ByVal Key As String, ByVal Value As Boolean) + ' Writes a boolean to your INI file + WriteString(Section, Key, CStr(CInt(Value))) + Flush() + End Sub + + Private Sub Flush() + ' Stores all the cached changes to your INI file + FlushPrivateProfileString(0, 0, 0, strFilename) + End Sub + +End Class diff --git a/Ch7 - INI Files/bin/Ch7 - INI Files.exe b/Ch7 - INI Files/bin/Ch7 - INI Files.exe new file mode 100644 index 0000000..c0e63df Binary files /dev/null and b/Ch7 - INI Files/bin/Ch7 - INI Files.exe differ diff --git a/Ch7 - INI Files/bin/Ch7 - INI Files.pdb b/Ch7 - INI Files/bin/Ch7 - INI Files.pdb new file mode 100644 index 0000000..6c79699 Binary files /dev/null and b/Ch7 - INI Files/bin/Ch7 - INI Files.pdb differ diff --git a/Ch7 - INI Files/obj/Debug/Ch7 - INI Files.exe b/Ch7 - INI Files/obj/Debug/Ch7 - INI Files.exe new file mode 100644 index 0000000..c0e63df Binary files /dev/null and b/Ch7 - INI Files/obj/Debug/Ch7 - INI Files.exe differ diff --git a/Ch7 - INI Files/obj/Debug/Ch7 - INI Files.pdb b/Ch7 - INI Files/obj/Debug/Ch7 - INI Files.pdb new file mode 100644 index 0000000..6c79699 Binary files /dev/null and b/Ch7 - INI Files/obj/Debug/Ch7 - INI Files.pdb differ diff --git a/Ch7 - INI Files/obj/Debug/Ch7___INI_Files.Form1.resources b/Ch7 - INI Files/obj/Debug/Ch7___INI_Files.Form1.resources new file mode 100644 index 0000000..ad3ef8f Binary files /dev/null and b/Ch7 - INI Files/obj/Debug/Ch7___INI_Files.Form1.resources differ diff --git a/Ch7 - IP/AssemblyInfo.vb b/Ch7 - IP/AssemblyInfo.vb new file mode 100644 index 0000000..25e2fd6 --- /dev/null +++ b/Ch7 - IP/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - IP/Ch7 - IP.sln b/Ch7 - IP/Ch7 - IP.sln new file mode 100644 index 0000000..0efefc5 --- /dev/null +++ b/Ch7 - IP/Ch7 - IP.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - IP", "Ch7 - IP.vbproj", "{81C9B67C-631F-45ED-BF9E-59FAB508DA51}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {81C9B67C-631F-45ED-BF9E-59FAB508DA51}.Debug.ActiveCfg = Debug|.NET + {81C9B67C-631F-45ED-BF9E-59FAB508DA51}.Debug.Build.0 = Debug|.NET + {81C9B67C-631F-45ED-BF9E-59FAB508DA51}.Release.ActiveCfg = Release|.NET + {81C9B67C-631F-45ED-BF9E-59FAB508DA51}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - IP/Ch7 - IP.suo b/Ch7 - IP/Ch7 - IP.suo new file mode 100644 index 0000000..2bfb4ce Binary files /dev/null and b/Ch7 - IP/Ch7 - IP.suo differ diff --git a/Ch7 - IP/Ch7 - IP.vbproj b/Ch7 - IP/Ch7 - IP.vbproj new file mode 100644 index 0000000..10655b8 --- /dev/null +++ b/Ch7 - IP/Ch7 - IP.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - IP/Ch7 - IP.vbproj.user b/Ch7 - IP/Ch7 - IP.vbproj.user new file mode 100644 index 0000000..a6e254a --- /dev/null +++ b/Ch7 - IP/Ch7 - IP.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - IP/Form1.resx b/Ch7 - IP/Form1.resx new file mode 100644 index 0000000..e25f8ab --- /dev/null +++ b/Ch7 - IP/Form1.resx @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - IP/Form1.vb b/Ch7 - IP/Form1.vb new file mode 100644 index 0000000..fa44bb7 --- /dev/null +++ b/Ch7 - IP/Form1.vb @@ -0,0 +1,67 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(56, 48) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(368, 48) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Retrieve my IP address!" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(496, 158) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1}) + Me.Name = "Form1" + Me.Text = "How To Retrieve Your IP Address – And Why You May Want To" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + Dim objEntry As System.Net.IPHostEntry = _ + System.Net.Dns.GetHostByName( _ + System.Net.Dns.GetHostName) + Dim strIP As String = CType( _ + objEntry.AddressList.GetValue(0), _ + System.Net.IPAddress).ToString + MessageBox.Show("Your IP address is " & strIP) + End Sub +End Class diff --git a/Ch7 - IP/bin/Ch7 - IP.exe b/Ch7 - IP/bin/Ch7 - IP.exe new file mode 100644 index 0000000..803398b Binary files /dev/null and b/Ch7 - IP/bin/Ch7 - IP.exe differ diff --git a/Ch7 - IP/bin/Ch7 - IP.pdb b/Ch7 - IP/bin/Ch7 - IP.pdb new file mode 100644 index 0000000..677a6ad Binary files /dev/null and b/Ch7 - IP/bin/Ch7 - IP.pdb differ diff --git a/Ch7 - IP/obj/Debug/Ch7 - IP.exe b/Ch7 - IP/obj/Debug/Ch7 - IP.exe new file mode 100644 index 0000000..803398b Binary files /dev/null and b/Ch7 - IP/obj/Debug/Ch7 - IP.exe differ diff --git a/Ch7 - IP/obj/Debug/Ch7 - IP.pdb b/Ch7 - IP/obj/Debug/Ch7 - IP.pdb new file mode 100644 index 0000000..677a6ad Binary files /dev/null and b/Ch7 - IP/obj/Debug/Ch7 - IP.pdb differ diff --git a/Ch7 - IP/obj/Debug/Ch7___IP.Form1.resources b/Ch7 - IP/obj/Debug/Ch7___IP.Form1.resources new file mode 100644 index 0000000..ad3ef8f Binary files /dev/null and b/Ch7 - IP/obj/Debug/Ch7___IP.Form1.resources differ diff --git a/Ch7 - IsConnectionAvailable/AssemblyInfo.vb b/Ch7 - IsConnectionAvailable/AssemblyInfo.vb new file mode 100644 index 0000000..f144781 --- /dev/null +++ b/Ch7 - IsConnectionAvailable/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - IsConnectionAvailable/Ch7 - IsConnectionAvailable.sln b/Ch7 - IsConnectionAvailable/Ch7 - IsConnectionAvailable.sln new file mode 100644 index 0000000..131df3c --- /dev/null +++ b/Ch7 - IsConnectionAvailable/Ch7 - IsConnectionAvailable.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - IsConnectionAvailable", "Ch7 - IsConnectionAvailable.vbproj", "{CD19EC1A-CC3B-4C7A-B3E5-162CD71A3CDA}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {CD19EC1A-CC3B-4C7A-B3E5-162CD71A3CDA}.Debug.ActiveCfg = Debug|.NET + {CD19EC1A-CC3B-4C7A-B3E5-162CD71A3CDA}.Debug.Build.0 = Debug|.NET + {CD19EC1A-CC3B-4C7A-B3E5-162CD71A3CDA}.Release.ActiveCfg = Release|.NET + {CD19EC1A-CC3B-4C7A-B3E5-162CD71A3CDA}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - IsConnectionAvailable/Ch7 - IsConnectionAvailable.suo b/Ch7 - IsConnectionAvailable/Ch7 - IsConnectionAvailable.suo new file mode 100644 index 0000000..b42a8fd Binary files /dev/null and b/Ch7 - IsConnectionAvailable/Ch7 - IsConnectionAvailable.suo differ diff --git a/Ch7 - IsConnectionAvailable/Ch7 - IsConnectionAvailable.vbproj b/Ch7 - IsConnectionAvailable/Ch7 - IsConnectionAvailable.vbproj new file mode 100644 index 0000000..c1fccd4 --- /dev/null +++ b/Ch7 - IsConnectionAvailable/Ch7 - IsConnectionAvailable.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - IsConnectionAvailable/Ch7 - IsConnectionAvailable.vbproj.user b/Ch7 - IsConnectionAvailable/Ch7 - IsConnectionAvailable.vbproj.user new file mode 100644 index 0000000..eabb41d --- /dev/null +++ b/Ch7 - IsConnectionAvailable/Ch7 - IsConnectionAvailable.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - IsConnectionAvailable/Form1.resx b/Ch7 - IsConnectionAvailable/Form1.resx new file mode 100644 index 0000000..e25f8ab --- /dev/null +++ b/Ch7 - IsConnectionAvailable/Form1.resx @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - IsConnectionAvailable/Form1.vb b/Ch7 - IsConnectionAvailable/Form1.vb new file mode 100644 index 0000000..af878c0 --- /dev/null +++ b/Ch7 - IsConnectionAvailable/Form1.vb @@ -0,0 +1,91 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(56, 48) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(336, 80) + Me.Button1.TabIndex = 1 + Me.Button1.Text = "Click me to find out!" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(448, 190) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1}) + Me.Name = "Form1" + Me.Text = "Is an Internet connection available?" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub ClickMe(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + If IsConnectionAvailable() = True Then + MessageBox.Show("You are online!") + Else + MessageBox.Show("You are offline!") + End If + End Sub + + Public Function IsConnectionAvailable() As Boolean + ' Returns True if connection is available + + ' Replace www.yoursite.com with a site that + ' is guaranteed to be online - perhaps your + ' corporate site, or microsoft.com + Dim objUrl As New System.Uri("http://www.yoursite.com/") + ' Setup WebRequest + Dim objWebReq As System.Net.WebRequest + objWebReq = System.Net.WebRequest.Create(objUrl) + Dim objResp As System.Net.WebResponse + Try + ' Attempt to get response and return True + objResp = objWebReq.GetResponse + objResp.Close() + objWebReq = Nothing + Return True + Catch ex As Exception + ' Error, exit and return False + If Not objResp Is Nothing Then objResp.Close() + objWebReq = Nothing + Return False + End Try + End Function + +End Class diff --git a/Ch7 - IsConnectionAvailable/bin/Ch7 - IsConnectionAvailable.exe b/Ch7 - IsConnectionAvailable/bin/Ch7 - IsConnectionAvailable.exe new file mode 100644 index 0000000..5d704d0 Binary files /dev/null and b/Ch7 - IsConnectionAvailable/bin/Ch7 - IsConnectionAvailable.exe differ diff --git a/Ch7 - IsConnectionAvailable/bin/Ch7 - IsConnectionAvailable.pdb b/Ch7 - IsConnectionAvailable/bin/Ch7 - IsConnectionAvailable.pdb new file mode 100644 index 0000000..b874641 Binary files /dev/null and b/Ch7 - IsConnectionAvailable/bin/Ch7 - IsConnectionAvailable.pdb differ diff --git a/Ch7 - IsConnectionAvailable/obj/Debug/Ch7 - IsConnectionAvailable.exe b/Ch7 - IsConnectionAvailable/obj/Debug/Ch7 - IsConnectionAvailable.exe new file mode 100644 index 0000000..5d704d0 Binary files /dev/null and b/Ch7 - IsConnectionAvailable/obj/Debug/Ch7 - IsConnectionAvailable.exe differ diff --git a/Ch7 - IsConnectionAvailable/obj/Debug/Ch7 - IsConnectionAvailable.pdb b/Ch7 - IsConnectionAvailable/obj/Debug/Ch7 - IsConnectionAvailable.pdb new file mode 100644 index 0000000..b874641 Binary files /dev/null and b/Ch7 - IsConnectionAvailable/obj/Debug/Ch7 - IsConnectionAvailable.pdb differ diff --git a/Ch7 - IsConnectionAvailable/obj/Debug/Ch7___IsConnectionAvailable.Form1.resources b/Ch7 - IsConnectionAvailable/obj/Debug/Ch7___IsConnectionAvailable.Form1.resources new file mode 100644 index 0000000..ad3ef8f Binary files /dev/null and b/Ch7 - IsConnectionAvailable/obj/Debug/Ch7___IsConnectionAvailable.Form1.resources differ diff --git a/Ch7 - IsDate/AssemblyInfo.vb b/Ch7 - IsDate/AssemblyInfo.vb new file mode 100644 index 0000000..b76a829 --- /dev/null +++ b/Ch7 - IsDate/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - IsDate/Ch7 - IsDate.sln b/Ch7 - IsDate/Ch7 - IsDate.sln new file mode 100644 index 0000000..789d570 --- /dev/null +++ b/Ch7 - IsDate/Ch7 - IsDate.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - IsDate", "Ch7 - IsDate.vbproj", "{4B5BE652-A4C6-4EE1-85F3-CAC5AFEE7440}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {4B5BE652-A4C6-4EE1-85F3-CAC5AFEE7440}.Debug.ActiveCfg = Debug|.NET + {4B5BE652-A4C6-4EE1-85F3-CAC5AFEE7440}.Debug.Build.0 = Debug|.NET + {4B5BE652-A4C6-4EE1-85F3-CAC5AFEE7440}.Release.ActiveCfg = Release|.NET + {4B5BE652-A4C6-4EE1-85F3-CAC5AFEE7440}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - IsDate/Ch7 - IsDate.suo b/Ch7 - IsDate/Ch7 - IsDate.suo new file mode 100644 index 0000000..f885bca Binary files /dev/null and b/Ch7 - IsDate/Ch7 - IsDate.suo differ diff --git a/Ch7 - IsDate/Ch7 - IsDate.vbproj b/Ch7 - IsDate/Ch7 - IsDate.vbproj new file mode 100644 index 0000000..10ad6ce --- /dev/null +++ b/Ch7 - IsDate/Ch7 - IsDate.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - IsDate/Ch7 - IsDate.vbproj.user b/Ch7 - IsDate/Ch7 - IsDate.vbproj.user new file mode 100644 index 0000000..eabb41d --- /dev/null +++ b/Ch7 - IsDate/Ch7 - IsDate.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - IsDate/Form1.resx b/Ch7 - IsDate/Form1.resx new file mode 100644 index 0000000..bbf07fb --- /dev/null +++ b/Ch7 - IsDate/Form1.resx @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - IsDate/Form1.vb b/Ch7 - IsDate/Form1.vb new file mode 100644 index 0000000..80bc2fa --- /dev/null +++ b/Ch7 - IsDate/Form1.vb @@ -0,0 +1,89 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(48, 80) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(264, 64) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Check whether this is a date" + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(48, 40) + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(264, 20) + Me.TextBox1.TabIndex = 1 + Me.TextBox1.Text = "01/01/2004" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(352, 190) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox1, Me.Button1}) + Me.Name = "Form1" + Me.Text = "Checking for a date, the .NET way!" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + If IsDate(TextBox1.Text) Then + MessageBox.Show("This is a date!") + Else + MessageBox.Show("This is NOT a date!") + End If + End Sub + + Public Function IsDate(ByVal DateIn As String) As Boolean + Dim datDateTime As DateTime + Dim blnIsDate As Boolean = True + Try + ' Attempt to parse date + datDateTime = DateTime.Parse(DateIn) + Catch e As FormatException + ' Error parsing, return False + blnIsDate = False + End Try + Return blnIsDate + End Function + +End Class diff --git a/Ch7 - IsDate/bin/Ch7 - IsDate.exe b/Ch7 - IsDate/bin/Ch7 - IsDate.exe new file mode 100644 index 0000000..9f7c5d0 Binary files /dev/null and b/Ch7 - IsDate/bin/Ch7 - IsDate.exe differ diff --git a/Ch7 - IsDate/bin/Ch7 - IsDate.pdb b/Ch7 - IsDate/bin/Ch7 - IsDate.pdb new file mode 100644 index 0000000..1b8c916 Binary files /dev/null and b/Ch7 - IsDate/bin/Ch7 - IsDate.pdb differ diff --git a/Ch7 - IsDate/obj/Debug/Ch7 - IsDate.exe b/Ch7 - IsDate/obj/Debug/Ch7 - IsDate.exe new file mode 100644 index 0000000..9f7c5d0 Binary files /dev/null and b/Ch7 - IsDate/obj/Debug/Ch7 - IsDate.exe differ diff --git a/Ch7 - IsDate/obj/Debug/Ch7 - IsDate.pdb b/Ch7 - IsDate/obj/Debug/Ch7 - IsDate.pdb new file mode 100644 index 0000000..1b8c916 Binary files /dev/null and b/Ch7 - IsDate/obj/Debug/Ch7 - IsDate.pdb differ diff --git a/Ch7 - IsDate/obj/Debug/Ch7___IsDate.Form1.resources b/Ch7 - IsDate/obj/Debug/Ch7___IsDate.Form1.resources new file mode 100644 index 0000000..22657e2 Binary files /dev/null and b/Ch7 - IsDate/obj/Debug/Ch7___IsDate.Form1.resources differ diff --git a/Ch7 - MD5/AssemblyInfo.vb b/Ch7 - MD5/AssemblyInfo.vb new file mode 100644 index 0000000..234ecf1 --- /dev/null +++ b/Ch7 - MD5/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - MD5/Ch7 - MD5.sln b/Ch7 - MD5/Ch7 - MD5.sln new file mode 100644 index 0000000..04b72ba --- /dev/null +++ b/Ch7 - MD5/Ch7 - MD5.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - MD5", "Ch7 - MD5.vbproj", "{CB32E490-508E-4A36-A041-935AF09933FF}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {CB32E490-508E-4A36-A041-935AF09933FF}.Debug.ActiveCfg = Debug|.NET + {CB32E490-508E-4A36-A041-935AF09933FF}.Debug.Build.0 = Debug|.NET + {CB32E490-508E-4A36-A041-935AF09933FF}.Release.ActiveCfg = Release|.NET + {CB32E490-508E-4A36-A041-935AF09933FF}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - MD5/Ch7 - MD5.suo b/Ch7 - MD5/Ch7 - MD5.suo new file mode 100644 index 0000000..62de074 Binary files /dev/null and b/Ch7 - MD5/Ch7 - MD5.suo differ diff --git a/Ch7 - MD5/Ch7 - MD5.vbproj b/Ch7 - MD5/Ch7 - MD5.vbproj new file mode 100644 index 0000000..676e2b3 --- /dev/null +++ b/Ch7 - MD5/Ch7 - MD5.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - MD5/Ch7 - MD5.vbproj.user b/Ch7 - MD5/Ch7 - MD5.vbproj.user new file mode 100644 index 0000000..c168d10 --- /dev/null +++ b/Ch7 - MD5/Ch7 - MD5.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - MD5/Form1.resx b/Ch7 - MD5/Form1.resx new file mode 100644 index 0000000..e25f8ab --- /dev/null +++ b/Ch7 - MD5/Form1.resx @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - MD5/Form1.vb b/Ch7 - MD5/Form1.vb new file mode 100644 index 0000000..ab75056 --- /dev/null +++ b/Ch7 - MD5/Form1.vb @@ -0,0 +1,101 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(72, 40) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(272, 40) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Run sample MD5 code" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(416, 134) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1}) + Me.Name = "Form1" + Me.Text = "Implementing Powerful MD5 Encryption" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + End Sub + + Public Function GetMD5Hash(ByVal Text As String) As Byte() + ' Generates an MD5 hash for the specified Text + On Error Resume Next + Dim objAscii As New System.Text.ASCIIEncoding() + Dim bytHash As Byte() = _ + New System.Security.Cryptography.MD5CryptoServiceProvider(). _ + ComputeHash(objAscii.GetBytes(Text)) + Return bytHash + End Function + + Public Function CheckMD5Hash(ByVal OriginalHash As Byte(), _ + ByVal Text As String) As Boolean + ' Checks an MD5 hash against the specified Text + ' Returns True if we have a match + On Error Resume Next + Dim objAscii As New System.Text.ASCIIEncoding() + Dim intCount As Integer, blnMismatch As Boolean + Dim bytHashToCompare As Byte() = GetMD5Hash(Text) + If OriginalHash.Length <> bytHashToCompare.Length Then + Return False + Else + For intCount = 0 To OriginalHash.Length + If OriginalHash(intCount) <> bytHashToCompare(intCount) Then + Return False + End If + Next + Return True + End If + End Function + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + Dim bytHash() As Byte = GetMD5Hash("password") + Dim blnMatch As Boolean = CheckMD5Hash(bytHash, "password") + If blnMatch Then + MessageBox.Show("We have a match - now look at the code to see what's happening!") + Else + MessageBox.Show("We don't have a match") + End If + End Sub +End Class diff --git a/Ch7 - MD5/bin/Ch7 - MD5.exe b/Ch7 - MD5/bin/Ch7 - MD5.exe new file mode 100644 index 0000000..ba3e962 Binary files /dev/null and b/Ch7 - MD5/bin/Ch7 - MD5.exe differ diff --git a/Ch7 - MD5/bin/Ch7 - MD5.pdb b/Ch7 - MD5/bin/Ch7 - MD5.pdb new file mode 100644 index 0000000..98e619e Binary files /dev/null and b/Ch7 - MD5/bin/Ch7 - MD5.pdb differ diff --git a/Ch7 - MD5/obj/Debug/Ch7 - MD5.exe b/Ch7 - MD5/obj/Debug/Ch7 - MD5.exe new file mode 100644 index 0000000..ba3e962 Binary files /dev/null and b/Ch7 - MD5/obj/Debug/Ch7 - MD5.exe differ diff --git a/Ch7 - MD5/obj/Debug/Ch7 - MD5.pdb b/Ch7 - MD5/obj/Debug/Ch7 - MD5.pdb new file mode 100644 index 0000000..98e619e Binary files /dev/null and b/Ch7 - MD5/obj/Debug/Ch7 - MD5.pdb differ diff --git a/Ch7 - MD5/obj/Debug/Ch7___MD5.Form1.resources b/Ch7 - MD5/obj/Debug/Ch7___MD5.Form1.resources new file mode 100644 index 0000000..ad3ef8f Binary files /dev/null and b/Ch7 - MD5/obj/Debug/Ch7___MD5.Form1.resources differ diff --git a/Ch7 - MSMQ Sample/GotDotNet MSMQ Sample Project.zip b/Ch7 - MSMQ Sample/GotDotNet MSMQ Sample Project.zip new file mode 100644 index 0000000..0cd340b Binary files /dev/null and b/Ch7 - MSMQ Sample/GotDotNet MSMQ Sample Project.zip differ diff --git a/Ch7 - Memorable Passwords/AssemblyInfo.vb b/Ch7 - Memorable Passwords/AssemblyInfo.vb new file mode 100644 index 0000000..bb504af --- /dev/null +++ b/Ch7 - Memorable Passwords/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Memorable Passwords/Ch7 - Memorable Passwords.sln b/Ch7 - Memorable Passwords/Ch7 - Memorable Passwords.sln new file mode 100644 index 0000000..f220d2f --- /dev/null +++ b/Ch7 - Memorable Passwords/Ch7 - Memorable Passwords.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Memorable Passwords", "Ch7 - Memorable Passwords.vbproj", "{D80287FF-1775-4348-A0A7-E5CE12535437}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {D80287FF-1775-4348-A0A7-E5CE12535437}.Debug.ActiveCfg = Debug|.NET + {D80287FF-1775-4348-A0A7-E5CE12535437}.Debug.Build.0 = Debug|.NET + {D80287FF-1775-4348-A0A7-E5CE12535437}.Release.ActiveCfg = Release|.NET + {D80287FF-1775-4348-A0A7-E5CE12535437}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Memorable Passwords/Ch7 - Memorable Passwords.suo b/Ch7 - Memorable Passwords/Ch7 - Memorable Passwords.suo new file mode 100644 index 0000000..7f9c69d Binary files /dev/null and b/Ch7 - Memorable Passwords/Ch7 - Memorable Passwords.suo differ diff --git a/Ch7 - Memorable Passwords/Ch7 - Memorable Passwords.vbproj b/Ch7 - Memorable Passwords/Ch7 - Memorable Passwords.vbproj new file mode 100644 index 0000000..6839100 --- /dev/null +++ b/Ch7 - Memorable Passwords/Ch7 - Memorable Passwords.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Memorable Passwords/Ch7 - Memorable Passwords.vbproj.user b/Ch7 - Memorable Passwords/Ch7 - Memorable Passwords.vbproj.user new file mode 100644 index 0000000..c168d10 --- /dev/null +++ b/Ch7 - Memorable Passwords/Ch7 - Memorable Passwords.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Memorable Passwords/Form1.resx b/Ch7 - Memorable Passwords/Form1.resx new file mode 100644 index 0000000..a24bea7 --- /dev/null +++ b/Ch7 - Memorable Passwords/Form1.resx @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Memorable Passwords/Form1.vb b/Ch7 - Memorable Passwords/Form1.vb new file mode 100644 index 0000000..b2d8e8a --- /dev/null +++ b/Ch7 - Memorable Passwords/Form1.vb @@ -0,0 +1,110 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents Label1 As System.Windows.Forms.Label + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.Label1 = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(24, 16) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(400, 48) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Click here to generate a five-character memorable password" + ' + 'Label1 + ' + Me.Label1.Font = New System.Drawing.Font("Arial", 15.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label1.Location = New System.Drawing.Point(48, 88) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(352, 32) + Me.Label1.TabIndex = 1 + Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(448, 150) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label1, Me.Button1}) + Me.Name = "Form1" + Me.Text = "How To Generate Memorable Passwords, Automatically" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Public Function GeneratePassword(ByVal Length As Integer) As String + ' Creates a memorable password of the specified Length + Dim blnOnVowel As Boolean + Dim strTempLetter As String + Dim strPassword As String + Dim intCount As Integer + For intCount = 1 To Length + If blnOnVowel = False Then + ' Choose a nice consonant - no C, X, Z, or Q + strTempLetter = CType(Choose(CType(GetRandomNumber(1, 17), Double), _ + "B", "D", "F", "G", "H", "J", "K", "L", "M", _ + "N", "P", "R", "S", "T", "V", "W", "Y"), String) + ' Append it to the password string + strPassword += strTempLetter + ' Swich to vowel mode + blnOnVowel = True + Else + ' Choose a vowel + strTempLetter = CType(Choose(CType(GetRandomNumber(1, 5), Double), _ + "A", "E", "I", "O", "U"), String) + ' Append it to the password string + strPassword += strTempLetter + ' Switch back again, ready for next loop round + blnOnVowel = False + End If + Next + Return strPassword + End Function + + Dim objRandom As New System.Random(CType((System.DateTime.Now.Ticks _ + Mod System.Int32.MaxValue), Integer)) + Public Function GetRandomNumber(Optional ByVal Low As Integer = 1, _ + Optional ByVal High As Integer = 100) As Integer + ' Returns a random number, + ' between the optional Low and High parameters + Return objRandom.Next(Low, High + 1) + End Function + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + Label1.Text = GeneratePassword(5) + End Sub +End Class diff --git a/Ch7 - Memorable Passwords/bin/Ch7 - Memorable Passwords.exe b/Ch7 - Memorable Passwords/bin/Ch7 - Memorable Passwords.exe new file mode 100644 index 0000000..9921d46 Binary files /dev/null and b/Ch7 - Memorable Passwords/bin/Ch7 - Memorable Passwords.exe differ diff --git a/Ch7 - Memorable Passwords/bin/Ch7 - Memorable Passwords.pdb b/Ch7 - Memorable Passwords/bin/Ch7 - Memorable Passwords.pdb new file mode 100644 index 0000000..aef7ddf Binary files /dev/null and b/Ch7 - Memorable Passwords/bin/Ch7 - Memorable Passwords.pdb differ diff --git a/Ch7 - Memorable Passwords/obj/Debug/Ch7 - Memorable Passwords.exe b/Ch7 - Memorable Passwords/obj/Debug/Ch7 - Memorable Passwords.exe new file mode 100644 index 0000000..9921d46 Binary files /dev/null and b/Ch7 - Memorable Passwords/obj/Debug/Ch7 - Memorable Passwords.exe differ diff --git a/Ch7 - Memorable Passwords/obj/Debug/Ch7 - Memorable Passwords.pdb b/Ch7 - Memorable Passwords/obj/Debug/Ch7 - Memorable Passwords.pdb new file mode 100644 index 0000000..aef7ddf Binary files /dev/null and b/Ch7 - Memorable Passwords/obj/Debug/Ch7 - Memorable Passwords.pdb differ diff --git a/Ch7 - Memorable Passwords/obj/Debug/Ch7___Memorable_Passwords.Form1.resources b/Ch7 - Memorable Passwords/obj/Debug/Ch7___Memorable_Passwords.Form1.resources new file mode 100644 index 0000000..7737c38 Binary files /dev/null and b/Ch7 - Memorable Passwords/obj/Debug/Ch7___Memorable_Passwords.Form1.resources differ diff --git a/Ch7 - Next Working Day/AssemblyInfo.vb b/Ch7 - Next Working Day/AssemblyInfo.vb new file mode 100644 index 0000000..d73f979 --- /dev/null +++ b/Ch7 - Next Working Day/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Next Working Day/Ch7 - Last Working Day.sln b/Ch7 - Next Working Day/Ch7 - Last Working Day.sln new file mode 100644 index 0000000..ceb360a --- /dev/null +++ b/Ch7 - Next Working Day/Ch7 - Last Working Day.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Last Working Day", "Ch7 - Last Working Day.vbproj", "{4BFE55F2-32EE-4AE2-84A0-36E4D23D8C5A}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {4BFE55F2-32EE-4AE2-84A0-36E4D23D8C5A}.Debug.ActiveCfg = Debug|.NET + {4BFE55F2-32EE-4AE2-84A0-36E4D23D8C5A}.Debug.Build.0 = Debug|.NET + {4BFE55F2-32EE-4AE2-84A0-36E4D23D8C5A}.Release.ActiveCfg = Release|.NET + {4BFE55F2-32EE-4AE2-84A0-36E4D23D8C5A}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Next Working Day/Ch7 - Last Working Day.suo b/Ch7 - Next Working Day/Ch7 - Last Working Day.suo new file mode 100644 index 0000000..7a378e9 Binary files /dev/null and b/Ch7 - Next Working Day/Ch7 - Last Working Day.suo differ diff --git a/Ch7 - Next Working Day/Ch7 - Last Working Day.vbproj b/Ch7 - Next Working Day/Ch7 - Last Working Day.vbproj new file mode 100644 index 0000000..292c194 --- /dev/null +++ b/Ch7 - Next Working Day/Ch7 - Last Working Day.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Next Working Day/Ch7 - Last Working Day.vbproj.user b/Ch7 - Next Working Day/Ch7 - Last Working Day.vbproj.user new file mode 100644 index 0000000..eabb41d --- /dev/null +++ b/Ch7 - Next Working Day/Ch7 - Last Working Day.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Next Working Day/Form1.resx b/Ch7 - Next Working Day/Form1.resx new file mode 100644 index 0000000..efd5155 --- /dev/null +++ b/Ch7 - Next Working Day/Form1.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Next Working Day/Form1.vb b/Ch7 - Next Working Day/Form1.vb new file mode 100644 index 0000000..e5c7678 --- /dev/null +++ b/Ch7 - Next Working Day/Form1.vb @@ -0,0 +1,111 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents MonthCalendar1 As System.Windows.Forms.MonthCalendar + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents Label2 As System.Windows.Forms.Label + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.MonthCalendar1 = New System.Windows.Forms.MonthCalendar() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.Label1 = New System.Windows.Forms.Label() + Me.Label2 = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(40, 144) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(200, 40) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Enter a value then click here" + ' + 'MonthCalendar1 + ' + Me.MonthCalendar1.Location = New System.Drawing.Point(280, 32) + Me.MonthCalendar1.Name = "MonthCalendar1" + Me.MonthCalendar1.TabIndex = 1 + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(168, 48) + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(72, 20) + Me.TextBox1.TabIndex = 2 + Me.TextBox1.Text = "5" + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(40, 48) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(96, 32) + Me.Label1.TabIndex = 3 + Me.Label1.Text = "Enter number of days to shift by:" + ' + 'Label2 + ' + Me.Label2.Location = New System.Drawing.Point(168, 80) + Me.Label2.Name = "Label2" + Me.Label2.TabIndex = 4 + Me.Label2.Text = "ie, 5 or -1" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(512, 222) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label2, Me.Label1, Me.TextBox1, Me.MonthCalendar1, Me.Button1}) + Me.Name = "Form1" + Me.Text = "Working with working days" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + Dim datNewDate As Date = AddWorkingDays(Today, TextBox1.Text) + MonthCalendar1.SetDate(datNewDate) + End Sub + + Public Function AddWorkingDays(ByVal DateIn As Date, ByVal ShiftDate As Integer) As Date + ' Adds the [ShiftDate] number of working days to DateIn + Dim datDate As Date = DateIn.AddDays(ShiftDate) + ' Loop around until we get the need non-weekend day + While Weekday(datDate) = 1 Or Weekday(datDate) = 7 + datDate = datDate.AddDays(IIf(ShiftDate < 0, -1, 1)) + End While + Return datDate + End Function + + +End Class diff --git a/Ch7 - Next Working Day/bin/Ch7 - Last Working Day.exe b/Ch7 - Next Working Day/bin/Ch7 - Last Working Day.exe new file mode 100644 index 0000000..c224a23 Binary files /dev/null and b/Ch7 - Next Working Day/bin/Ch7 - Last Working Day.exe differ diff --git a/Ch7 - Next Working Day/bin/Ch7 - Last Working Day.pdb b/Ch7 - Next Working Day/bin/Ch7 - Last Working Day.pdb new file mode 100644 index 0000000..374a8c9 Binary files /dev/null and b/Ch7 - Next Working Day/bin/Ch7 - Last Working Day.pdb differ diff --git a/Ch7 - Next Working Day/obj/Debug/Ch7 - Last Working Day.exe b/Ch7 - Next Working Day/obj/Debug/Ch7 - Last Working Day.exe new file mode 100644 index 0000000..c224a23 Binary files /dev/null and b/Ch7 - Next Working Day/obj/Debug/Ch7 - Last Working Day.exe differ diff --git a/Ch7 - Next Working Day/obj/Debug/Ch7 - Last Working Day.pdb b/Ch7 - Next Working Day/obj/Debug/Ch7 - Last Working Day.pdb new file mode 100644 index 0000000..374a8c9 Binary files /dev/null and b/Ch7 - Next Working Day/obj/Debug/Ch7 - Last Working Day.pdb differ diff --git a/Ch7 - Next Working Day/obj/Debug/Ch7___Last_Working_Day.Form1.resources b/Ch7 - Next Working Day/obj/Debug/Ch7___Last_Working_Day.Form1.resources new file mode 100644 index 0000000..6477d00 Binary files /dev/null and b/Ch7 - Next Working Day/obj/Debug/Ch7___Last_Working_Day.Form1.resources differ diff --git a/Ch7 - Ordinal Numbers/AssemblyInfo.vb b/Ch7 - Ordinal Numbers/AssemblyInfo.vb new file mode 100644 index 0000000..de1fa41 --- /dev/null +++ b/Ch7 - Ordinal Numbers/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Ordinal Numbers/Ch7 - Ordinal Numbers.sln b/Ch7 - Ordinal Numbers/Ch7 - Ordinal Numbers.sln new file mode 100644 index 0000000..a56949d --- /dev/null +++ b/Ch7 - Ordinal Numbers/Ch7 - Ordinal Numbers.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Ordinal Numbers", "Ch7 - Ordinal Numbers.vbproj", "{9F982A50-A2C5-450E-96E4-CB62A74F4F1A}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {9F982A50-A2C5-450E-96E4-CB62A74F4F1A}.Debug.ActiveCfg = Debug|.NET + {9F982A50-A2C5-450E-96E4-CB62A74F4F1A}.Debug.Build.0 = Debug|.NET + {9F982A50-A2C5-450E-96E4-CB62A74F4F1A}.Release.ActiveCfg = Release|.NET + {9F982A50-A2C5-450E-96E4-CB62A74F4F1A}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Ordinal Numbers/Ch7 - Ordinal Numbers.suo b/Ch7 - Ordinal Numbers/Ch7 - Ordinal Numbers.suo new file mode 100644 index 0000000..7357eb7 Binary files /dev/null and b/Ch7 - Ordinal Numbers/Ch7 - Ordinal Numbers.suo differ diff --git a/Ch7 - Ordinal Numbers/Ch7 - Ordinal Numbers.vbproj b/Ch7 - Ordinal Numbers/Ch7 - Ordinal Numbers.vbproj new file mode 100644 index 0000000..29141aa --- /dev/null +++ b/Ch7 - Ordinal Numbers/Ch7 - Ordinal Numbers.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Ordinal Numbers/Ch7 - Ordinal Numbers.vbproj.user b/Ch7 - Ordinal Numbers/Ch7 - Ordinal Numbers.vbproj.user new file mode 100644 index 0000000..eabb41d --- /dev/null +++ b/Ch7 - Ordinal Numbers/Ch7 - Ordinal Numbers.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Ordinal Numbers/Form1.resx b/Ch7 - Ordinal Numbers/Form1.resx new file mode 100644 index 0000000..1a56c3c --- /dev/null +++ b/Ch7 - Ordinal Numbers/Form1.resx @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Ordinal Numbers/Form1.vb b/Ch7 - Ordinal Numbers/Form1.vb new file mode 100644 index 0000000..f0d3838 --- /dev/null +++ b/Ch7 - Ordinal Numbers/Form1.vb @@ -0,0 +1,136 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents Label2 As System.Windows.Forms.Label + Private Sub InitializeComponent() + Me.Label1 = New System.Windows.Forms.Label() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.Label2 = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'Label1 + ' + Me.Label1.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label1.Location = New System.Drawing.Point(24, 24) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(160, 23) + Me.Label1.TabIndex = 0 + Me.Label1.Text = "Enter a number..." + ' + 'TextBox1 + ' + Me.TextBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.TextBox1.Location = New System.Drawing.Point(160, 16) + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(88, 26) + Me.TextBox1.TabIndex = 1 + Me.TextBox1.Text = "" + ' + 'Label2 + ' + Me.Label2.Font = New System.Drawing.Font("Arial", 20.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label2.Location = New System.Drawing.Point(224, 64) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(176, 40) + Me.Label2.TabIndex = 2 + Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(424, 118) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label2, Me.TextBox1, Me.Label1}) + Me.Name = "Form1" + Me.Text = "1st, 2nd, 3rd: Using Ordinal Numbers in your App" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + End Sub + + Public Function GetOrdinal(ByVal Number As Integer) As String + ' Accepts an integer, returns the ordinal suffix + + ' Handles special case three digit numbers ending + ' with 11, 12 or 13 - ie, 111th, 112th, 113th, 211th, et al + If CType(Number, String).Length > 2 Then + Dim intEndNum As Integer = CType(CType(Number, String). _ + Substring(CType(Number, String).Length - 2, 2), Integer) + If intEndNum >= 11 And intEndNum <= 13 Then + Select Case intEndNum + Case 11, 12, 13 + Return "th" + End Select + End If + End If + + If Number >= 21 Then + ' Handles 21st, 22nd, 23rd, et al + Select Case CType(Number.ToString.Substring( _ + Number.ToString.Length - 1, 1), Integer) + Case 1 + Return "st" + Case 2 + Return "nd" + Case 3 + Return "rd" + Case 0, 4 To 9 + Return "th" + End Select + Else + ' Handles 1st to 20th + Select Case Number + Case 1 + Return "st" + Case 2 + Return "nd" + Case 3 + Return "rd" + Case 4 To 20 + Return "th" + End Select + End If + End Function + + Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged + If Not IsNumeric(TextBox1.Text) Then + Label2.Text = "?" + Else + Label2.Text = TextBox1.Text & GetOrdinal(TextBox1.Text) + End If + End Sub +End Class diff --git a/Ch7 - Ordinal Numbers/bin/Ch7 - Ordinal Numbers.exe b/Ch7 - Ordinal Numbers/bin/Ch7 - Ordinal Numbers.exe new file mode 100644 index 0000000..d000ac8 Binary files /dev/null and b/Ch7 - Ordinal Numbers/bin/Ch7 - Ordinal Numbers.exe differ diff --git a/Ch7 - Ordinal Numbers/bin/Ch7 - Ordinal Numbers.pdb b/Ch7 - Ordinal Numbers/bin/Ch7 - Ordinal Numbers.pdb new file mode 100644 index 0000000..96fc531 Binary files /dev/null and b/Ch7 - Ordinal Numbers/bin/Ch7 - Ordinal Numbers.pdb differ diff --git a/Ch7 - Ordinal Numbers/obj/Debug/Ch7 - Ordinal Numbers.exe b/Ch7 - Ordinal Numbers/obj/Debug/Ch7 - Ordinal Numbers.exe new file mode 100644 index 0000000..d000ac8 Binary files /dev/null and b/Ch7 - Ordinal Numbers/obj/Debug/Ch7 - Ordinal Numbers.exe differ diff --git a/Ch7 - Ordinal Numbers/obj/Debug/Ch7 - Ordinal Numbers.pdb b/Ch7 - Ordinal Numbers/obj/Debug/Ch7 - Ordinal Numbers.pdb new file mode 100644 index 0000000..96fc531 Binary files /dev/null and b/Ch7 - Ordinal Numbers/obj/Debug/Ch7 - Ordinal Numbers.pdb differ diff --git a/Ch7 - Ordinal Numbers/obj/Debug/Ch7___Ordinal_Numbers.Form1.resources b/Ch7 - Ordinal Numbers/obj/Debug/Ch7___Ordinal_Numbers.Form1.resources new file mode 100644 index 0000000..6c2f766 Binary files /dev/null and b/Ch7 - Ordinal Numbers/obj/Debug/Ch7___Ordinal_Numbers.Form1.resources differ diff --git a/Ch7 - Parse Links and Images/AssemblyInfo.vb b/Ch7 - Parse Links and Images/AssemblyInfo.vb new file mode 100644 index 0000000..49c0862 --- /dev/null +++ b/Ch7 - Parse Links and Images/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Parse Links and Images/Ch7 - Parse Links and Images.sln b/Ch7 - Parse Links and Images/Ch7 - Parse Links and Images.sln new file mode 100644 index 0000000..6a0dc60 --- /dev/null +++ b/Ch7 - Parse Links and Images/Ch7 - Parse Links and Images.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Parse Links and Images", "Ch7 - Parse Links and Images.vbproj", "{21EF4DB2-FA2E-4CA3-8519-8353FEDDD1CF}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {21EF4DB2-FA2E-4CA3-8519-8353FEDDD1CF}.Debug.ActiveCfg = Debug|.NET + {21EF4DB2-FA2E-4CA3-8519-8353FEDDD1CF}.Debug.Build.0 = Debug|.NET + {21EF4DB2-FA2E-4CA3-8519-8353FEDDD1CF}.Release.ActiveCfg = Release|.NET + {21EF4DB2-FA2E-4CA3-8519-8353FEDDD1CF}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Parse Links and Images/Ch7 - Parse Links and Images.suo b/Ch7 - Parse Links and Images/Ch7 - Parse Links and Images.suo new file mode 100644 index 0000000..c252095 Binary files /dev/null and b/Ch7 - Parse Links and Images/Ch7 - Parse Links and Images.suo differ diff --git a/Ch7 - Parse Links and Images/Ch7 - Parse Links and Images.vbproj b/Ch7 - Parse Links and Images/Ch7 - Parse Links and Images.vbproj new file mode 100644 index 0000000..b11790c --- /dev/null +++ b/Ch7 - Parse Links and Images/Ch7 - Parse Links and Images.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Parse Links and Images/Ch7 - Parse Links and Images.vbproj.user b/Ch7 - Parse Links and Images/Ch7 - Parse Links and Images.vbproj.user new file mode 100644 index 0000000..a6e254a --- /dev/null +++ b/Ch7 - Parse Links and Images/Ch7 - Parse Links and Images.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Parse Links and Images/Form1.resx b/Ch7 - Parse Links and Images/Form1.resx new file mode 100644 index 0000000..25f70d9 --- /dev/null +++ b/Ch7 - Parse Links and Images/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Parse Links and Images/Form1.vb b/Ch7 - Parse Links and Images/Form1.vb new file mode 100644 index 0000000..d09d3c9 --- /dev/null +++ b/Ch7 - Parse Links and Images/Form1.vb @@ -0,0 +1,188 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents Button2 As System.Windows.Forms.Button + Friend WithEvents ListBox1 As System.Windows.Forms.ListBox + Friend WithEvents ListBox2 As System.Windows.Forms.ListBox + Friend WithEvents Button3 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.Button1 = New System.Windows.Forms.Button() + Me.Button2 = New System.Windows.Forms.Button() + Me.ListBox1 = New System.Windows.Forms.ListBox() + Me.ListBox2 = New System.Windows.Forms.ListBox() + Me.Button3 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(24, 48) + Me.TextBox1.Multiline = True + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(440, 56) + Me.TextBox1.TabIndex = 0 + Me.TextBox1.Text = "" + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(24, 16) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(440, 24) + Me.Button1.TabIndex = 1 + Me.Button1.Text = "Click here to retrieve sample HTML from newslinx.com" + ' + 'Button2 + ' + Me.Button2.Location = New System.Drawing.Point(24, 120) + Me.Button2.Name = "Button2" + Me.Button2.Size = New System.Drawing.Size(200, 24) + Me.Button2.TabIndex = 2 + Me.Button2.Text = "Grab links from HTML" + ' + 'ListBox1 + ' + Me.ListBox1.Location = New System.Drawing.Point(24, 152) + Me.ListBox1.Name = "ListBox1" + Me.ListBox1.Size = New System.Drawing.Size(200, 108) + Me.ListBox1.TabIndex = 3 + ' + 'ListBox2 + ' + Me.ListBox2.Location = New System.Drawing.Point(264, 152) + Me.ListBox2.Name = "ListBox2" + Me.ListBox2.Size = New System.Drawing.Size(200, 108) + Me.ListBox2.TabIndex = 5 + ' + 'Button3 + ' + Me.Button3.Location = New System.Drawing.Point(264, 120) + Me.Button3.Name = "Button3" + Me.Button3.Size = New System.Drawing.Size(200, 24) + Me.Button3.TabIndex = 4 + Me.Button3.Text = "Grab images from HTML" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(480, 278) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.ListBox2, Me.Button3, Me.ListBox1, Me.Button2, Me.Button1, Me.TextBox1}) + Me.Name = "Form1" + Me.Text = "Tricks of Parsing a Web Page for Links and Images" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + End Sub + + Public Function GetPageHTML(ByVal URL As String) As String + ' Retrieves the HTML from the specified URL + Dim objWC As New System.Net.WebClient() + Return New System.Text.UTF8Encoding().GetString( _ + objWC.DownloadData(URL)) + End Function + + Public Function ParseLinks(ByVal HTML As String) As ArrayList + ' Remember to add the following at top of class: + ' - Imports System.Text.RegularExpressions + Dim objRegEx As System.Text.RegularExpressions.Regex + Dim objMatch As System.Text.RegularExpressions.Match + Dim arrLinks As New System.Collections.ArrayList() + ' Create regular expression + objRegEx = New System.Text.RegularExpressions.Regex( _ + "a.*href\s*=\s*(?:""(?<1>[^""]*)""|(?<1>\S+))", _ + System.Text.RegularExpressions.RegexOptions.IgnoreCase Or _ + System.Text.RegularExpressions.RegexOptions.Compiled) + ' Match expression to HTML + objMatch = objRegEx.Match(HTML) + ' Loop through matches and add <1> to ArrayList + While objMatch.Success + Dim strMatch As String + strMatch = objMatch.Groups(1).ToString + arrLinks.Add(strMatch) + objMatch = objMatch.NextMatch() + End While + ' Pass back results + Return arrLinks + End Function + + Public Function ParseImages(ByVal HTML As String) As ArrayList + ' Remember to add the following at top of class: + ' - Imports System.Text.RegularExpressions + Dim objRegEx As System.Text.RegularExpressions.Regex + Dim objMatch As System.Text.RegularExpressions.Match + Dim arrLinks As New System.Collections.ArrayList() + ' Create regular expression + objRegEx = New System.Text.RegularExpressions.Regex( _ + "img.*src\s*=\s*(?:""(?<1>[^""]*)""|(?<1>\S+))", _ + System.Text.RegularExpressions.RegexOptions.IgnoreCase Or _ + System.Text.RegularExpressions.RegexOptions.Compiled) + ' Match expression to HTML + objMatch = objRegEx.Match(HTML) + ' Loop through matches and add <1> to ArrayList + While objMatch.Success + Dim strMatch As String + strMatch = objMatch.Groups(1).ToString + arrLinks.Add(strMatch) + objMatch = objMatch.NextMatch() + End While + ' Pass back results + Return arrLinks + End Function + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + TextBox1.Text = GetPageHTML("http://www.newslinx.com/") + End Sub + + Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click + Dim arrLinks As ArrayList = ParseLinks(TextBox1.Text) + ' Loop through results + Dim shtCount As Integer + For shtCount = 0 To arrLinks.Count - 1 + ListBox1.Items.Add(arrLinks(shtCount).ToString) + Next + End Sub + + Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click + Dim arrLinks As ArrayList = ParseImages(TextBox1.Text) + ' Loop through results + Dim shtCount As Integer + For shtCount = 0 To arrLinks.Count - 1 + ListBox2.Items.Add(arrLinks(shtCount).ToString) + Next + End Sub + +End Class diff --git a/Ch7 - Parse Links and Images/bin/Ch7 - Parse Links and Images.exe b/Ch7 - Parse Links and Images/bin/Ch7 - Parse Links and Images.exe new file mode 100644 index 0000000..9d2aa4c Binary files /dev/null and b/Ch7 - Parse Links and Images/bin/Ch7 - Parse Links and Images.exe differ diff --git a/Ch7 - Parse Links and Images/bin/Ch7 - Parse Links and Images.pdb b/Ch7 - Parse Links and Images/bin/Ch7 - Parse Links and Images.pdb new file mode 100644 index 0000000..0879319 Binary files /dev/null and b/Ch7 - Parse Links and Images/bin/Ch7 - Parse Links and Images.pdb differ diff --git a/Ch7 - Parse Links and Images/obj/Debug/Ch7 - Parse Links and Images.exe b/Ch7 - Parse Links and Images/obj/Debug/Ch7 - Parse Links and Images.exe new file mode 100644 index 0000000..9d2aa4c Binary files /dev/null and b/Ch7 - Parse Links and Images/obj/Debug/Ch7 - Parse Links and Images.exe differ diff --git a/Ch7 - Parse Links and Images/obj/Debug/Ch7 - Parse Links and Images.pdb b/Ch7 - Parse Links and Images/obj/Debug/Ch7 - Parse Links and Images.pdb new file mode 100644 index 0000000..0879319 Binary files /dev/null and b/Ch7 - Parse Links and Images/obj/Debug/Ch7 - Parse Links and Images.pdb differ diff --git a/Ch7 - Parse Links and Images/obj/Debug/Ch7___Parse_Links_and_Images.Form1.resources b/Ch7 - Parse Links and Images/obj/Debug/Ch7___Parse_Links_and_Images.Form1.resources new file mode 100644 index 0000000..16d3394 Binary files /dev/null and b/Ch7 - Parse Links and Images/obj/Debug/Ch7___Parse_Links_and_Images.Form1.resources differ diff --git a/Ch7 - Proper Case/AssemblyInfo.vb b/Ch7 - Proper Case/AssemblyInfo.vb new file mode 100644 index 0000000..d011fb8 --- /dev/null +++ b/Ch7 - Proper Case/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Proper Case/Ch7 - Proper Case.sln b/Ch7 - Proper Case/Ch7 - Proper Case.sln new file mode 100644 index 0000000..9c71a9a --- /dev/null +++ b/Ch7 - Proper Case/Ch7 - Proper Case.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Proper Case", "Ch7 - Proper Case.vbproj", "{2D29A5E5-AD55-48E7-9529-DB778D9227EA}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {2D29A5E5-AD55-48E7-9529-DB778D9227EA}.Debug.ActiveCfg = Debug|.NET + {2D29A5E5-AD55-48E7-9529-DB778D9227EA}.Debug.Build.0 = Debug|.NET + {2D29A5E5-AD55-48E7-9529-DB778D9227EA}.Release.ActiveCfg = Release|.NET + {2D29A5E5-AD55-48E7-9529-DB778D9227EA}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Proper Case/Ch7 - Proper Case.suo b/Ch7 - Proper Case/Ch7 - Proper Case.suo new file mode 100644 index 0000000..ab63d86 Binary files /dev/null and b/Ch7 - Proper Case/Ch7 - Proper Case.suo differ diff --git a/Ch7 - Proper Case/Ch7 - Proper Case.vbproj b/Ch7 - Proper Case/Ch7 - Proper Case.vbproj new file mode 100644 index 0000000..a5accd8 --- /dev/null +++ b/Ch7 - Proper Case/Ch7 - Proper Case.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Proper Case/Ch7 - Proper Case.vbproj.user b/Ch7 - Proper Case/Ch7 - Proper Case.vbproj.user new file mode 100644 index 0000000..eabb41d --- /dev/null +++ b/Ch7 - Proper Case/Ch7 - Proper Case.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Proper Case/Form1.resx b/Ch7 - Proper Case/Form1.resx new file mode 100644 index 0000000..c436f6e --- /dev/null +++ b/Ch7 - Proper Case/Form1.resx @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Proper Case/Form1.vb b/Ch7 - Proper Case/Form1.vb new file mode 100644 index 0000000..621fb43 --- /dev/null +++ b/Ch7 - Proper Case/Form1.vb @@ -0,0 +1,87 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents TextBox2 As System.Windows.Forms.TextBox + Friend WithEvents Label1 As System.Windows.Forms.Label + Private Sub InitializeComponent() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.TextBox2 = New System.Windows.Forms.TextBox() + Me.Label1 = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(32, 32) + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(336, 20) + Me.TextBox1.TabIndex = 0 + Me.TextBox1.Text = "" + ' + 'TextBox2 + ' + Me.TextBox2.Location = New System.Drawing.Point(32, 64) + Me.TextBox2.Name = "TextBox2" + Me.TextBox2.Size = New System.Drawing.Size(336, 20) + Me.TextBox2.TabIndex = 1 + Me.TextBox2.Text = "" + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(32, 16) + Me.Label1.Name = "Label1" + Me.Label1.TabIndex = 2 + Me.Label1.Text = "Type in any case:" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(400, 102) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox1, Me.Label1, Me.TextBox2}) + Me.Name = "Form1" + Me.Text = "Converting a String to ""Proper Case""" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Public Function ProperCase(ByVal Text As String) As String + ' Converts the passed chunk of text to "Proper Case" + Dim objCulture As New System.Globalization. _ + CultureInfo("en-US") + Return objCulture.TextInfo.ToTitleCase(Text.ToLower) + End Function + + Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged + TextBox2.Text = ProperCase(TextBox1.Text) + End Sub +End Class diff --git a/Ch7 - Proper Case/bin/Ch7 - Proper Case.exe b/Ch7 - Proper Case/bin/Ch7 - Proper Case.exe new file mode 100644 index 0000000..dc15335 Binary files /dev/null and b/Ch7 - Proper Case/bin/Ch7 - Proper Case.exe differ diff --git a/Ch7 - Proper Case/bin/Ch7 - Proper Case.pdb b/Ch7 - Proper Case/bin/Ch7 - Proper Case.pdb new file mode 100644 index 0000000..7c77386 Binary files /dev/null and b/Ch7 - Proper Case/bin/Ch7 - Proper Case.pdb differ diff --git a/Ch7 - Proper Case/obj/Debug/Ch7 - Proper Case.exe b/Ch7 - Proper Case/obj/Debug/Ch7 - Proper Case.exe new file mode 100644 index 0000000..dc15335 Binary files /dev/null and b/Ch7 - Proper Case/obj/Debug/Ch7 - Proper Case.exe differ diff --git a/Ch7 - Proper Case/obj/Debug/Ch7 - Proper Case.pdb b/Ch7 - Proper Case/obj/Debug/Ch7 - Proper Case.pdb new file mode 100644 index 0000000..7c77386 Binary files /dev/null and b/Ch7 - Proper Case/obj/Debug/Ch7 - Proper Case.pdb differ diff --git a/Ch7 - Proper Case/obj/Debug/Ch7___Proper_Case.Form1.resources b/Ch7 - Proper Case/obj/Debug/Ch7___Proper_Case.Form1.resources new file mode 100644 index 0000000..9cde11c Binary files /dev/null and b/Ch7 - Proper Case/obj/Debug/Ch7___Proper_Case.Form1.resources differ diff --git a/Ch7 - Quarters/AssemblyInfo.vb b/Ch7 - Quarters/AssemblyInfo.vb new file mode 100644 index 0000000..a813436 --- /dev/null +++ b/Ch7 - Quarters/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Quarters/Ch7 - Quarters.sln b/Ch7 - Quarters/Ch7 - Quarters.sln new file mode 100644 index 0000000..ca4a89d --- /dev/null +++ b/Ch7 - Quarters/Ch7 - Quarters.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Quarters", "Ch7 - Quarters.vbproj", "{88622E47-2D9C-4833-B3D4-49E36DCFB801}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {88622E47-2D9C-4833-B3D4-49E36DCFB801}.Debug.ActiveCfg = Debug|.NET + {88622E47-2D9C-4833-B3D4-49E36DCFB801}.Debug.Build.0 = Debug|.NET + {88622E47-2D9C-4833-B3D4-49E36DCFB801}.Release.ActiveCfg = Release|.NET + {88622E47-2D9C-4833-B3D4-49E36DCFB801}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Quarters/Ch7 - Quarters.suo b/Ch7 - Quarters/Ch7 - Quarters.suo new file mode 100644 index 0000000..184f2f9 Binary files /dev/null and b/Ch7 - Quarters/Ch7 - Quarters.suo differ diff --git a/Ch7 - Quarters/Ch7 - Quarters.vbproj b/Ch7 - Quarters/Ch7 - Quarters.vbproj new file mode 100644 index 0000000..040c2dc --- /dev/null +++ b/Ch7 - Quarters/Ch7 - Quarters.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Quarters/Ch7 - Quarters.vbproj.user b/Ch7 - Quarters/Ch7 - Quarters.vbproj.user new file mode 100644 index 0000000..447fdc6 --- /dev/null +++ b/Ch7 - Quarters/Ch7 - Quarters.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Quarters/Form1.resx b/Ch7 - Quarters/Form1.resx new file mode 100644 index 0000000..3a8fffa --- /dev/null +++ b/Ch7 - Quarters/Form1.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Quarters/Form1.vb b/Ch7 - Quarters/Form1.vb new file mode 100644 index 0000000..2439a49 --- /dev/null +++ b/Ch7 - Quarters/Form1.vb @@ -0,0 +1,118 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents cal1 As System.Windows.Forms.MonthCalendar + Friend WithEvents cal2 As System.Windows.Forms.MonthCalendar + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents Label2 As System.Windows.Forms.Label + Private Sub InitializeComponent() + Me.cal1 = New System.Windows.Forms.MonthCalendar() + Me.cal2 = New System.Windows.Forms.MonthCalendar() + Me.Button1 = New System.Windows.Forms.Button() + Me.Label1 = New System.Windows.Forms.Label() + Me.Label2 = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'cal1 + ' + Me.cal1.Location = New System.Drawing.Point(40, 96) + Me.cal1.Name = "cal1" + Me.cal1.TabIndex = 0 + ' + 'cal2 + ' + Me.cal2.Location = New System.Drawing.Point(304, 96) + Me.cal2.Name = "cal2" + Me.cal2.TabIndex = 1 + ' + 'Button1 + ' + Me.Button1.Font = New System.Drawing.Font("Verdana", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Button1.Location = New System.Drawing.Point(40, 24) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(464, 32) + Me.Button1.TabIndex = 2 + Me.Button1.Text = "Click here to view current quarter start/end dates" + ' + 'Label1 + ' + Me.Label1.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label1.Location = New System.Drawing.Point(40, 72) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(128, 24) + Me.Label1.TabIndex = 3 + Me.Label1.Text = "Current quarter start:" + ' + 'Label2 + ' + Me.Label2.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label2.Location = New System.Drawing.Point(304, 72) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(128, 24) + Me.Label2.TabIndex = 4 + Me.Label2.Text = "Current quarter end:" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(536, 286) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label2, Me.Label1, Me.Button1, Me.cal2, Me.cal1}) + Me.Name = "Form1" + Me.Text = "Figuring out Quarters" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + Dim CurrentQuarterStart As Date = FirstDayOfQuarter(Now) + Dim CurrentQuarterEnd As Date = LastDayOfQuarter(Now) + cal1.SetDate(CurrentQuarterStart) + cal2.SetDate(CurrentQuarterEnd) + End Sub + + Public Function FirstDayOfQuarter(ByVal DateIn As Date) As Date + ' Calculate first day of DateIn quarter, + ' with quarters starting at the beginning of Jan/Apr/Jul/Oct + Dim intQuarterNum As Integer = (Month(DateIn) - 1) \ 3 + 1 + Return DateSerial(Year(DateIn), 3 * intQuarterNum - 2, 1) + End Function + + Public Function LastDayOfQuarter(ByVal DateIn As Date) As Date + ' Calculate last day of DateIn quarter, + ' with quarters ending at the end of Mar/Jun/Sep/Dec + Dim intQuarterNum As Integer = (Month(DateIn) - 1) \ 3 + 1 + Return DateSerial(Year(DateIn), 3 * intQuarterNum + 1, 0) + End Function + +End Class diff --git a/Ch7 - Quarters/bin/Ch7 - Quarters.exe b/Ch7 - Quarters/bin/Ch7 - Quarters.exe new file mode 100644 index 0000000..0ca3eac Binary files /dev/null and b/Ch7 - Quarters/bin/Ch7 - Quarters.exe differ diff --git a/Ch7 - Quarters/bin/Ch7 - Quarters.pdb b/Ch7 - Quarters/bin/Ch7 - Quarters.pdb new file mode 100644 index 0000000..989ac36 Binary files /dev/null and b/Ch7 - Quarters/bin/Ch7 - Quarters.pdb differ diff --git a/Ch7 - Quarters/obj/Debug/Ch7 - Quarters.exe b/Ch7 - Quarters/obj/Debug/Ch7 - Quarters.exe new file mode 100644 index 0000000..0ca3eac Binary files /dev/null and b/Ch7 - Quarters/obj/Debug/Ch7 - Quarters.exe differ diff --git a/Ch7 - Quarters/obj/Debug/Ch7 - Quarters.pdb b/Ch7 - Quarters/obj/Debug/Ch7 - Quarters.pdb new file mode 100644 index 0000000..989ac36 Binary files /dev/null and b/Ch7 - Quarters/obj/Debug/Ch7 - Quarters.pdb differ diff --git a/Ch7 - Quarters/obj/Debug/Ch7___Quarters.Form1.resources b/Ch7 - Quarters/obj/Debug/Ch7___Quarters.Form1.resources new file mode 100644 index 0000000..9038a7c Binary files /dev/null and b/Ch7 - Quarters/obj/Debug/Ch7___Quarters.Form1.resources differ diff --git a/Ch7 - Random Numbers/AssemblyInfo.vb b/Ch7 - Random Numbers/AssemblyInfo.vb new file mode 100644 index 0000000..ad8a353 --- /dev/null +++ b/Ch7 - Random Numbers/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Random Numbers/Ch7 - Random Numbers.sln b/Ch7 - Random Numbers/Ch7 - Random Numbers.sln new file mode 100644 index 0000000..fca2bf8 --- /dev/null +++ b/Ch7 - Random Numbers/Ch7 - Random Numbers.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Random Numbers", "Ch7 - Random Numbers.vbproj", "{30851F58-654E-4BEE-A66C-386FC567DF9F}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {30851F58-654E-4BEE-A66C-386FC567DF9F}.Debug.ActiveCfg = Debug|.NET + {30851F58-654E-4BEE-A66C-386FC567DF9F}.Debug.Build.0 = Debug|.NET + {30851F58-654E-4BEE-A66C-386FC567DF9F}.Release.ActiveCfg = Release|.NET + {30851F58-654E-4BEE-A66C-386FC567DF9F}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Random Numbers/Ch7 - Random Numbers.suo b/Ch7 - Random Numbers/Ch7 - Random Numbers.suo new file mode 100644 index 0000000..2665eb8 Binary files /dev/null and b/Ch7 - Random Numbers/Ch7 - Random Numbers.suo differ diff --git a/Ch7 - Random Numbers/Ch7 - Random Numbers.vbproj b/Ch7 - Random Numbers/Ch7 - Random Numbers.vbproj new file mode 100644 index 0000000..8e896d6 --- /dev/null +++ b/Ch7 - Random Numbers/Ch7 - Random Numbers.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Random Numbers/Ch7 - Random Numbers.vbproj.user b/Ch7 - Random Numbers/Ch7 - Random Numbers.vbproj.user new file mode 100644 index 0000000..eabb41d --- /dev/null +++ b/Ch7 - Random Numbers/Ch7 - Random Numbers.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Random Numbers/Form1.resx b/Ch7 - Random Numbers/Form1.resx new file mode 100644 index 0000000..21874b2 --- /dev/null +++ b/Ch7 - Random Numbers/Form1.resx @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Random Numbers/Form1.vb b/Ch7 - Random Numbers/Form1.vb new file mode 100644 index 0000000..54d9665 --- /dev/null +++ b/Ch7 - Random Numbers/Form1.vb @@ -0,0 +1,101 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Label2 As System.Windows.Forms.Label + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Label2 = New System.Windows.Forms.Label() + Me.Label1 = New System.Windows.Forms.Label() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Label2 + ' + Me.Label2.Font = New System.Drawing.Font("Arial", 20.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label2.Location = New System.Drawing.Point(216, 64) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(176, 40) + Me.Label2.TabIndex = 5 + Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight + ' + 'Label1 + ' + Me.Label1.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label1.Location = New System.Drawing.Point(16, 24) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(160, 23) + Me.Label1.TabIndex = 3 + Me.Label1.Text = "Click to roll the die..." + ' + 'Button1 + ' + Me.Button1.Font = New System.Drawing.Font("Verdana", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Button1.Location = New System.Drawing.Point(176, 16) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(80, 24) + Me.Button1.TabIndex = 6 + Me.Button1.Text = "Roll!" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(408, 118) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1, Me.Label2, Me.Label1}) + Me.Name = "Form1" + Me.Text = "Random Numbers… That Work!" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + End Sub + + Dim objRandom As New System.Random( _ + CType(System.DateTime.Now.Ticks Mod System.Int32.MaxValue, Integer)) + + Public Function GetRandomNumber( _ + Optional ByVal Low As Integer = 1, _ + Optional ByVal High As Integer = 100) As Integer + ' Returns a random number, + ' between the optional Low and High parameters + Return objRandom.Next(Low, High + 1) + End Function + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + Dim intDiceRoll As Integer + intDiceRoll = GetRandomNumber(1, 6) + Label2.Text = "Rolled " & intDiceRoll.ToString + End Sub +End Class diff --git a/Ch7 - Random Numbers/bin/Ch7 - Random Numbers.exe b/Ch7 - Random Numbers/bin/Ch7 - Random Numbers.exe new file mode 100644 index 0000000..fa3369e Binary files /dev/null and b/Ch7 - Random Numbers/bin/Ch7 - Random Numbers.exe differ diff --git a/Ch7 - Random Numbers/bin/Ch7 - Random Numbers.pdb b/Ch7 - Random Numbers/bin/Ch7 - Random Numbers.pdb new file mode 100644 index 0000000..6630988 Binary files /dev/null and b/Ch7 - Random Numbers/bin/Ch7 - Random Numbers.pdb differ diff --git a/Ch7 - Random Numbers/obj/Debug/Ch7 - Random Numbers.exe b/Ch7 - Random Numbers/obj/Debug/Ch7 - Random Numbers.exe new file mode 100644 index 0000000..fa3369e Binary files /dev/null and b/Ch7 - Random Numbers/obj/Debug/Ch7 - Random Numbers.exe differ diff --git a/Ch7 - Random Numbers/obj/Debug/Ch7 - Random Numbers.pdb b/Ch7 - Random Numbers/obj/Debug/Ch7 - Random Numbers.pdb new file mode 100644 index 0000000..6630988 Binary files /dev/null and b/Ch7 - Random Numbers/obj/Debug/Ch7 - Random Numbers.pdb differ diff --git a/Ch7 - Random Numbers/obj/Debug/Ch7___Random_Numbers.Form1.resources b/Ch7 - Random Numbers/obj/Debug/Ch7___Random_Numbers.Form1.resources new file mode 100644 index 0000000..a169505 Binary files /dev/null and b/Ch7 - Random Numbers/obj/Debug/Ch7___Random_Numbers.Form1.resources differ diff --git a/Ch7 - Read and Write Files/AssemblyInfo.vb b/Ch7 - Read and Write Files/AssemblyInfo.vb new file mode 100644 index 0000000..8f18b52 --- /dev/null +++ b/Ch7 - Read and Write Files/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Read and Write Files/Ch7 - Read and Write Files.sln b/Ch7 - Read and Write Files/Ch7 - Read and Write Files.sln new file mode 100644 index 0000000..b948eb5 --- /dev/null +++ b/Ch7 - Read and Write Files/Ch7 - Read and Write Files.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Read and Write Files", "Ch7 - Read and Write Files.vbproj", "{CDC97714-4B57-4697-853E-75C501773197}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {CDC97714-4B57-4697-853E-75C501773197}.Debug.ActiveCfg = Debug|.NET + {CDC97714-4B57-4697-853E-75C501773197}.Debug.Build.0 = Debug|.NET + {CDC97714-4B57-4697-853E-75C501773197}.Release.ActiveCfg = Release|.NET + {CDC97714-4B57-4697-853E-75C501773197}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Read and Write Files/Ch7 - Read and Write Files.suo b/Ch7 - Read and Write Files/Ch7 - Read and Write Files.suo new file mode 100644 index 0000000..303b9ee Binary files /dev/null and b/Ch7 - Read and Write Files/Ch7 - Read and Write Files.suo differ diff --git a/Ch7 - Read and Write Files/Ch7 - Read and Write Files.vbproj b/Ch7 - Read and Write Files/Ch7 - Read and Write Files.vbproj new file mode 100644 index 0000000..abdf63f --- /dev/null +++ b/Ch7 - Read and Write Files/Ch7 - Read and Write Files.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Read and Write Files/Ch7 - Read and Write Files.vbproj.user b/Ch7 - Read and Write Files/Ch7 - Read and Write Files.vbproj.user new file mode 100644 index 0000000..c168d10 --- /dev/null +++ b/Ch7 - Read and Write Files/Ch7 - Read and Write Files.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Read and Write Files/Form1.resx b/Ch7 - Read and Write Files/Form1.resx new file mode 100644 index 0000000..dc51f7d --- /dev/null +++ b/Ch7 - Read and Write Files/Form1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + 17, 17 + + + Assembly + + + 149, 17 + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Read and Write Files/Form1.vb b/Ch7 - Read and Write Files/Form1.vb new file mode 100644 index 0000000..e41aa65 --- /dev/null +++ b/Ch7 - Read and Write Files/Form1.vb @@ -0,0 +1,123 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents Button2 As System.Windows.Forms.Button + Friend WithEvents OFD As System.Windows.Forms.OpenFileDialog + Friend WithEvents SFD As System.Windows.Forms.SaveFileDialog + Private Sub InitializeComponent() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.Button1 = New System.Windows.Forms.Button() + Me.Button2 = New System.Windows.Forms.Button() + Me.OFD = New System.Windows.Forms.OpenFileDialog() + Me.SFD = New System.Windows.Forms.SaveFileDialog() + Me.SuspendLayout() + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(24, 72) + Me.TextBox1.Multiline = True + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical + Me.TextBox1.Size = New System.Drawing.Size(424, 224) + Me.TextBox1.TabIndex = 0 + Me.TextBox1.Text = "" + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(24, 16) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(96, 32) + Me.Button1.TabIndex = 1 + Me.Button1.Text = "Open File" + ' + 'Button2 + ' + Me.Button2.Location = New System.Drawing.Point(136, 16) + Me.Button2.Name = "Button2" + Me.Button2.Size = New System.Drawing.Size(96, 32) + Me.Button2.TabIndex = 2 + Me.Button2.Text = "Save File" + ' + 'SFD + ' + Me.SFD.FileName = "doc1" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(472, 326) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button2, Me.Button1, Me.TextBox1}) + Me.Name = "Form1" + Me.Text = "Two Easy-to-Use Functions for Reading and Writing Files" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Public Function ReadTextFromFile(ByVal Filename As String) As String + ' Returns text from the specified file + On Error Resume Next + Dim strFileText As String + ' Open the file and launch StreamReader object + Dim MyReader As System.IO.StreamReader = _ + System.IO.File.OpenText(Filename) + ' Read all text through to the end + strFileText = MyReader.ReadToEnd + ' Close the stream + MyReader.Close() + ' Return data + Return strFileText + End Function + + Public Sub WriteTextToFile(ByVal Filename As String, ByVal Text As String) + ' Writes the passed Text into the specified file + ' Create file and StreamWriter object + Dim MyWriter As System.IO.StreamWriter = _ + System.IO.File.CreateText(Filename) + ' Write text to the stream + MyWriter.Write(Text) + ' Close the stream + MyWriter.Close() + End Sub + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + OFD.ShowDialog() + TextBox1.Text = ReadTextFromFile(OFD.FileName) + End Sub + + Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click + SFD.ShowDialog() + WriteTextToFile(SFD.FileName, TextBox1.Text) + End Sub +End Class diff --git a/Ch7 - Read and Write Files/bin/Ch7 - Read and Write Files.exe b/Ch7 - Read and Write Files/bin/Ch7 - Read and Write Files.exe new file mode 100644 index 0000000..4b78940 Binary files /dev/null and b/Ch7 - Read and Write Files/bin/Ch7 - Read and Write Files.exe differ diff --git a/Ch7 - Read and Write Files/bin/Ch7 - Read and Write Files.pdb b/Ch7 - Read and Write Files/bin/Ch7 - Read and Write Files.pdb new file mode 100644 index 0000000..4d211e6 Binary files /dev/null and b/Ch7 - Read and Write Files/bin/Ch7 - Read and Write Files.pdb differ diff --git a/Ch7 - Read and Write Files/obj/Debug/Ch7 - Read and Write Files.exe b/Ch7 - Read and Write Files/obj/Debug/Ch7 - Read and Write Files.exe new file mode 100644 index 0000000..4b78940 Binary files /dev/null and b/Ch7 - Read and Write Files/obj/Debug/Ch7 - Read and Write Files.exe differ diff --git a/Ch7 - Read and Write Files/obj/Debug/Ch7 - Read and Write Files.pdb b/Ch7 - Read and Write Files/obj/Debug/Ch7 - Read and Write Files.pdb new file mode 100644 index 0000000..4d211e6 Binary files /dev/null and b/Ch7 - Read and Write Files/obj/Debug/Ch7 - Read and Write Files.pdb differ diff --git a/Ch7 - Read and Write Files/obj/Debug/Ch7___Read_and_Write_Files.Form1.resources b/Ch7 - Read and Write Files/obj/Debug/Ch7___Read_and_Write_Files.Form1.resources new file mode 100644 index 0000000..9a38ac4 Binary files /dev/null and b/Ch7 - Read and Write Files/obj/Debug/Ch7___Read_and_Write_Files.Form1.resources differ diff --git a/Ch7 - Registry/AssemblyInfo.vb b/Ch7 - Registry/AssemblyInfo.vb new file mode 100644 index 0000000..33c7915 --- /dev/null +++ b/Ch7 - Registry/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Registry/Ch7 - Registry.sln b/Ch7 - Registry/Ch7 - Registry.sln new file mode 100644 index 0000000..87dc50a --- /dev/null +++ b/Ch7 - Registry/Ch7 - Registry.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Registry", "Ch7 - Registry.vbproj", "{6ACCA55C-095C-42F7-9199-9172763657B3}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {6ACCA55C-095C-42F7-9199-9172763657B3}.Debug.ActiveCfg = Debug|.NET + {6ACCA55C-095C-42F7-9199-9172763657B3}.Debug.Build.0 = Debug|.NET + {6ACCA55C-095C-42F7-9199-9172763657B3}.Release.ActiveCfg = Release|.NET + {6ACCA55C-095C-42F7-9199-9172763657B3}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Registry/Ch7 - Registry.suo b/Ch7 - Registry/Ch7 - Registry.suo new file mode 100644 index 0000000..332c47e Binary files /dev/null and b/Ch7 - Registry/Ch7 - Registry.suo differ diff --git a/Ch7 - Registry/Ch7 - Registry.vbproj b/Ch7 - Registry/Ch7 - Registry.vbproj new file mode 100644 index 0000000..fbb1cee --- /dev/null +++ b/Ch7 - Registry/Ch7 - Registry.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Registry/Ch7 - Registry.vbproj.user b/Ch7 - Registry/Ch7 - Registry.vbproj.user new file mode 100644 index 0000000..a6e254a --- /dev/null +++ b/Ch7 - Registry/Ch7 - Registry.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Registry/Form1.resx b/Ch7 - Registry/Form1.resx new file mode 100644 index 0000000..e25f8ab --- /dev/null +++ b/Ch7 - Registry/Form1.resx @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Registry/Form1.vb b/Ch7 - Registry/Form1.vb new file mode 100644 index 0000000..46e68a1 --- /dev/null +++ b/Ch7 - Registry/Form1.vb @@ -0,0 +1,82 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(80, 48) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(240, 56) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Test write/read registry code" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(400, 174) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1}) + Me.Name = "Form1" + Me.Text = "How to Read and Write the Registry" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Public Function ReadFromRegistry(ByVal Location As String, _ + ByVal Name As String) As String + ' Returns a value from the registry + Dim MyKey As Microsoft.Win32.RegistryKey + MyKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(Location) + ReadFromRegistry = CType(MyKey.GetValue(Name), String) + MyKey.Close() + End Function + + Public Sub WriteToRegistry(ByVal Location As String, _ + ByVal Name As String, ByVal Data As String) + ' Writes a value to the registry + Dim MyKey As Microsoft.Win32.RegistryKey + MyKey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(Location) + MyKey.SetValue(Name, Data) + MyKey.Close() + End Sub + + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + WriteToRegistry("Software\White Cliff\MyApp", "Username", "John") + MessageBox.Show(ReadFromRegistry("Software\White Cliff\MyApp", _ + "Username")) + End Sub +End Class diff --git a/Ch7 - Registry/bin/Ch7 - Registry.exe b/Ch7 - Registry/bin/Ch7 - Registry.exe new file mode 100644 index 0000000..5843310 Binary files /dev/null and b/Ch7 - Registry/bin/Ch7 - Registry.exe differ diff --git a/Ch7 - Registry/bin/Ch7 - Registry.pdb b/Ch7 - Registry/bin/Ch7 - Registry.pdb new file mode 100644 index 0000000..8d0f7c8 Binary files /dev/null and b/Ch7 - Registry/bin/Ch7 - Registry.pdb differ diff --git a/Ch7 - Registry/obj/Debug/Ch7 - Registry.exe b/Ch7 - Registry/obj/Debug/Ch7 - Registry.exe new file mode 100644 index 0000000..5843310 Binary files /dev/null and b/Ch7 - Registry/obj/Debug/Ch7 - Registry.exe differ diff --git a/Ch7 - Registry/obj/Debug/Ch7 - Registry.pdb b/Ch7 - Registry/obj/Debug/Ch7 - Registry.pdb new file mode 100644 index 0000000..8d0f7c8 Binary files /dev/null and b/Ch7 - Registry/obj/Debug/Ch7 - Registry.pdb differ diff --git a/Ch7 - Registry/obj/Debug/Ch7___Registry.Form1.resources b/Ch7 - Registry/obj/Debug/Ch7___Registry.Form1.resources new file mode 100644 index 0000000..ad3ef8f Binary files /dev/null and b/Ch7 - Registry/obj/Debug/Ch7___Registry.Form1.resources differ diff --git a/Ch7 - Rotate Image/AssemblyInfo.vb b/Ch7 - Rotate Image/AssemblyInfo.vb new file mode 100644 index 0000000..506b54f --- /dev/null +++ b/Ch7 - Rotate Image/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Rotate Image/Ch7 - Rotate Image.sln b/Ch7 - Rotate Image/Ch7 - Rotate Image.sln new file mode 100644 index 0000000..85787a1 --- /dev/null +++ b/Ch7 - Rotate Image/Ch7 - Rotate Image.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Rotate Image", "Ch7 - Rotate Image.vbproj", "{BCB1A43F-755F-4E1D-BED9-53DEEAF504AC}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {BCB1A43F-755F-4E1D-BED9-53DEEAF504AC}.Debug.ActiveCfg = Debug|.NET + {BCB1A43F-755F-4E1D-BED9-53DEEAF504AC}.Debug.Build.0 = Debug|.NET + {BCB1A43F-755F-4E1D-BED9-53DEEAF504AC}.Release.ActiveCfg = Release|.NET + {BCB1A43F-755F-4E1D-BED9-53DEEAF504AC}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Rotate Image/Ch7 - Rotate Image.suo b/Ch7 - Rotate Image/Ch7 - Rotate Image.suo new file mode 100644 index 0000000..f55dd0d Binary files /dev/null and b/Ch7 - Rotate Image/Ch7 - Rotate Image.suo differ diff --git a/Ch7 - Rotate Image/Ch7 - Rotate Image.vbproj b/Ch7 - Rotate Image/Ch7 - Rotate Image.vbproj new file mode 100644 index 0000000..a194b70 --- /dev/null +++ b/Ch7 - Rotate Image/Ch7 - Rotate Image.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Rotate Image/Ch7 - Rotate Image.vbproj.user b/Ch7 - Rotate Image/Ch7 - Rotate Image.vbproj.user new file mode 100644 index 0000000..eabb41d --- /dev/null +++ b/Ch7 - Rotate Image/Ch7 - Rotate Image.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Rotate Image/Form1.resx b/Ch7 - Rotate Image/Form1.resx new file mode 100644 index 0000000..c7fdf86 --- /dev/null +++ b/Ch7 - Rotate Image/Form1.resx @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Rotate Image/Form1.vb b/Ch7 - Rotate Image/Form1.vb new file mode 100644 index 0000000..a298a14 --- /dev/null +++ b/Ch7 - Rotate Image/Form1.vb @@ -0,0 +1,81 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel + Friend WithEvents box1 As System.Windows.Forms.PictureBox + Private Sub InitializeComponent() + Me.box1 = New System.Windows.Forms.PictureBox() + Me.LinkLabel1 = New System.Windows.Forms.LinkLabel() + Me.SuspendLayout() + ' + 'box1 + ' + Me.box1.Location = New System.Drawing.Point(40, 80) + Me.box1.Name = "box1" + Me.box1.Size = New System.Drawing.Size(304, 264) + Me.box1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage + Me.box1.TabIndex = 0 + Me.box1.TabStop = False + ' + 'LinkLabel1 + ' + Me.LinkLabel1.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.LinkLabel1.Location = New System.Drawing.Point(40, 24) + Me.LinkLabel1.Name = "LinkLabel1" + Me.LinkLabel1.Size = New System.Drawing.Size(328, 23) + Me.LinkLabel1.TabIndex = 3 + Me.LinkLabel1.TabStop = True + Me.LinkLabel1.Text = "Click here to rotate the image!" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(384, 382) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.LinkLabel1, Me.box1}) + Me.Name = "Form1" + Me.Text = "Rotating an image" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked + Dim objImage As Image = box1.Image + objImage.RotateFlip(RotateFlipType.RotateNoneFlipY) + box1.Image = objImage + End Sub + + Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + box1.Image = System.Drawing.Image.FromFile(Application.StartupPath & "\sample.gif") + box1.SizeMode = PictureBoxSizeMode.StretchImage + End Sub +End Class diff --git a/Ch7 - Rotate Image/bin/Ch7 - Rotate Image.exe b/Ch7 - Rotate Image/bin/Ch7 - Rotate Image.exe new file mode 100644 index 0000000..a29625c Binary files /dev/null and b/Ch7 - Rotate Image/bin/Ch7 - Rotate Image.exe differ diff --git a/Ch7 - Rotate Image/bin/Ch7 - Rotate Image.pdb b/Ch7 - Rotate Image/bin/Ch7 - Rotate Image.pdb new file mode 100644 index 0000000..de0fb4d Binary files /dev/null and b/Ch7 - Rotate Image/bin/Ch7 - Rotate Image.pdb differ diff --git a/Ch7 - Rotate Image/bin/sample.gif b/Ch7 - Rotate Image/bin/sample.gif new file mode 100644 index 0000000..d36e5f5 Binary files /dev/null and b/Ch7 - Rotate Image/bin/sample.gif differ diff --git a/Ch7 - Rotate Image/obj/Debug/Ch7 - Rotate Image.exe b/Ch7 - Rotate Image/obj/Debug/Ch7 - Rotate Image.exe new file mode 100644 index 0000000..a29625c Binary files /dev/null and b/Ch7 - Rotate Image/obj/Debug/Ch7 - Rotate Image.exe differ diff --git a/Ch7 - Rotate Image/obj/Debug/Ch7 - Rotate Image.pdb b/Ch7 - Rotate Image/obj/Debug/Ch7 - Rotate Image.pdb new file mode 100644 index 0000000..de0fb4d Binary files /dev/null and b/Ch7 - Rotate Image/obj/Debug/Ch7 - Rotate Image.pdb differ diff --git a/Ch7 - Rotate Image/obj/Debug/Ch7___Rotate_Image.Form1.resources b/Ch7 - Rotate Image/obj/Debug/Ch7___Rotate_Image.Form1.resources new file mode 100644 index 0000000..d23d3b8 Binary files /dev/null and b/Ch7 - Rotate Image/obj/Debug/Ch7___Rotate_Image.Form1.resources differ diff --git a/Ch7 - Screensaver/AssemblyInfo.vb b/Ch7 - Screensaver/AssemblyInfo.vb new file mode 100644 index 0000000..1925e1d --- /dev/null +++ b/Ch7 - Screensaver/AssemblyInfo.vb @@ -0,0 +1,96 @@ +'Copyright (C) 2002 Microsoft Corporation +'All rights reserved. +'THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +'EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF +'MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +'Requires the Trial or Release version of Visual Studio .NET Professional (or greater). + +Option Strict On + +Imports System.Reflection + + + + + + + + + + +#Region " Helper Class to Get Information for the About form. " +' This class uses the System.Reflection.Assembly class to +' access assembly meta-data +' This class is not a normal feature of AssemblyInfo.vb +Public Class AssemblyInfo + ' Used by Helper Functions to access information from Assembly Attributes + Private myType As Type + + Public Sub New() + myType = GetType(frmMain) + End Sub + + Public ReadOnly Property AsmName() As String + Get + Return myType.Assembly.GetName.Name.ToString() + End Get + End Property + Public ReadOnly Property AsmFQName() As String + Get + Return myType.Assembly.GetName.FullName.ToString() + End Get + End Property + Public ReadOnly Property CodeBase() As String + Get + Return myType.Assembly.CodeBase + End Get + End Property + Public ReadOnly Property Copyright() As String + Get + Dim at As Type = GetType(AssemblyCopyrightAttribute) + Dim r() As Object = myType.Assembly.GetCustomAttributes(at, False) + Dim ct As AssemblyCopyrightAttribute = CType(r(0), AssemblyCopyrightAttribute) + Return ct.Copyright + End Get + End Property + Public ReadOnly Property Company() As String + Get + Dim at As Type = GetType(AssemblyCopyrightAttribute) + Dim r() As Object = myType.Assembly.GetCustomAttributes(at, False) + Dim ct As AssemblyCompanyAttribute = CType(r(0), AssemblyCompanyAttribute) + Return ct.Company + End Get + End Property + Public ReadOnly Property Description() As String + Get + Dim at As Type = GetType(AssemblyDescriptionAttribute) + Dim r() As Object = myType.Assembly.GetCustomAttributes(at, False) + Dim da As AssemblyDescriptionAttribute = CType(r(0), AssemblyDescriptionAttribute) + Return da.Description + End Get + End Property + Public ReadOnly Property Product() As String + Get + Dim at As Type = GetType(AssemblyProductAttribute) + Dim r() As Object = myType.Assembly.GetCustomAttributes(at, False) + Dim pt As AssemblyProductAttribute = CType(r(0), AssemblyProductAttribute) + Return pt.Product + End Get + End Property + Public ReadOnly Property Title() As String + Get + Dim at As Type = GetType(AssemblyTitleAttribute) + Dim r() As Object = myType.Assembly.GetCustomAttributes(at, False) + Dim ta As AssemblyTitleAttribute = CType(r(0), AssemblyTitleAttribute) + Return ta.Title + End Get + End Property + Public ReadOnly Property Version() As String + Get + Return myType.Assembly.GetName.Version.ToString() + End Get + End Property +End Class + +#End Region \ No newline at end of file diff --git a/Ch7 - Screensaver/Read Me.txt b/Ch7 - Screensaver/Read Me.txt new file mode 100644 index 0000000..4ea1402 --- /dev/null +++ b/Ch7 - Screensaver/Read Me.txt @@ -0,0 +1,3 @@ +Downloaded and extracted from MSDN - + +http://msdn.microsoft.com/library/en-us/dnvssamp/html/vbcs_CreateaScreensaverwithGDI.asp \ No newline at end of file diff --git a/Ch7 - Screensaver/ReadMe.htm b/Ch7 - Screensaver/ReadMe.htm new file mode 100644 index 0000000..fa9d365 --- /dev/null +++ b/Ch7 - Screensaver/ReadMe.htm @@ -0,0 +1,75 @@ + + + + ReadMe + + + + + + + +

Advanced .NET Framework (GDI+): Creating a Screen Saver with GDI+

+

This sample shows some how to create a screen saver using Visual Basic.NET. +

+

Feature Highlights:

+

+ This how-to demonstrates many of the important features of creating screen + savers that can be automated by Windows. Concepts demonstrated are:

+
    +
  • + Creating a screen saver to fill the screen with a single form, and draw images + to the form. +
  • + Setting up an Options file, to store user defined options that guide how the + screen saver runs. +
  • + React to mouse and keyboard events to close the screen saver.
+

The screen saver preview functionality is not demonstrated, since it involves + several advanced threading issues.

+

Requirements:

+ Microsoft Visual Studio .NET Professional (or greater).
+ Windows 2000 or Windows XP.

Running the Sample:

+

To run the sample: +

+
    +
  1. + Doubleclick the VB.NET How-To Creating a Screensaver using GDI+.sln + file.  +
  2. + Click the "Install" button on the main form to copy the screen saver to the + Windows system folder. +
  3. + Go into your display settings, and set the screen saver as VB.NET How-To + Screen Saver. +
  4. + Test the screensaver. +
  5. + Explore the VB.NET How-To Screen Saver Project project for an + example of creating your own screen saver. +
  6. +
+

Notes:

+

When you compile your own screen saver, there are several things to keep in + mind.  First, be sure to set the following Form Properties: +

+
    +
  • + FormBorderStyle = None +
  • + WindowState = Maximized +
  • + MaximizeBox = False +
  • + MinimizeBox = False +
  • + ShowInTaskbar = False
+

Also, before you can use a newly compiled screen saver, you must change its + extension from .EXE to .SCR, and copy it to the Windows system directory (by + default, in WinXP this is "C:\Windows\System32").

+

See Also:

+

System.Drawing, + + System.Drawing.Graphics

+ + \ No newline at end of file diff --git a/Ch7 - Screensaver/VB.NET How-To Creating a Screensaver Using GDI+.sln b/Ch7 - Screensaver/VB.NET How-To Creating a Screensaver Using GDI+.sln new file mode 100644 index 0000000..6794252 --- /dev/null +++ b/Ch7 - Screensaver/VB.NET How-To Creating a Screensaver Using GDI+.sln @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VB.NET How-To Creating a Screensaver Using GDI+", "VB.NET How-To Creating a Screensaver Using GDI+.vbproj", "{D48F2DDC-060F-44DB-B77E-362CB1F6AF9F}" +EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VB.NET How-To ScreenSaver Project", "VB.NET How-To ScreenSaver Project\VB.NET How-To ScreenSaver Project.vbproj", "{7BF7D4CF-72D7-45FA-8C07-CB739ACD2032}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {D48F2DDC-060F-44DB-B77E-362CB1F6AF9F}.Debug.ActiveCfg = Debug|.NET + {D48F2DDC-060F-44DB-B77E-362CB1F6AF9F}.Debug.Build.0 = Debug|.NET + {D48F2DDC-060F-44DB-B77E-362CB1F6AF9F}.Release.ActiveCfg = Release|.NET + {D48F2DDC-060F-44DB-B77E-362CB1F6AF9F}.Release.Build.0 = Release|.NET + {7BF7D4CF-72D7-45FA-8C07-CB739ACD2032}.Debug.ActiveCfg = Debug|.NET + {7BF7D4CF-72D7-45FA-8C07-CB739ACD2032}.Debug.Build.0 = Debug|.NET + {7BF7D4CF-72D7-45FA-8C07-CB739ACD2032}.Release.ActiveCfg = Release|.NET + {7BF7D4CF-72D7-45FA-8C07-CB739ACD2032}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Screensaver/VB.NET How-To Creating a Screensaver Using GDI+.suo b/Ch7 - Screensaver/VB.NET How-To Creating a Screensaver Using GDI+.suo new file mode 100644 index 0000000..f105f9c Binary files /dev/null and b/Ch7 - Screensaver/VB.NET How-To Creating a Screensaver Using GDI+.suo differ diff --git a/Ch7 - Screensaver/VB.NET How-To Creating a Screensaver Using GDI+.vbproj b/Ch7 - Screensaver/VB.NET How-To Creating a Screensaver Using GDI+.vbproj new file mode 100644 index 0000000..d8b74e2 --- /dev/null +++ b/Ch7 - Screensaver/VB.NET How-To Creating a Screensaver Using GDI+.vbproj @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Screensaver/VB.NET How-To Creating a Screensaver Using GDI+.vbproj.user b/Ch7 - Screensaver/VB.NET How-To Creating a Screensaver Using GDI+.vbproj.user new file mode 100644 index 0000000..447fdc6 --- /dev/null +++ b/Ch7 - Screensaver/VB.NET How-To Creating a Screensaver Using GDI+.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/AssemblyInfo.vb b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/AssemblyInfo.vb new file mode 100644 index 0000000..0c8058b --- /dev/null +++ b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/Options.vb b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/Options.vb new file mode 100644 index 0000000..88eb5bc --- /dev/null +++ b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/Options.vb @@ -0,0 +1,122 @@ +Option Strict On + +Imports System.Xml.Serialization +Imports System.Xml +Imports System.IO + +' This is the class that holds the Options information. The Options information +' is defined as a class so that it can be easily serialized and deserialized. + Public Class Options + + ' Set up the class variables and make them their defaults + Private m_Speed As String = "Fast" + Private m_Shape As String = "Ellipse" + Private m_IsTransparent As Boolean = True + ' Set the OptionsPath to the current location with a fixed file name. + Private OptionsPath As String = Environment.CurrentDirectory & "\VB.NET How-To Screen Saver Options.opt" + + ' --- Class Properties --- + + ' This property returns whether the screen saver should use transparency + ' when drawing the shapes to the screen. + Public Property IsTransparent() As Boolean + Get + Return m_IsTransparent + End Get + Set(ByVal Value As Boolean) + m_IsTransparent = Value + End Set + End Property + + ' This property returns what shapes the screen saver should use + ' when drawing to the screen. + Public Property Shape() As String + Get + Return m_Shape + End Get + Set(ByVal Value As String) + m_Shape = Value + End Set + End Property + + ' This property returns what speed the screen saver should use + ' when drawing to the screen. + Public Property Speed() As String + Get + Return m_Speed + End Get + Set(ByVal Value As String) + m_Speed = Value + End Set + End Property + + ' --- Class Methods --- + + ' This function returns 'true' if the options file exists, 'false' otherwise. + Public Function IsOptionFileExisting() As Boolean + Dim myIO As New System.IO.FileInfo(OptionsPath) + Return myIO.Exists() + End Function + + ' This function loads the user defined options. First, it checks to see + ' if an options file exists. If it does, the options are loaded from it. + ' If the file doesn't exist, one is created with the defaults. + Public Sub LoadOptions() + + Dim myOptions As New Options() ' An Options object to use + + ' Check to see if an Option file exists, if so, load it! Else + ' create one. + If myOptions.IsOptionFileExisting() Then + + ' Load the options + ' Create an XmlSerializer to use for retrieving options values + Dim mySerializer As New XmlSerializer(GetType(Options)) + ' Create a StreamReader to point to the options file + Dim myTextReader As New StreamReader(OptionsPath) + ' Create an XmlTextReader to actually read the options. + Dim myXmlReader As New Xml.XmlTextReader(myTextReader) + + ' First verify that the file can be deserialized into an Option + ' object format. + If mySerializer.CanDeserialize(myXmlReader) Then + ' Deserialize the object + myOptions = CType(mySerializer.Deserialize(myXmlReader), Options) + Else + ' Save a new Options file + myOptions.SaveOptions() + End If + + ' Close the IO objects we've used. + myXmlReader.Close() + myTextReader.Close() + + ' Set the properties for this Options object to those retrieved + ' from the file (or else use the defaults from the temporary + ' Options object, if the file could not be deserialized). + Me.Speed = myOptions.Speed + Me.IsTransparent = myOptions.IsTransparent + Me.Shape = myOptions.Shape + + End If + End Sub + + ' This function saves the user defined options to disk. + Public Sub SaveOptions() + + ' Create a stream writer to overwrite any files currently there, so that + ' the fresh options can be saved. + Dim myWriter As New System.IO.StreamWriter(OptionsPath) + + ' Create an XML Serializer to serialize the object + Dim myXmlSerializer As New XmlSerializer(Me.GetType()) + + ' Serialize the current Options object (Me) to disk. + myXmlSerializer.Serialize(myWriter, Me) + + ' Close the writer. + myWriter.Close() + + End Sub + +End Class diff --git a/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/VB.NET How-To ScreenSaver Project.vbproj b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/VB.NET How-To ScreenSaver Project.vbproj new file mode 100644 index 0000000..15490dc --- /dev/null +++ b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/VB.NET How-To ScreenSaver Project.vbproj @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/VB.NET How-To ScreenSaver Project.vbproj.user b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/VB.NET How-To ScreenSaver Project.vbproj.user new file mode 100644 index 0000000..447fdc6 --- /dev/null +++ b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/VB.NET How-To ScreenSaver Project.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/bin/VB_NET How-To ScreenSaver.exe b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/bin/VB_NET How-To ScreenSaver.exe new file mode 100644 index 0000000..3cd08aa Binary files /dev/null and b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/bin/VB_NET How-To ScreenSaver.exe differ diff --git a/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/bin/VB_NET How-To ScreenSaver.pdb b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/bin/VB_NET How-To ScreenSaver.pdb new file mode 100644 index 0000000..7a7fb2b Binary files /dev/null and b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/bin/VB_NET How-To ScreenSaver.pdb differ diff --git a/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/frmOptions.resx b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/frmOptions.resx new file mode 100644 index 0000000..7c56976 --- /dev/null +++ b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/frmOptions.resx @@ -0,0 +1,759 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Ok Button for the Options Dialog + + + Ok Button + + + Bottom, Right + + + + + + None + + + True + + + Standard + + + + + + + + + MiddleCenter + + + -1 + + + NoControl + + + 208, 88 + + + Inherit + + + 75, 23 + + + 0 + + + OK + + + MiddleCenter + + + True + + + btnOK + + + System.Windows.Forms.Button, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 5 + + + Assembly + + + Cancel button for the Options Dialog + + + Cancel Button + + + Bottom, Right + + + + + + None + + + True + + + Standard + + + + + + + + + MiddleCenter + + + -1 + + + NoControl + + + 296, 88 + + + Inherit + + + 75, 23 + + + 1 + + + Cancel + + + MiddleCenter + + + True + + + btnCancel + + + System.Windows.Forms.Button, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 4 + + + Assembly + + + Checkbox to select transparency. + + + Transparent Checkbox + + + Top, Left + + + Normal + + + + + + MiddleLeft + + + None + + + True + + + Standard + + + + + + + + + MiddleCenter + + + -1 + + + NoControl + + + 144, 8 + + + Inherit + + + 144, 24 + + + 2 + + + Transparent Colors + + + MiddleLeft + + + True + + + chkTransparent + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 3 + + + Assembly + + + GroupBox containing shapes to use. + + + Shapes GroupBox + + + Top, Left + + + + + + None + + + True + + + + + + Inherit + + + 8, 8 + + + Inherit + + + 128, 72 + + + 3 + + + Shapes + + + True + + + grpShapes + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + + + Assembly + + + Option Button to select Ellipses. + + + Ellipses option. + + + Top, Left + + + Normal + + + + + + MiddleLeft + + + None + + + True + + + Standard + + + + + + + + + MiddleCenter + + + -1 + + + NoControl + + + 8, 40 + + + Inherit + + + 104, 24 + + + 1 + + + Ellipses + + + MiddleLeft + + + True + + + optEllipses + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpShapes + + + 0 + + + Assembly + + + Option Button to select Rectangles. + + + Rectangles Option + + + Top, Left + + + Normal + + + + + + MiddleLeft + + + None + + + True + + + Standard + + + + + + + + + MiddleCenter + + + -1 + + + NoControl + + + 8, 16 + + + Inherit + + + 104, 24 + + + 0 + + + Rectangles + + + MiddleLeft + + + True + + + optRectangles + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpShapes + + + 1 + + + Assembly + + + ComboBox with speed of screensaver. + + + Speed ComboBox + + + Top, Left + + + + + + None + + + True + + + + + + Inherit + + + True + + + 16 + + + Fast + + + Medium + + + Slow + + + 208, 40 + + + 8 + + + 0 + + + Inherit + + + 121, 24 + + + 4 + + + Medium + + + True + + + cboSpeed + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + Assembly + + + Label reading "Speed" + + + Speed Label. + + + Top, Left + + + False + + + None + + + True + + + + + + + + + MiddleCenter + + + -1 + + + NoControl + + + 144, 40 + + + Inherit + + + 64, 23 + + + 5 + + + Speed + + + TopLeft + + + True + + + Label1 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + frmOptions + + + (Default) + + + True + + + Form that displays screen saver options. + + + Options form. + + + Top, Left + + + 6, 16 + + + False + + + 0, 0 + + + 0, 0 + + + + + + 376, 126 + + + None + + + True + + + Microsoft Sans Serif, 10pt + + + + + + Inherit + + + 0, 0 + + + 0, 0 + + + 0, 0 + + + Inherit + + + WindowsDefaultLocation + + + Screen Saver Options + + + False + + + frmOptions + + + System.Windows.Forms.Form, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/frmOptions.vb b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/frmOptions.vb new file mode 100644 index 0000000..0081783 --- /dev/null +++ b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/frmOptions.vb @@ -0,0 +1,323 @@ +Option Strict On + +Imports System.IO + +Public Class frmOptions + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents btnOK As System.Windows.Forms.Button + Friend WithEvents btnCancel As System.Windows.Forms.Button + Friend WithEvents chkTransparent As System.Windows.Forms.CheckBox + Friend WithEvents optRectangles As System.Windows.Forms.RadioButton + Friend WithEvents optEllipses As System.Windows.Forms.RadioButton + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents cboSpeed As System.Windows.Forms.ComboBox + Friend WithEvents grpShapes As System.Windows.Forms.GroupBox + Private Sub InitializeComponent() + Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmOptions)) + Me.btnOK = New System.Windows.Forms.Button() + Me.btnCancel = New System.Windows.Forms.Button() + Me.chkTransparent = New System.Windows.Forms.CheckBox() + Me.grpShapes = New System.Windows.Forms.GroupBox() + Me.optEllipses = New System.Windows.Forms.RadioButton() + Me.optRectangles = New System.Windows.Forms.RadioButton() + Me.cboSpeed = New System.Windows.Forms.ComboBox() + Me.Label1 = New System.Windows.Forms.Label() + Me.grpShapes.SuspendLayout() + Me.SuspendLayout() + ' + 'btnOK + ' + Me.btnOK.AccessibleDescription = resources.GetString("btnOK.AccessibleDescription") + Me.btnOK.AccessibleName = resources.GetString("btnOK.AccessibleName") + Me.btnOK.Anchor = CType(resources.GetObject("btnOK.Anchor"), System.Windows.Forms.AnchorStyles) + Me.btnOK.BackgroundImage = CType(resources.GetObject("btnOK.BackgroundImage"), System.Drawing.Image) + Me.btnOK.Dock = CType(resources.GetObject("btnOK.Dock"), System.Windows.Forms.DockStyle) + Me.btnOK.Enabled = CType(resources.GetObject("btnOK.Enabled"), Boolean) + Me.btnOK.FlatStyle = CType(resources.GetObject("btnOK.FlatStyle"), System.Windows.Forms.FlatStyle) + Me.btnOK.Font = CType(resources.GetObject("btnOK.Font"), System.Drawing.Font) + Me.btnOK.Image = CType(resources.GetObject("btnOK.Image"), System.Drawing.Image) + Me.btnOK.ImageAlign = CType(resources.GetObject("btnOK.ImageAlign"), System.Drawing.ContentAlignment) + Me.btnOK.ImageIndex = CType(resources.GetObject("btnOK.ImageIndex"), Integer) + Me.btnOK.ImeMode = CType(resources.GetObject("btnOK.ImeMode"), System.Windows.Forms.ImeMode) + Me.btnOK.Location = CType(resources.GetObject("btnOK.Location"), System.Drawing.Point) + Me.btnOK.Name = "btnOK" + Me.btnOK.RightToLeft = CType(resources.GetObject("btnOK.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.btnOK.Size = CType(resources.GetObject("btnOK.Size"), System.Drawing.Size) + Me.btnOK.TabIndex = CType(resources.GetObject("btnOK.TabIndex"), Integer) + Me.btnOK.Text = resources.GetString("btnOK.Text") + Me.btnOK.TextAlign = CType(resources.GetObject("btnOK.TextAlign"), System.Drawing.ContentAlignment) + Me.btnOK.Visible = CType(resources.GetObject("btnOK.Visible"), Boolean) + ' + 'btnCancel + ' + Me.btnCancel.AccessibleDescription = resources.GetString("btnCancel.AccessibleDescription") + Me.btnCancel.AccessibleName = resources.GetString("btnCancel.AccessibleName") + Me.btnCancel.Anchor = CType(resources.GetObject("btnCancel.Anchor"), System.Windows.Forms.AnchorStyles) + Me.btnCancel.BackgroundImage = CType(resources.GetObject("btnCancel.BackgroundImage"), System.Drawing.Image) + Me.btnCancel.Dock = CType(resources.GetObject("btnCancel.Dock"), System.Windows.Forms.DockStyle) + Me.btnCancel.Enabled = CType(resources.GetObject("btnCancel.Enabled"), Boolean) + Me.btnCancel.FlatStyle = CType(resources.GetObject("btnCancel.FlatStyle"), System.Windows.Forms.FlatStyle) + Me.btnCancel.Font = CType(resources.GetObject("btnCancel.Font"), System.Drawing.Font) + Me.btnCancel.Image = CType(resources.GetObject("btnCancel.Image"), System.Drawing.Image) + Me.btnCancel.ImageAlign = CType(resources.GetObject("btnCancel.ImageAlign"), System.Drawing.ContentAlignment) + Me.btnCancel.ImageIndex = CType(resources.GetObject("btnCancel.ImageIndex"), Integer) + Me.btnCancel.ImeMode = CType(resources.GetObject("btnCancel.ImeMode"), System.Windows.Forms.ImeMode) + Me.btnCancel.Location = CType(resources.GetObject("btnCancel.Location"), System.Drawing.Point) + Me.btnCancel.Name = "btnCancel" + Me.btnCancel.RightToLeft = CType(resources.GetObject("btnCancel.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.btnCancel.Size = CType(resources.GetObject("btnCancel.Size"), System.Drawing.Size) + Me.btnCancel.TabIndex = CType(resources.GetObject("btnCancel.TabIndex"), Integer) + Me.btnCancel.Text = resources.GetString("btnCancel.Text") + Me.btnCancel.TextAlign = CType(resources.GetObject("btnCancel.TextAlign"), System.Drawing.ContentAlignment) + Me.btnCancel.Visible = CType(resources.GetObject("btnCancel.Visible"), Boolean) + ' + 'chkTransparent + ' + Me.chkTransparent.AccessibleDescription = resources.GetString("chkTransparent.AccessibleDescription") + Me.chkTransparent.AccessibleName = resources.GetString("chkTransparent.AccessibleName") + Me.chkTransparent.Anchor = CType(resources.GetObject("chkTransparent.Anchor"), System.Windows.Forms.AnchorStyles) + Me.chkTransparent.Appearance = CType(resources.GetObject("chkTransparent.Appearance"), System.Windows.Forms.Appearance) + Me.chkTransparent.BackgroundImage = CType(resources.GetObject("chkTransparent.BackgroundImage"), System.Drawing.Image) + Me.chkTransparent.CheckAlign = CType(resources.GetObject("chkTransparent.CheckAlign"), System.Drawing.ContentAlignment) + Me.chkTransparent.Dock = CType(resources.GetObject("chkTransparent.Dock"), System.Windows.Forms.DockStyle) + Me.chkTransparent.Enabled = CType(resources.GetObject("chkTransparent.Enabled"), Boolean) + Me.chkTransparent.FlatStyle = CType(resources.GetObject("chkTransparent.FlatStyle"), System.Windows.Forms.FlatStyle) + Me.chkTransparent.Font = CType(resources.GetObject("chkTransparent.Font"), System.Drawing.Font) + Me.chkTransparent.Image = CType(resources.GetObject("chkTransparent.Image"), System.Drawing.Image) + Me.chkTransparent.ImageAlign = CType(resources.GetObject("chkTransparent.ImageAlign"), System.Drawing.ContentAlignment) + Me.chkTransparent.ImageIndex = CType(resources.GetObject("chkTransparent.ImageIndex"), Integer) + Me.chkTransparent.ImeMode = CType(resources.GetObject("chkTransparent.ImeMode"), System.Windows.Forms.ImeMode) + Me.chkTransparent.Location = CType(resources.GetObject("chkTransparent.Location"), System.Drawing.Point) + Me.chkTransparent.Name = "chkTransparent" + Me.chkTransparent.RightToLeft = CType(resources.GetObject("chkTransparent.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.chkTransparent.Size = CType(resources.GetObject("chkTransparent.Size"), System.Drawing.Size) + Me.chkTransparent.TabIndex = CType(resources.GetObject("chkTransparent.TabIndex"), Integer) + Me.chkTransparent.Text = resources.GetString("chkTransparent.Text") + Me.chkTransparent.TextAlign = CType(resources.GetObject("chkTransparent.TextAlign"), System.Drawing.ContentAlignment) + Me.chkTransparent.Visible = CType(resources.GetObject("chkTransparent.Visible"), Boolean) + ' + 'grpShapes + ' + Me.grpShapes.AccessibleDescription = resources.GetString("grpShapes.AccessibleDescription") + Me.grpShapes.AccessibleName = resources.GetString("grpShapes.AccessibleName") + Me.grpShapes.Anchor = CType(resources.GetObject("grpShapes.Anchor"), System.Windows.Forms.AnchorStyles) + Me.grpShapes.BackgroundImage = CType(resources.GetObject("grpShapes.BackgroundImage"), System.Drawing.Image) + Me.grpShapes.Controls.AddRange(New System.Windows.Forms.Control() {Me.optEllipses, Me.optRectangles}) + Me.grpShapes.Dock = CType(resources.GetObject("grpShapes.Dock"), System.Windows.Forms.DockStyle) + Me.grpShapes.Enabled = CType(resources.GetObject("grpShapes.Enabled"), Boolean) + Me.grpShapes.Font = CType(resources.GetObject("grpShapes.Font"), System.Drawing.Font) + Me.grpShapes.ImeMode = CType(resources.GetObject("grpShapes.ImeMode"), System.Windows.Forms.ImeMode) + Me.grpShapes.Location = CType(resources.GetObject("grpShapes.Location"), System.Drawing.Point) + Me.grpShapes.Name = "grpShapes" + Me.grpShapes.RightToLeft = CType(resources.GetObject("grpShapes.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.grpShapes.Size = CType(resources.GetObject("grpShapes.Size"), System.Drawing.Size) + Me.grpShapes.TabIndex = CType(resources.GetObject("grpShapes.TabIndex"), Integer) + Me.grpShapes.TabStop = False + Me.grpShapes.Text = resources.GetString("grpShapes.Text") + Me.grpShapes.Visible = CType(resources.GetObject("grpShapes.Visible"), Boolean) + ' + 'optEllipses + ' + Me.optEllipses.AccessibleDescription = resources.GetString("optEllipses.AccessibleDescription") + Me.optEllipses.AccessibleName = resources.GetString("optEllipses.AccessibleName") + Me.optEllipses.Anchor = CType(resources.GetObject("optEllipses.Anchor"), System.Windows.Forms.AnchorStyles) + Me.optEllipses.Appearance = CType(resources.GetObject("optEllipses.Appearance"), System.Windows.Forms.Appearance) + Me.optEllipses.BackgroundImage = CType(resources.GetObject("optEllipses.BackgroundImage"), System.Drawing.Image) + Me.optEllipses.CheckAlign = CType(resources.GetObject("optEllipses.CheckAlign"), System.Drawing.ContentAlignment) + Me.optEllipses.Dock = CType(resources.GetObject("optEllipses.Dock"), System.Windows.Forms.DockStyle) + Me.optEllipses.Enabled = CType(resources.GetObject("optEllipses.Enabled"), Boolean) + Me.optEllipses.FlatStyle = CType(resources.GetObject("optEllipses.FlatStyle"), System.Windows.Forms.FlatStyle) + Me.optEllipses.Font = CType(resources.GetObject("optEllipses.Font"), System.Drawing.Font) + Me.optEllipses.Image = CType(resources.GetObject("optEllipses.Image"), System.Drawing.Image) + Me.optEllipses.ImageAlign = CType(resources.GetObject("optEllipses.ImageAlign"), System.Drawing.ContentAlignment) + Me.optEllipses.ImageIndex = CType(resources.GetObject("optEllipses.ImageIndex"), Integer) + Me.optEllipses.ImeMode = CType(resources.GetObject("optEllipses.ImeMode"), System.Windows.Forms.ImeMode) + Me.optEllipses.Location = CType(resources.GetObject("optEllipses.Location"), System.Drawing.Point) + Me.optEllipses.Name = "optEllipses" + Me.optEllipses.RightToLeft = CType(resources.GetObject("optEllipses.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.optEllipses.Size = CType(resources.GetObject("optEllipses.Size"), System.Drawing.Size) + Me.optEllipses.TabIndex = CType(resources.GetObject("optEllipses.TabIndex"), Integer) + Me.optEllipses.Text = resources.GetString("optEllipses.Text") + Me.optEllipses.TextAlign = CType(resources.GetObject("optEllipses.TextAlign"), System.Drawing.ContentAlignment) + Me.optEllipses.Visible = CType(resources.GetObject("optEllipses.Visible"), Boolean) + ' + 'optRectangles + ' + Me.optRectangles.AccessibleDescription = resources.GetString("optRectangles.AccessibleDescription") + Me.optRectangles.AccessibleName = resources.GetString("optRectangles.AccessibleName") + Me.optRectangles.Anchor = CType(resources.GetObject("optRectangles.Anchor"), System.Windows.Forms.AnchorStyles) + Me.optRectangles.Appearance = CType(resources.GetObject("optRectangles.Appearance"), System.Windows.Forms.Appearance) + Me.optRectangles.BackgroundImage = CType(resources.GetObject("optRectangles.BackgroundImage"), System.Drawing.Image) + Me.optRectangles.CheckAlign = CType(resources.GetObject("optRectangles.CheckAlign"), System.Drawing.ContentAlignment) + Me.optRectangles.Dock = CType(resources.GetObject("optRectangles.Dock"), System.Windows.Forms.DockStyle) + Me.optRectangles.Enabled = CType(resources.GetObject("optRectangles.Enabled"), Boolean) + Me.optRectangles.FlatStyle = CType(resources.GetObject("optRectangles.FlatStyle"), System.Windows.Forms.FlatStyle) + Me.optRectangles.Font = CType(resources.GetObject("optRectangles.Font"), System.Drawing.Font) + Me.optRectangles.Image = CType(resources.GetObject("optRectangles.Image"), System.Drawing.Image) + Me.optRectangles.ImageAlign = CType(resources.GetObject("optRectangles.ImageAlign"), System.Drawing.ContentAlignment) + Me.optRectangles.ImageIndex = CType(resources.GetObject("optRectangles.ImageIndex"), Integer) + Me.optRectangles.ImeMode = CType(resources.GetObject("optRectangles.ImeMode"), System.Windows.Forms.ImeMode) + Me.optRectangles.Location = CType(resources.GetObject("optRectangles.Location"), System.Drawing.Point) + Me.optRectangles.Name = "optRectangles" + Me.optRectangles.RightToLeft = CType(resources.GetObject("optRectangles.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.optRectangles.Size = CType(resources.GetObject("optRectangles.Size"), System.Drawing.Size) + Me.optRectangles.TabIndex = CType(resources.GetObject("optRectangles.TabIndex"), Integer) + Me.optRectangles.Text = resources.GetString("optRectangles.Text") + Me.optRectangles.TextAlign = CType(resources.GetObject("optRectangles.TextAlign"), System.Drawing.ContentAlignment) + Me.optRectangles.Visible = CType(resources.GetObject("optRectangles.Visible"), Boolean) + ' + 'cboSpeed + ' + Me.cboSpeed.AccessibleDescription = resources.GetString("cboSpeed.AccessibleDescription") + Me.cboSpeed.AccessibleName = resources.GetString("cboSpeed.AccessibleName") + Me.cboSpeed.Anchor = CType(resources.GetObject("cboSpeed.Anchor"), System.Windows.Forms.AnchorStyles) + Me.cboSpeed.BackgroundImage = CType(resources.GetObject("cboSpeed.BackgroundImage"), System.Drawing.Image) + Me.cboSpeed.Dock = CType(resources.GetObject("cboSpeed.Dock"), System.Windows.Forms.DockStyle) + Me.cboSpeed.Enabled = CType(resources.GetObject("cboSpeed.Enabled"), Boolean) + Me.cboSpeed.Font = CType(resources.GetObject("cboSpeed.Font"), System.Drawing.Font) + Me.cboSpeed.ImeMode = CType(resources.GetObject("cboSpeed.ImeMode"), System.Windows.Forms.ImeMode) + Me.cboSpeed.IntegralHeight = CType(resources.GetObject("cboSpeed.IntegralHeight"), Boolean) + Me.cboSpeed.ItemHeight = CType(resources.GetObject("cboSpeed.ItemHeight"), Integer) + Me.cboSpeed.Items.AddRange(New Object() {resources.GetString("cboSpeed.Items.Items"), resources.GetString("cboSpeed.Items.Items1"), resources.GetString("cboSpeed.Items.Items2")}) + Me.cboSpeed.Location = CType(resources.GetObject("cboSpeed.Location"), System.Drawing.Point) + Me.cboSpeed.MaxDropDownItems = CType(resources.GetObject("cboSpeed.MaxDropDownItems"), Integer) + Me.cboSpeed.MaxLength = CType(resources.GetObject("cboSpeed.MaxLength"), Integer) + Me.cboSpeed.Name = "cboSpeed" + Me.cboSpeed.RightToLeft = CType(resources.GetObject("cboSpeed.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.cboSpeed.Size = CType(resources.GetObject("cboSpeed.Size"), System.Drawing.Size) + Me.cboSpeed.TabIndex = CType(resources.GetObject("cboSpeed.TabIndex"), Integer) + Me.cboSpeed.Text = resources.GetString("cboSpeed.Text") + Me.cboSpeed.Visible = CType(resources.GetObject("cboSpeed.Visible"), Boolean) + ' + 'Label1 + ' + Me.Label1.AccessibleDescription = resources.GetString("Label1.AccessibleDescription") + Me.Label1.AccessibleName = resources.GetString("Label1.AccessibleName") + Me.Label1.Anchor = CType(resources.GetObject("Label1.Anchor"), System.Windows.Forms.AnchorStyles) + Me.Label1.AutoSize = CType(resources.GetObject("Label1.AutoSize"), Boolean) + Me.Label1.Dock = CType(resources.GetObject("Label1.Dock"), System.Windows.Forms.DockStyle) + Me.Label1.Enabled = CType(resources.GetObject("Label1.Enabled"), Boolean) + Me.Label1.Font = CType(resources.GetObject("Label1.Font"), System.Drawing.Font) + Me.Label1.Image = CType(resources.GetObject("Label1.Image"), System.Drawing.Image) + Me.Label1.ImageAlign = CType(resources.GetObject("Label1.ImageAlign"), System.Drawing.ContentAlignment) + Me.Label1.ImageIndex = CType(resources.GetObject("Label1.ImageIndex"), Integer) + Me.Label1.ImeMode = CType(resources.GetObject("Label1.ImeMode"), System.Windows.Forms.ImeMode) + Me.Label1.Location = CType(resources.GetObject("Label1.Location"), System.Drawing.Point) + Me.Label1.Name = "Label1" + Me.Label1.RightToLeft = CType(resources.GetObject("Label1.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.Label1.Size = CType(resources.GetObject("Label1.Size"), System.Drawing.Size) + Me.Label1.TabIndex = CType(resources.GetObject("Label1.TabIndex"), Integer) + Me.Label1.Text = resources.GetString("Label1.Text") + Me.Label1.TextAlign = CType(resources.GetObject("Label1.TextAlign"), System.Drawing.ContentAlignment) + Me.Label1.Visible = CType(resources.GetObject("Label1.Visible"), Boolean) + ' + 'frmOptions + ' + Me.AccessibleDescription = resources.GetString("$this.AccessibleDescription") + Me.AccessibleName = resources.GetString("$this.AccessibleName") + Me.Anchor = CType(resources.GetObject("$this.Anchor"), System.Windows.Forms.AnchorStyles) + Me.AutoScaleBaseSize = CType(resources.GetObject("$this.AutoScaleBaseSize"), System.Drawing.Size) + Me.AutoScroll = CType(resources.GetObject("$this.AutoScroll"), Boolean) + Me.AutoScrollMargin = CType(resources.GetObject("$this.AutoScrollMargin"), System.Drawing.Size) + Me.AutoScrollMinSize = CType(resources.GetObject("$this.AutoScrollMinSize"), System.Drawing.Size) + Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image) + Me.ClientSize = CType(resources.GetObject("$this.ClientSize"), System.Drawing.Size) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label1, Me.cboSpeed, Me.grpShapes, Me.chkTransparent, Me.btnCancel, Me.btnOK}) + Me.Dock = CType(resources.GetObject("$this.Dock"), System.Windows.Forms.DockStyle) + Me.Enabled = CType(resources.GetObject("$this.Enabled"), Boolean) + Me.Font = CType(resources.GetObject("$this.Font"), System.Drawing.Font) + Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) + Me.ImeMode = CType(resources.GetObject("$this.ImeMode"), System.Windows.Forms.ImeMode) + Me.Location = CType(resources.GetObject("$this.Location"), System.Drawing.Point) + Me.MaximumSize = CType(resources.GetObject("$this.MaximumSize"), System.Drawing.Size) + Me.MinimumSize = CType(resources.GetObject("$this.MinimumSize"), System.Drawing.Size) + Me.Name = "frmOptions" + Me.RightToLeft = CType(resources.GetObject("$this.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.StartPosition = CType(resources.GetObject("$this.StartPosition"), System.Windows.Forms.FormStartPosition) + Me.Text = resources.GetString("$this.Text") + Me.Visible = CType(resources.GetObject("$this.Visible"), Boolean) + Me.grpShapes.ResumeLayout(False) + Me.ResumeLayout(False) + + End Sub + +#End Region + + ' This code just closes the form, when the user decides to Cancel. + Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click + Me.Close() + End Sub + + ' This code changes the values in the Options object to the new user + ' selected values, and saves it to disk. + Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click + + Dim myOptions As New Options() + + If Me.optEllipses.Checked Then + myOptions.Shape = "Ellipses" + Else + myOptions.Shape = "Rectangles" + End If + + myOptions.IsTransparent = Me.chkTransparent.Checked + myOptions.Speed = Me.cboSpeed.Text + + ' Save the options to disk. + myOptions.SaveOptions() + + ' Close this object. + Me.Close() + + End Sub + + ' This code loads the current user defined options and sets the UI elements + ' in this form to their proper values. + Private Sub frmOptions_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + ' Load the options file. Recall that the load method will + ' always return an options object, even if the file doesn't + ' currently exist + Dim myOptions As New Options() + myOptions.LoadOptions() + + Me.cboSpeed.Text = myOptions.Speed + Me.chkTransparent.Checked = myOptions.IsTransparent + + If myOptions.Shape = "Ellipses" Then + Me.optEllipses.Checked = True + Else + Me.optRectangles.Checked = True + End If + + End Sub + +End Class diff --git a/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/frmSceenSaver.resx b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/frmSceenSaver.resx new file mode 100644 index 0000000..f5366c8 --- /dev/null +++ b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/frmSceenSaver.resx @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + Assembly + + + (Default) + + + True + + + frmSceenSaver + + + 65 + + + Form that will display the screen saver + + + Screen Saver Form + + + Top, Left + + + 5, 13 + + + False + + + 0, 0 + + + 0, 0 + + + + + + 400, 328 + + + None + + + True + + + + + + + + + Inherit + + + 0, 0 + + + 0, 0 + + + 0, 0 + + + Inherit + + + WindowsDefaultLocation + + + + + + False + + + tmrUpdateScreen + + + System.Windows.Forms.Timer, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + frmSceenSaver + + + System.Windows.Forms.Form, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/frmSceenSaver.vb b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/frmSceenSaver.vb new file mode 100644 index 0000000..113ce02 --- /dev/null +++ b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/frmSceenSaver.vb @@ -0,0 +1,259 @@ +Option Strict On + +' This form is the main form for the screen saver. It does all the painting +' of the screen, and handles when it should terminate and release control +' back to Windows. +Public Class frmSceenSaver + Inherits System.Windows.Forms.Form + + ' Declare the class variables that will be used for the Screen + ' Saver. + Private m_Graphics As Graphics ' Graphics object on which to draw + Private m_Random As New Random() ' Random object to support the drawing + ' Options object that contains information about the user selected options + Private m_Options As New Options() + ' Used to for first setting MouseMove location + Private m_IsActive As Boolean = False + ' Used to determine if the Mouse has actually been moved + Private m_MouseLocation As Point + + + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents tmrUpdateScreen As System.Windows.Forms.Timer + Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container() + Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmSceenSaver)) + Me.tmrUpdateScreen = New System.Windows.Forms.Timer(Me.components) + ' + 'tmrUpdateScreen + ' + ' + 'frmSceenSaver + ' + Me.AccessibleDescription = resources.GetString("$this.AccessibleDescription") + Me.AccessibleName = resources.GetString("$this.AccessibleName") + Me.Anchor = CType(resources.GetObject("$this.Anchor"), System.Windows.Forms.AnchorStyles) + Me.AutoScaleBaseSize = CType(resources.GetObject("$this.AutoScaleBaseSize"), System.Drawing.Size) + Me.AutoScroll = CType(resources.GetObject("$this.AutoScroll"), Boolean) + Me.AutoScrollMargin = CType(resources.GetObject("$this.AutoScrollMargin"), System.Drawing.Size) + Me.AutoScrollMinSize = CType(resources.GetObject("$this.AutoScrollMinSize"), System.Drawing.Size) + Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image) + Me.ClientSize = CType(resources.GetObject("$this.ClientSize"), System.Drawing.Size) + Me.ControlBox = False + Me.Dock = CType(resources.GetObject("$this.Dock"), System.Windows.Forms.DockStyle) + Me.Enabled = CType(resources.GetObject("$this.Enabled"), Boolean) + Me.Font = CType(resources.GetObject("$this.Font"), System.Drawing.Font) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None + Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) + Me.ImeMode = CType(resources.GetObject("$this.ImeMode"), System.Windows.Forms.ImeMode) + Me.Location = CType(resources.GetObject("$this.Location"), System.Drawing.Point) + Me.MaximizeBox = False + Me.MaximumSize = CType(resources.GetObject("$this.MaximumSize"), System.Drawing.Size) + Me.MinimizeBox = False + Me.MinimumSize = CType(resources.GetObject("$this.MinimumSize"), System.Drawing.Size) + Me.Name = "frmSceenSaver" + Me.RightToLeft = CType(resources.GetObject("$this.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.ShowInTaskbar = False + Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide + Me.StartPosition = CType(resources.GetObject("$this.StartPosition"), System.Windows.Forms.FormStartPosition) + Me.Text = resources.GetString("$this.Text") + Me.TopMost = True + Me.Visible = CType(resources.GetObject("$this.Visible"), Boolean) + Me.WindowState = System.Windows.Forms.FormWindowState.Maximized + + End Sub + +#End Region + + ' Close the screen saver when the user moves the mouse. Unfortunately, the + ' MouseMove event is fired by some very trivial moves of the mouse, so + ' instead, verify that the mouse has actually been moved by at least + ' a few pixels before exiting. + Private Sub frmSceenSaver_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove + + ' If the MouseLocation still points to 0,0, move it to its actual location + ' and save the location for later. Otherwise, check to see if the user + ' has moved the mouse at least 10 pixels. + If Not m_IsActive Then + Me.m_MouseLocation = New Point(e.X, e.Y) + m_IsActive = True + Else + If Math.Abs(e.X - Me.m_MouseLocation.X) > 10 Or _ + Math.Abs(e.Y - Me.m_MouseLocation.Y) > 10 Then + ' The user has moved the mouse so leave this program + Application.Exit() + End If + End If + End Sub + + ' This subroutine initializes the Screen Saver form when it is loaded + Private Sub frmSceenSaver_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + ' Create the Graphics object to use when drawing. + Me.m_Graphics = Me.CreateGraphics() + + ' Load the Saved options. Remember that if no Options file exists, one + ' will be created. + m_Options.LoadOptions() + + ' Set the speed based on the user defined Options. + Select Case m_Options.Speed + Case "Slow" + Me.tmrUpdateScreen.Interval = 500 + Case "Fast" + Me.tmrUpdateScreen.Interval = 100 + Case Else + Me.tmrUpdateScreen.Interval = 200 + End Select + + ' Enable the timer. + Me.tmrUpdateScreen.Enabled = True + + End Sub + + ' The subroutine causes the screen saver to close if the user + ' pushes a mouse button. + Private Sub frmSceenSaver_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown + Application.Exit() + End Sub + + ' This code is executed whenever the timer tick event if fired. It draws + ' a shape to the screen. + Private Sub tmrUpdateScreen_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrUpdateScreen.Tick + DrawShape() + End Sub + + ' --- Class Methods --- + + ' This subroutine just draws a randomly colored, randomly sized, shapes to + ' the screen, based on some user defined parameters. + Private Sub DrawShape() + + ' Get the largest possible values for the screen + Dim maxX As Integer = Me.Width + Dim maxY As Integer = Me.Height + + Dim x1, x2, y1, y2 As Integer ' Coordinates of random points + Dim myRect As Rectangle ' Rectangle to paint the shapes + Dim myColor As Color ' Color used to paint the shapes + + ' Generate some random numbers to use as coordinates + x1 = m_Random.Next(0, maxX) + x2 = m_Random.Next(0, maxX) + + y1 = m_Random.Next(0, maxY) + y2 = m_Random.Next(0, maxY) + + ' Create a rectangle based on the randomly generated coordinates + myRect = New Rectangle(Math.Min(x1, x2), Math.Min(y1, y2), _ + Math.Abs(x1 - x2), Math.Abs(y1 - y2)) + + + ' Get a random color. If the user wants transparency then allow the + ' transparency to be randomly generated as well. If not, then set the + ' Alpha to 255 (the max). + If m_Options.IsTransparent Then + myColor = Color.FromArgb(m_Random.Next(255), m_Random.Next(255), _ + m_Random.Next(255), m_Random.Next(255)) + Else + myColor = Color.FromArgb(255, m_Random.Next(255), _ + m_Random.Next(255), m_Random.Next(255)) + End If + + ' Draw an Ellipse or rectangle based on User defined options. + If m_Options.Shape = "Ellipses" Then + m_Graphics.FillEllipse(New SolidBrush(myColor), myRect) + Else + m_Graphics.FillRectangle(New SolidBrush(myColor), myRect) + End If + End Sub + + ' This sub is the first one that executes when the Screen Saver + ' program is run. Since Windows will pass parameters to the this + ' program whenever a user is setting up the screen saver using the + ' Display Properties -> Screen Saver property screen. + Shared Sub Main(ByVal args As String()) + + ' Check to see if there were any passed arguments. If not, then + ' the user simply double-clicked on the .scr file. + If args.Length > 0 Then + ' This means we have some passed arguments. Windows will + ' automatically pass a "/s", "/p" or a "/c" depending + ' on how the screen saver should behave. The meanings for each + ' of these parameters is seen below. + + ' Check to see if the Screen saver should preview. + If args(0).ToLower = "/p" Then + ' This functionality is not implemented here because it involves + ' creating and joining threads and is beyond the scope of this + ' How-To. + + ' Simply exit the application + Application.Exit() + End If + + ' Check to see if the Screen saver should show user definable options. + If args(0).ToLower.Trim().Substring(0, 2) = "/c" Then + ' Create a frmOptions form and display it. + Dim userOptionsForm As New frmOptions() + userOptionsForm.ShowDialog() + + ' Exit the application. + Application.Exit() + End If + + ' Check to see if the Screen saver should simply execute + If args(0).ToLower = "/s" Then + + ' Create a frmSceenSaver form and display it. + Dim screenSaverForm As New ScreenSaver.frmSceenSaver() + screenSaverForm.ShowDialog() + + ' Exit the application when the form is closed + Application.Exit() + End If + + + Else + ' Fire up the Screen saver. Note: This is only used when the user + ' double clicks on the EXE, since otherwise windows passes a + ' parameter to the application. + + ' Create a frmSceenSaver form and display it. + Dim screenSaverForm As New ScreenSaver.frmSceenSaver() + screenSaverForm.ShowDialog() + + ' Exit the application when the form is closed + Application.Exit() + End If + End Sub + +End Class diff --git a/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/obj/Debug/ScreenSaver.frmOptions.resources b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/obj/Debug/ScreenSaver.frmOptions.resources new file mode 100644 index 0000000..1cb98b7 Binary files /dev/null and b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/obj/Debug/ScreenSaver.frmOptions.resources differ diff --git a/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/obj/Debug/ScreenSaver.frmSceenSaver.resources b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/obj/Debug/ScreenSaver.frmSceenSaver.resources new file mode 100644 index 0000000..f2679a3 Binary files /dev/null and b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/obj/Debug/ScreenSaver.frmSceenSaver.resources differ diff --git a/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/obj/Debug/VB_NET How-To ScreenSaver.exe b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/obj/Debug/VB_NET How-To ScreenSaver.exe new file mode 100644 index 0000000..3cd08aa Binary files /dev/null and b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/obj/Debug/VB_NET How-To ScreenSaver.exe differ diff --git a/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/obj/Debug/VB_NET How-To ScreenSaver.pdb b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/obj/Debug/VB_NET How-To ScreenSaver.pdb new file mode 100644 index 0000000..7a7fb2b Binary files /dev/null and b/Ch7 - Screensaver/VB.NET How-To ScreenSaver Project/obj/Debug/VB_NET How-To ScreenSaver.pdb differ diff --git a/Ch7 - Screensaver/VB_NET How-To ScreenSaver.scr b/Ch7 - Screensaver/VB_NET How-To ScreenSaver.scr new file mode 100644 index 0000000..1e0280f Binary files /dev/null and b/Ch7 - Screensaver/VB_NET How-To ScreenSaver.scr differ diff --git a/Ch7 - Screensaver/bin/VB.NET How-To Creating a Screensaver Using GDI+.exe b/Ch7 - Screensaver/bin/VB.NET How-To Creating a Screensaver Using GDI+.exe new file mode 100644 index 0000000..bda81a1 Binary files /dev/null and b/Ch7 - Screensaver/bin/VB.NET How-To Creating a Screensaver Using GDI+.exe differ diff --git a/Ch7 - Screensaver/bin/VB.NET How-To Creating a Screensaver Using GDI+.pdb b/Ch7 - Screensaver/bin/VB.NET How-To Creating a Screensaver Using GDI+.pdb new file mode 100644 index 0000000..33684ea Binary files /dev/null and b/Ch7 - Screensaver/bin/VB.NET How-To Creating a Screensaver Using GDI+.pdb differ diff --git a/Ch7 - Screensaver/frmAbout.resx b/Ch7 - Screensaver/frmAbout.resx new file mode 100644 index 0000000..ab4ea8f --- /dev/null +++ b/Ch7 - Screensaver/frmAbout.resx @@ -0,0 +1,657 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + + + + + + + Top, Left + + + + + + None + + + True + + + + + + + + + NoControl + + + 16, 16 + + + Inherit + + + 32, 32 + + + StretchImage + + + 0 + + + + + + True + + + pbIcon + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 6 + + + Assembly + + + + + + + + + Top, Left + + + False + + + None + + + True + + + + + + + + + MiddleCenter + + + -1 + + + NoControl + + + 72, 16 + + + Inherit + + + 360, 23 + + + 1 + + + Application Title + + + TopLeft + + + True + + + lblTitle + + + System.Windows.Forms.Label, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 5 + + + Assembly + + + + + + + + + Top, Left + + + False + + + None + + + True + + + + + + + + + MiddleCenter + + + -1 + + + NoControl + + + 72, 40 + + + Inherit + + + 360, 23 + + + 2 + + + Application Version + + + TopLeft + + + True + + + lblVersion + + + System.Windows.Forms.Label, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 4 + + + Assembly + + + + + + + + + Top, Left + + + False + + + None + + + True + + + + + + + + + MiddleCenter + + + -1 + + + NoControl + + + 72, 80 + + + Inherit + + + 360, 46 + + + 3 + + + Application Description + + + TopLeft + + + True + + + lblDescription + + + System.Windows.Forms.Label, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 3 + + + Assembly + + + + + + + + + Top, Left + + + + + + None + + + True + + + Standard + + + + + + + + + MiddleCenter + + + -1 + + + NoControl + + + 352, 200 + + + Inherit + + + 75, 23 + + + 4 + + + OK + + + MiddleCenter + + + True + + + cmdOK + + + System.Windows.Forms.Button, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + + + Assembly + + + + + + + + + Top, Left + + + False + + + None + + + True + + + + + + + + + MiddleCenter + + + -1 + + + NoControl + + + 72, 56 + + + Inherit + + + 360, 23 + + + 5 + + + Application Copyright + + + TopLeft + + + True + + + lblCopyright + + + System.Windows.Forms.Label, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + Assembly + + + + + + + + + Top, Left + + + False + + + None + + + True + + + + + + + + + MiddleCenter + + + -1 + + + NoControl + + + 72, 128 + + + Inherit + + + 360, 64 + + + 6 + + + Application Codebase + + + TopLeft + + + True + + + lblCodebase + + + System.Windows.Forms.Label, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + (Default) + + + frmAbout + + + True + + + + + + + + + Top, Left + + + 5, 13 + + + False + + + 0, 0 + + + 0, 0 + + + + + + 440, 232 + + + None + + + True + + + + + + + + + Inherit + + + 0, 0 + + + 0, 0 + + + 0, 0 + + + Inherit + + + CenterParent + + + About ... + + + False + + + frmAbout + + + System.Windows.Forms.Form, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Ch7 - Screensaver/frmAbout.vb b/Ch7 - Screensaver/frmAbout.vb new file mode 100644 index 0000000..e508b27 --- /dev/null +++ b/Ch7 - Screensaver/frmAbout.vb @@ -0,0 +1,285 @@ +'Copyright (C) 2002 Microsoft Corporation +'All rights reserved. +'THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +'EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF +'MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +'Requires the Trial or Release version of Visual Studio .NET Professional (or greater). + +Option Strict On + +Public Class frmAbout + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents pbIcon As System.Windows.Forms.PictureBox + Friend WithEvents lblTitle As System.Windows.Forms.Label + Friend WithEvents lblVersion As System.Windows.Forms.Label + Friend WithEvents lblDescription As System.Windows.Forms.Label + Friend WithEvents cmdOK As System.Windows.Forms.Button + Friend WithEvents lblCopyright As System.Windows.Forms.Label + Friend WithEvents lblCodebase As System.Windows.Forms.Label + Private Sub InitializeComponent() + Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmAbout)) + Me.pbIcon = New System.Windows.Forms.PictureBox() + Me.lblTitle = New System.Windows.Forms.Label() + Me.lblVersion = New System.Windows.Forms.Label() + Me.lblDescription = New System.Windows.Forms.Label() + Me.cmdOK = New System.Windows.Forms.Button() + Me.lblCopyright = New System.Windows.Forms.Label() + Me.lblCodebase = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'pbIcon + ' + Me.pbIcon.AccessibleDescription = CType(resources.GetObject("pbIcon.AccessibleDescription"), String) + Me.pbIcon.AccessibleName = CType(resources.GetObject("pbIcon.AccessibleName"), String) + Me.pbIcon.Anchor = CType(resources.GetObject("pbIcon.Anchor"), System.Windows.Forms.AnchorStyles) + Me.pbIcon.BackgroundImage = CType(resources.GetObject("pbIcon.BackgroundImage"), System.Drawing.Image) + Me.pbIcon.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D + Me.pbIcon.Dock = CType(resources.GetObject("pbIcon.Dock"), System.Windows.Forms.DockStyle) + Me.pbIcon.Enabled = CType(resources.GetObject("pbIcon.Enabled"), Boolean) + Me.pbIcon.Font = CType(resources.GetObject("pbIcon.Font"), System.Drawing.Font) + Me.pbIcon.Image = CType(resources.GetObject("pbIcon.Image"), System.Drawing.Image) + Me.pbIcon.ImeMode = CType(resources.GetObject("pbIcon.ImeMode"), System.Windows.Forms.ImeMode) + Me.pbIcon.Location = CType(resources.GetObject("pbIcon.Location"), System.Drawing.Point) + Me.pbIcon.Name = "pbIcon" + Me.pbIcon.RightToLeft = CType(resources.GetObject("pbIcon.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.pbIcon.Size = CType(resources.GetObject("pbIcon.Size"), System.Drawing.Size) + Me.pbIcon.SizeMode = CType(resources.GetObject("pbIcon.SizeMode"), System.Windows.Forms.PictureBoxSizeMode) + Me.pbIcon.TabIndex = CType(resources.GetObject("pbIcon.TabIndex"), Integer) + Me.pbIcon.TabStop = False + Me.pbIcon.Text = resources.GetString("pbIcon.Text") + Me.pbIcon.Visible = CType(resources.GetObject("pbIcon.Visible"), Boolean) + ' + 'lblTitle + ' + Me.lblTitle.AccessibleDescription = CType(resources.GetObject("lblTitle.AccessibleDescription"), String) + Me.lblTitle.AccessibleName = CType(resources.GetObject("lblTitle.AccessibleName"), String) + Me.lblTitle.Anchor = CType(resources.GetObject("lblTitle.Anchor"), System.Windows.Forms.AnchorStyles) + Me.lblTitle.AutoSize = CType(resources.GetObject("lblTitle.AutoSize"), Boolean) + Me.lblTitle.Dock = CType(resources.GetObject("lblTitle.Dock"), System.Windows.Forms.DockStyle) + Me.lblTitle.Enabled = CType(resources.GetObject("lblTitle.Enabled"), Boolean) + Me.lblTitle.Font = CType(resources.GetObject("lblTitle.Font"), System.Drawing.Font) + Me.lblTitle.Image = CType(resources.GetObject("lblTitle.Image"), System.Drawing.Image) + Me.lblTitle.ImageAlign = CType(resources.GetObject("lblTitle.ImageAlign"), System.Drawing.ContentAlignment) + Me.lblTitle.ImageIndex = CType(resources.GetObject("lblTitle.ImageIndex"), Integer) + Me.lblTitle.ImeMode = CType(resources.GetObject("lblTitle.ImeMode"), System.Windows.Forms.ImeMode) + Me.lblTitle.Location = CType(resources.GetObject("lblTitle.Location"), System.Drawing.Point) + Me.lblTitle.Name = "lblTitle" + Me.lblTitle.RightToLeft = CType(resources.GetObject("lblTitle.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.lblTitle.Size = CType(resources.GetObject("lblTitle.Size"), System.Drawing.Size) + Me.lblTitle.TabIndex = CType(resources.GetObject("lblTitle.TabIndex"), Integer) + Me.lblTitle.Text = resources.GetString("lblTitle.Text") + Me.lblTitle.TextAlign = CType(resources.GetObject("lblTitle.TextAlign"), System.Drawing.ContentAlignment) + Me.lblTitle.Visible = CType(resources.GetObject("lblTitle.Visible"), Boolean) + ' + 'lblVersion + ' + Me.lblVersion.AccessibleDescription = CType(resources.GetObject("lblVersion.AccessibleDescription"), String) + Me.lblVersion.AccessibleName = CType(resources.GetObject("lblVersion.AccessibleName"), String) + Me.lblVersion.Anchor = CType(resources.GetObject("lblVersion.Anchor"), System.Windows.Forms.AnchorStyles) + Me.lblVersion.AutoSize = CType(resources.GetObject("lblVersion.AutoSize"), Boolean) + Me.lblVersion.Dock = CType(resources.GetObject("lblVersion.Dock"), System.Windows.Forms.DockStyle) + Me.lblVersion.Enabled = CType(resources.GetObject("lblVersion.Enabled"), Boolean) + Me.lblVersion.Font = CType(resources.GetObject("lblVersion.Font"), System.Drawing.Font) + Me.lblVersion.Image = CType(resources.GetObject("lblVersion.Image"), System.Drawing.Image) + Me.lblVersion.ImageAlign = CType(resources.GetObject("lblVersion.ImageAlign"), System.Drawing.ContentAlignment) + Me.lblVersion.ImageIndex = CType(resources.GetObject("lblVersion.ImageIndex"), Integer) + Me.lblVersion.ImeMode = CType(resources.GetObject("lblVersion.ImeMode"), System.Windows.Forms.ImeMode) + Me.lblVersion.Location = CType(resources.GetObject("lblVersion.Location"), System.Drawing.Point) + Me.lblVersion.Name = "lblVersion" + Me.lblVersion.RightToLeft = CType(resources.GetObject("lblVersion.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.lblVersion.Size = CType(resources.GetObject("lblVersion.Size"), System.Drawing.Size) + Me.lblVersion.TabIndex = CType(resources.GetObject("lblVersion.TabIndex"), Integer) + Me.lblVersion.Text = resources.GetString("lblVersion.Text") + Me.lblVersion.TextAlign = CType(resources.GetObject("lblVersion.TextAlign"), System.Drawing.ContentAlignment) + Me.lblVersion.Visible = CType(resources.GetObject("lblVersion.Visible"), Boolean) + ' + 'lblDescription + ' + Me.lblDescription.AccessibleDescription = CType(resources.GetObject("lblDescription.AccessibleDescription"), String) + Me.lblDescription.AccessibleName = CType(resources.GetObject("lblDescription.AccessibleName"), String) + Me.lblDescription.Anchor = CType(resources.GetObject("lblDescription.Anchor"), System.Windows.Forms.AnchorStyles) + Me.lblDescription.AutoSize = CType(resources.GetObject("lblDescription.AutoSize"), Boolean) + Me.lblDescription.Dock = CType(resources.GetObject("lblDescription.Dock"), System.Windows.Forms.DockStyle) + Me.lblDescription.Enabled = CType(resources.GetObject("lblDescription.Enabled"), Boolean) + Me.lblDescription.Font = CType(resources.GetObject("lblDescription.Font"), System.Drawing.Font) + Me.lblDescription.Image = CType(resources.GetObject("lblDescription.Image"), System.Drawing.Image) + Me.lblDescription.ImageAlign = CType(resources.GetObject("lblDescription.ImageAlign"), System.Drawing.ContentAlignment) + Me.lblDescription.ImageIndex = CType(resources.GetObject("lblDescription.ImageIndex"), Integer) + Me.lblDescription.ImeMode = CType(resources.GetObject("lblDescription.ImeMode"), System.Windows.Forms.ImeMode) + Me.lblDescription.Location = CType(resources.GetObject("lblDescription.Location"), System.Drawing.Point) + Me.lblDescription.Name = "lblDescription" + Me.lblDescription.RightToLeft = CType(resources.GetObject("lblDescription.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.lblDescription.Size = CType(resources.GetObject("lblDescription.Size"), System.Drawing.Size) + Me.lblDescription.TabIndex = CType(resources.GetObject("lblDescription.TabIndex"), Integer) + Me.lblDescription.Text = resources.GetString("lblDescription.Text") + Me.lblDescription.TextAlign = CType(resources.GetObject("lblDescription.TextAlign"), System.Drawing.ContentAlignment) + Me.lblDescription.Visible = CType(resources.GetObject("lblDescription.Visible"), Boolean) + ' + 'cmdOK + ' + Me.cmdOK.AccessibleDescription = CType(resources.GetObject("cmdOK.AccessibleDescription"), String) + Me.cmdOK.AccessibleName = CType(resources.GetObject("cmdOK.AccessibleName"), String) + Me.cmdOK.Anchor = CType(resources.GetObject("cmdOK.Anchor"), System.Windows.Forms.AnchorStyles) + Me.cmdOK.BackgroundImage = CType(resources.GetObject("cmdOK.BackgroundImage"), System.Drawing.Image) + Me.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK + Me.cmdOK.Dock = CType(resources.GetObject("cmdOK.Dock"), System.Windows.Forms.DockStyle) + Me.cmdOK.Enabled = CType(resources.GetObject("cmdOK.Enabled"), Boolean) + Me.cmdOK.FlatStyle = CType(resources.GetObject("cmdOK.FlatStyle"), System.Windows.Forms.FlatStyle) + Me.cmdOK.Font = CType(resources.GetObject("cmdOK.Font"), System.Drawing.Font) + Me.cmdOK.Image = CType(resources.GetObject("cmdOK.Image"), System.Drawing.Image) + Me.cmdOK.ImageAlign = CType(resources.GetObject("cmdOK.ImageAlign"), System.Drawing.ContentAlignment) + Me.cmdOK.ImageIndex = CType(resources.GetObject("cmdOK.ImageIndex"), Integer) + Me.cmdOK.ImeMode = CType(resources.GetObject("cmdOK.ImeMode"), System.Windows.Forms.ImeMode) + Me.cmdOK.Location = CType(resources.GetObject("cmdOK.Location"), System.Drawing.Point) + Me.cmdOK.Name = "cmdOK" + Me.cmdOK.RightToLeft = CType(resources.GetObject("cmdOK.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.cmdOK.Size = CType(resources.GetObject("cmdOK.Size"), System.Drawing.Size) + Me.cmdOK.TabIndex = CType(resources.GetObject("cmdOK.TabIndex"), Integer) + Me.cmdOK.Text = resources.GetString("cmdOK.Text") + Me.cmdOK.TextAlign = CType(resources.GetObject("cmdOK.TextAlign"), System.Drawing.ContentAlignment) + Me.cmdOK.Visible = CType(resources.GetObject("cmdOK.Visible"), Boolean) + ' + 'lblCopyright + ' + Me.lblCopyright.AccessibleDescription = CType(resources.GetObject("lblCopyright.AccessibleDescription"), String) + Me.lblCopyright.AccessibleName = CType(resources.GetObject("lblCopyright.AccessibleName"), String) + Me.lblCopyright.Anchor = CType(resources.GetObject("lblCopyright.Anchor"), System.Windows.Forms.AnchorStyles) + Me.lblCopyright.AutoSize = CType(resources.GetObject("lblCopyright.AutoSize"), Boolean) + Me.lblCopyright.Dock = CType(resources.GetObject("lblCopyright.Dock"), System.Windows.Forms.DockStyle) + Me.lblCopyright.Enabled = CType(resources.GetObject("lblCopyright.Enabled"), Boolean) + Me.lblCopyright.Font = CType(resources.GetObject("lblCopyright.Font"), System.Drawing.Font) + Me.lblCopyright.Image = CType(resources.GetObject("lblCopyright.Image"), System.Drawing.Image) + Me.lblCopyright.ImageAlign = CType(resources.GetObject("lblCopyright.ImageAlign"), System.Drawing.ContentAlignment) + Me.lblCopyright.ImageIndex = CType(resources.GetObject("lblCopyright.ImageIndex"), Integer) + Me.lblCopyright.ImeMode = CType(resources.GetObject("lblCopyright.ImeMode"), System.Windows.Forms.ImeMode) + Me.lblCopyright.Location = CType(resources.GetObject("lblCopyright.Location"), System.Drawing.Point) + Me.lblCopyright.Name = "lblCopyright" + Me.lblCopyright.RightToLeft = CType(resources.GetObject("lblCopyright.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.lblCopyright.Size = CType(resources.GetObject("lblCopyright.Size"), System.Drawing.Size) + Me.lblCopyright.TabIndex = CType(resources.GetObject("lblCopyright.TabIndex"), Integer) + Me.lblCopyright.Text = resources.GetString("lblCopyright.Text") + Me.lblCopyright.TextAlign = CType(resources.GetObject("lblCopyright.TextAlign"), System.Drawing.ContentAlignment) + Me.lblCopyright.Visible = CType(resources.GetObject("lblCopyright.Visible"), Boolean) + ' + 'lblCodebase + ' + Me.lblCodebase.AccessibleDescription = CType(resources.GetObject("lblCodebase.AccessibleDescription"), String) + Me.lblCodebase.AccessibleName = CType(resources.GetObject("lblCodebase.AccessibleName"), String) + Me.lblCodebase.Anchor = CType(resources.GetObject("lblCodebase.Anchor"), System.Windows.Forms.AnchorStyles) + Me.lblCodebase.AutoSize = CType(resources.GetObject("lblCodebase.AutoSize"), Boolean) + Me.lblCodebase.Dock = CType(resources.GetObject("lblCodebase.Dock"), System.Windows.Forms.DockStyle) + Me.lblCodebase.Enabled = CType(resources.GetObject("lblCodebase.Enabled"), Boolean) + Me.lblCodebase.Font = CType(resources.GetObject("lblCodebase.Font"), System.Drawing.Font) + Me.lblCodebase.Image = CType(resources.GetObject("lblCodebase.Image"), System.Drawing.Image) + Me.lblCodebase.ImageAlign = CType(resources.GetObject("lblCodebase.ImageAlign"), System.Drawing.ContentAlignment) + Me.lblCodebase.ImageIndex = CType(resources.GetObject("lblCodebase.ImageIndex"), Integer) + Me.lblCodebase.ImeMode = CType(resources.GetObject("lblCodebase.ImeMode"), System.Windows.Forms.ImeMode) + Me.lblCodebase.Location = CType(resources.GetObject("lblCodebase.Location"), System.Drawing.Point) + Me.lblCodebase.Name = "lblCodebase" + Me.lblCodebase.RightToLeft = CType(resources.GetObject("lblCodebase.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.lblCodebase.Size = CType(resources.GetObject("lblCodebase.Size"), System.Drawing.Size) + Me.lblCodebase.TabIndex = CType(resources.GetObject("lblCodebase.TabIndex"), Integer) + Me.lblCodebase.Text = resources.GetString("lblCodebase.Text") + Me.lblCodebase.TextAlign = CType(resources.GetObject("lblCodebase.TextAlign"), System.Drawing.ContentAlignment) + Me.lblCodebase.Visible = CType(resources.GetObject("lblCodebase.Visible"), Boolean) + ' + 'frmAbout + ' + Me.AcceptButton = Me.cmdOK + Me.AccessibleDescription = CType(resources.GetObject("$this.AccessibleDescription"), String) + Me.AccessibleName = CType(resources.GetObject("$this.AccessibleName"), String) + Me.Anchor = CType(resources.GetObject("$this.Anchor"), System.Windows.Forms.AnchorStyles) + Me.AutoScaleBaseSize = CType(resources.GetObject("$this.AutoScaleBaseSize"), System.Drawing.Size) + Me.AutoScroll = CType(resources.GetObject("$this.AutoScroll"), Boolean) + Me.AutoScrollMargin = CType(resources.GetObject("$this.AutoScrollMargin"), System.Drawing.Size) + Me.AutoScrollMinSize = CType(resources.GetObject("$this.AutoScrollMinSize"), System.Drawing.Size) + Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image) + Me.CancelButton = Me.cmdOK + Me.ClientSize = CType(resources.GetObject("$this.ClientSize"), System.Drawing.Size) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.lblCodebase, Me.lblCopyright, Me.cmdOK, Me.lblDescription, Me.lblVersion, Me.lblTitle, Me.pbIcon}) + Me.Dock = CType(resources.GetObject("$this.Dock"), System.Windows.Forms.DockStyle) + Me.Enabled = CType(resources.GetObject("$this.Enabled"), Boolean) + Me.Font = CType(resources.GetObject("$this.Font"), System.Drawing.Font) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog + Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) + Me.ImeMode = CType(resources.GetObject("$this.ImeMode"), System.Windows.Forms.ImeMode) + Me.Location = CType(resources.GetObject("$this.Location"), System.Drawing.Point) + Me.MaximizeBox = False + Me.MaximumSize = CType(resources.GetObject("$this.MaximumSize"), System.Drawing.Size) + Me.MinimizeBox = False + Me.MinimumSize = CType(resources.GetObject("$this.MinimumSize"), System.Drawing.Size) + Me.Name = "frmAbout" + Me.RightToLeft = CType(resources.GetObject("$this.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.ShowInTaskbar = False + Me.StartPosition = CType(resources.GetObject("$this.StartPosition"), System.Windows.Forms.FormStartPosition) + Me.Text = resources.GetString("$this.Text") + Me.Visible = CType(resources.GetObject("$this.Visible"), Boolean) + Me.ResumeLayout(False) + + End Sub + +#End Region + + ' Note: Because this form is opened by frmMain using the ShowDialog command, we simply set the + ' DialogResult property of cmdOK to OK which causes the form to close when clicked. + Private Sub frmAbout_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + Try + ' Set this Form's Text & Icon properties by using values from the parent form + Me.Text = "About " & Me.Owner.Text + Me.Icon = Me.Owner.Icon + + ' Set this Form's Picture Box's image using the parent's icon + ' However, we need to convert it to a Bitmap since the Picture Box Control + ' will not accept a raw Icon. + Me.pbIcon.Image = Me.Owner.Icon.ToBitmap() + + ' Set the labels identitying the Title, Version, and Description by + ' reading Assembly meta-data originally entered in the AssemblyInfo.vb file + ' using the AssemblyInfo class defined in the same file + Dim ainfo As New AssemblyInfo() + + Me.lblTitle.Text = ainfo.Title + Me.lblVersion.Text = String.Format("Version {0}", ainfo.Version) + Me.lblCopyright.Text = ainfo.Copyright + Me.lblDescription.Text = ainfo.Description + Me.lblCodebase.Text = ainfo.CodeBase + + Catch exp As System.Exception + ' This catch will trap any unexpected error. + MessageBox.Show(exp.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop) + + End Try + End Sub + + +End Class diff --git a/Ch7 - Screensaver/frmMain.resx b/Ch7 - Screensaver/frmMain.resx new file mode 100644 index 0000000..821168b --- /dev/null +++ b/Ch7 - Screensaver/frmMain.resx @@ -0,0 +1,520 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + Assembly + + + Inherit + + + Assembly + + + True + + + None + + + True + + + &File + + + True + + + Assembly + + + True + + + None + + + True + + + E&xit + + + True + + + Assembly + + + True + + + None + + + True + + + &Help + + + True + + + Assembly + + + True + + + None + + + True + + + Text Comes from AssemblyInfo + + + True + + + Assembly + + + + + + + + + Top, Left + + + False + + + None + + + True + + + Microsoft Sans Serif, 14pt + + + + + + MiddleCenter + + + -1 + + + Inherit + + + 8, 8 + + + Inherit + + + 440, 136 + + + 0 + + + To install the demo screen saver on your machine, click the Install button. Then go to your Display Properties window, Screen Saver section, and select "VB.NET How-To ScreenSaver" as your current screensaver. + + + TopLeft + + + True + + + Label1 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + + + Assembly + + + Button that installs the screen saver. + + + Install Button + + + Top, Left + + + + + + None + + + True + + + Standard + + + Microsoft Sans Serif, 14pt, style=Bold + + + + + + MiddleCenter + + + -1 + + + Inherit + + + 144, 168 + + + Inherit + + + 168, 48 + + + 1 + + + &Install! + + + MiddleCenter + + + True + + + btnInstall + + + System.Windows.Forms.Button, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + Assembly + + + Button that closes the application. + + + Close button + + + Top, Left + + + + + + None + + + True + + + Standard + + + + + + + + + MiddleCenter + + + -1 + + + Inherit + + + 368, 216 + + + Inherit + + + 75, 23 + + + 2 + + + &Close + + + MiddleCenter + + + True + + + btnClose + + + System.Windows.Forms.Button, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + (Default) + + + True + + + frmMain + + + + + + + + + Top, Left + + + 6, 16 + + + False + + + 0, 0 + + + 0, 0 + + + + + + 458, 251 + + + None + + + True + + + Microsoft Sans Serif, 10pt + + + + AAABAAIAICAQAAAAAADoAgAAJgAAABAQEAAAAAAAKAEAAA4DAAAoAAAAIAAAAEAAAAABAAQAAAAAAIAC + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAICAgADAwMAAAAD/AAD/ + AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAzMzMzAAAAAAAAAAAAAAAzu7 + u7u7szMAAAAAAAAAAD/7szMzAAAzMwAAAAAAAAA78zu7u7szADMAAAAAAAAAAz/7MzAAAzMAAAAAAAAA + AAADM/u7MzAAAAAAAAAAAAAAAAAwMzAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAzMAAAAAAAAA + AAAAAAAAAzuzMzMwAAAAAAAAAAAAAzuzAAAAAzAAAAAAAAAAADu7AFVmZVADMAAAAAAAAAP7MHd2VVZm + YDMAAAAAAAAAMwd4dohlZlUDMAAAAAAAAAB4LX7u5lVmUDAAAAAAAAAGctInftjmV1cDAAAAAAAABi0i + Lu3uImV3AwAAAAAAAN7t7u7e3iIld1AwAAAAAADe3n7t7u0ihlZQMAAAAAAAbe5+3u7i0tJlYDAAAAAA + AG2u7f7+4i0ihWAwAAAAAABnrt9/7+LScoVgMAAAAAAA2t6O9/79In5mUDMAAAAAAGqt7+9/fuqndlCz + AAAAAAAGp+7+9/6qrYYDswAAAAAABt7e5393qtp2CzAAAAAAAABu597u7t2ocLswAAAAAAAABt7t7u3q + dwOzAAAAAAAAAABm7t3e5mA/swAAAAAAAAAAAG1mbdAAPzAAAAAAAAAAAAAAAAAAAAMAAAAA/4AD//4A + AP/8AAB//AAAf/wAAH/+AAD//4AD///wH////H///+Af//+AB//+AAH//AAA//gAAH/8AAA//gAAP/4A + AB/+AAAf/AAAD/wAAA/8AAAP/AAAD/wAAA/8AAAP/AAAD/4AAA/+AAAf/wAAH/+AAD//wAA///Acf/// + /v8oAAAAEAAAACAAAAABAAQAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAA + AACAAIAAgIAAAICAgADAwMAAAAD/AAD/AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAAP7MzMz + AAAAADO7MwAAAAAAADMwAAAAAAAAAwAAAAAAAAMzMAAAAAAAOzADMAAAAAOwZmAzAAAAAwLujQMwAAAN + 7t7ScDAAAAZ+7eVgMAAABt7f1nCDAAAGrf/l0LMAAABu3u1gswAAAAbt1gswAAAAAIZoMwAA8A8AAOAH + AADwDwAA/D8AAP5/AAD4HwAA8A8AAOAHAADgAwAA4AMAAOADAADgAwAA4AMAAPADAAD4BwAA/A8AAA== + + + + Inherit + + + 0, 0 + + + 0, 0 + + + 0, 0 + + + Inherit + + + CenterScreen + + + Title Comes from Assembly Info + + + False + + + mnuMain + + + System.Windows.Forms.MainMenu, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + mnuFile + + + System.Windows.Forms.MenuItem, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + mnuExit + + + System.Windows.Forms.MenuItem, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + mnuHelp + + + System.Windows.Forms.MenuItem, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + mnuAbout + + + System.Windows.Forms.MenuItem, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + frmMain + + + System.Windows.Forms.Form, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Ch7 - Screensaver/frmMain.vb b/Ch7 - Screensaver/frmMain.vb new file mode 100644 index 0000000..2e2cb61 --- /dev/null +++ b/Ch7 - Screensaver/frmMain.vb @@ -0,0 +1,260 @@ +'Copyright (C) 2002 Microsoft Corporation +'All rights reserved. +'THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +'EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF +'MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +'Requires the Trial or Release version of Visual Studio .NET Professional (or greater). + +Option Strict On + +Imports System.IO + +Public Class frmMain + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + ' So that we only need to set the title of the application once, + ' we use the AssemblyInfo class (defined in the AssemblyInfo.vb file) + ' to read the AssemblyTitle attribute. + Dim ainfo As New AssemblyInfo() + + Me.Text = ainfo.Title + Me.mnuAbout.Text = String.Format("&About {0} ...", ainfo.Title) + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents mnuMain As System.Windows.Forms.MainMenu + Friend WithEvents mnuFile As System.Windows.Forms.MenuItem + Friend WithEvents mnuExit As System.Windows.Forms.MenuItem + Friend WithEvents mnuHelp As System.Windows.Forms.MenuItem + Friend WithEvents mnuAbout As System.Windows.Forms.MenuItem + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents btnInstall As System.Windows.Forms.Button + Friend WithEvents btnClose As System.Windows.Forms.Button + Private Sub InitializeComponent() + Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmMain)) + Me.mnuMain = New System.Windows.Forms.MainMenu() + Me.mnuFile = New System.Windows.Forms.MenuItem() + Me.mnuExit = New System.Windows.Forms.MenuItem() + Me.mnuHelp = New System.Windows.Forms.MenuItem() + Me.mnuAbout = New System.Windows.Forms.MenuItem() + Me.Label1 = New System.Windows.Forms.Label() + Me.btnInstall = New System.Windows.Forms.Button() + Me.btnClose = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'mnuMain + ' + Me.mnuMain.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuFile, Me.mnuHelp}) + Me.mnuMain.RightToLeft = CType(resources.GetObject("mnuMain.RightToLeft"), System.Windows.Forms.RightToLeft) + ' + 'mnuFile + ' + Me.mnuFile.Enabled = CType(resources.GetObject("mnuFile.Enabled"), Boolean) + Me.mnuFile.Index = 0 + Me.mnuFile.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuExit}) + Me.mnuFile.Shortcut = CType(resources.GetObject("mnuFile.Shortcut"), System.Windows.Forms.Shortcut) + Me.mnuFile.ShowShortcut = CType(resources.GetObject("mnuFile.ShowShortcut"), Boolean) + Me.mnuFile.Text = resources.GetString("mnuFile.Text") + Me.mnuFile.Visible = CType(resources.GetObject("mnuFile.Visible"), Boolean) + ' + 'mnuExit + ' + Me.mnuExit.Enabled = CType(resources.GetObject("mnuExit.Enabled"), Boolean) + Me.mnuExit.Index = 0 + Me.mnuExit.Shortcut = CType(resources.GetObject("mnuExit.Shortcut"), System.Windows.Forms.Shortcut) + Me.mnuExit.ShowShortcut = CType(resources.GetObject("mnuExit.ShowShortcut"), Boolean) + Me.mnuExit.Text = resources.GetString("mnuExit.Text") + Me.mnuExit.Visible = CType(resources.GetObject("mnuExit.Visible"), Boolean) + ' + 'mnuHelp + ' + Me.mnuHelp.Enabled = CType(resources.GetObject("mnuHelp.Enabled"), Boolean) + Me.mnuHelp.Index = 1 + Me.mnuHelp.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuAbout}) + Me.mnuHelp.Shortcut = CType(resources.GetObject("mnuHelp.Shortcut"), System.Windows.Forms.Shortcut) + Me.mnuHelp.ShowShortcut = CType(resources.GetObject("mnuHelp.ShowShortcut"), Boolean) + Me.mnuHelp.Text = resources.GetString("mnuHelp.Text") + Me.mnuHelp.Visible = CType(resources.GetObject("mnuHelp.Visible"), Boolean) + ' + 'mnuAbout + ' + Me.mnuAbout.Enabled = CType(resources.GetObject("mnuAbout.Enabled"), Boolean) + Me.mnuAbout.Index = 0 + Me.mnuAbout.Shortcut = CType(resources.GetObject("mnuAbout.Shortcut"), System.Windows.Forms.Shortcut) + Me.mnuAbout.ShowShortcut = CType(resources.GetObject("mnuAbout.ShowShortcut"), Boolean) + Me.mnuAbout.Text = resources.GetString("mnuAbout.Text") + Me.mnuAbout.Visible = CType(resources.GetObject("mnuAbout.Visible"), Boolean) + ' + 'Label1 + ' + Me.Label1.AccessibleDescription = CType(resources.GetObject("Label1.AccessibleDescription"), String) + Me.Label1.AccessibleName = CType(resources.GetObject("Label1.AccessibleName"), String) + Me.Label1.Anchor = CType(resources.GetObject("Label1.Anchor"), System.Windows.Forms.AnchorStyles) + Me.Label1.AutoSize = CType(resources.GetObject("Label1.AutoSize"), Boolean) + Me.Label1.Dock = CType(resources.GetObject("Label1.Dock"), System.Windows.Forms.DockStyle) + Me.Label1.Enabled = CType(resources.GetObject("Label1.Enabled"), Boolean) + Me.Label1.Font = CType(resources.GetObject("Label1.Font"), System.Drawing.Font) + Me.Label1.Image = CType(resources.GetObject("Label1.Image"), System.Drawing.Image) + Me.Label1.ImageAlign = CType(resources.GetObject("Label1.ImageAlign"), System.Drawing.ContentAlignment) + Me.Label1.ImageIndex = CType(resources.GetObject("Label1.ImageIndex"), Integer) + Me.Label1.ImeMode = CType(resources.GetObject("Label1.ImeMode"), System.Windows.Forms.ImeMode) + Me.Label1.Location = CType(resources.GetObject("Label1.Location"), System.Drawing.Point) + Me.Label1.Name = "Label1" + Me.Label1.RightToLeft = CType(resources.GetObject("Label1.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.Label1.Size = CType(resources.GetObject("Label1.Size"), System.Drawing.Size) + Me.Label1.TabIndex = CType(resources.GetObject("Label1.TabIndex"), Integer) + Me.Label1.Text = resources.GetString("Label1.Text") + Me.Label1.TextAlign = CType(resources.GetObject("Label1.TextAlign"), System.Drawing.ContentAlignment) + Me.Label1.Visible = CType(resources.GetObject("Label1.Visible"), Boolean) + ' + 'btnInstall + ' + Me.btnInstall.AccessibleDescription = resources.GetString("btnInstall.AccessibleDescription") + Me.btnInstall.AccessibleName = resources.GetString("btnInstall.AccessibleName") + Me.btnInstall.Anchor = CType(resources.GetObject("btnInstall.Anchor"), System.Windows.Forms.AnchorStyles) + Me.btnInstall.BackgroundImage = CType(resources.GetObject("btnInstall.BackgroundImage"), System.Drawing.Image) + Me.btnInstall.Dock = CType(resources.GetObject("btnInstall.Dock"), System.Windows.Forms.DockStyle) + Me.btnInstall.Enabled = CType(resources.GetObject("btnInstall.Enabled"), Boolean) + Me.btnInstall.FlatStyle = CType(resources.GetObject("btnInstall.FlatStyle"), System.Windows.Forms.FlatStyle) + Me.btnInstall.Font = CType(resources.GetObject("btnInstall.Font"), System.Drawing.Font) + Me.btnInstall.Image = CType(resources.GetObject("btnInstall.Image"), System.Drawing.Image) + Me.btnInstall.ImageAlign = CType(resources.GetObject("btnInstall.ImageAlign"), System.Drawing.ContentAlignment) + Me.btnInstall.ImageIndex = CType(resources.GetObject("btnInstall.ImageIndex"), Integer) + Me.btnInstall.ImeMode = CType(resources.GetObject("btnInstall.ImeMode"), System.Windows.Forms.ImeMode) + Me.btnInstall.Location = CType(resources.GetObject("btnInstall.Location"), System.Drawing.Point) + Me.btnInstall.Name = "btnInstall" + Me.btnInstall.RightToLeft = CType(resources.GetObject("btnInstall.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.btnInstall.Size = CType(resources.GetObject("btnInstall.Size"), System.Drawing.Size) + Me.btnInstall.TabIndex = CType(resources.GetObject("btnInstall.TabIndex"), Integer) + Me.btnInstall.Text = resources.GetString("btnInstall.Text") + Me.btnInstall.TextAlign = CType(resources.GetObject("btnInstall.TextAlign"), System.Drawing.ContentAlignment) + Me.btnInstall.Visible = CType(resources.GetObject("btnInstall.Visible"), Boolean) + ' + 'btnClose + ' + Me.btnClose.AccessibleDescription = resources.GetString("btnClose.AccessibleDescription") + Me.btnClose.AccessibleName = resources.GetString("btnClose.AccessibleName") + Me.btnClose.Anchor = CType(resources.GetObject("btnClose.Anchor"), System.Windows.Forms.AnchorStyles) + Me.btnClose.BackgroundImage = CType(resources.GetObject("btnClose.BackgroundImage"), System.Drawing.Image) + Me.btnClose.Dock = CType(resources.GetObject("btnClose.Dock"), System.Windows.Forms.DockStyle) + Me.btnClose.Enabled = CType(resources.GetObject("btnClose.Enabled"), Boolean) + Me.btnClose.FlatStyle = CType(resources.GetObject("btnClose.FlatStyle"), System.Windows.Forms.FlatStyle) + Me.btnClose.Font = CType(resources.GetObject("btnClose.Font"), System.Drawing.Font) + Me.btnClose.Image = CType(resources.GetObject("btnClose.Image"), System.Drawing.Image) + Me.btnClose.ImageAlign = CType(resources.GetObject("btnClose.ImageAlign"), System.Drawing.ContentAlignment) + Me.btnClose.ImageIndex = CType(resources.GetObject("btnClose.ImageIndex"), Integer) + Me.btnClose.ImeMode = CType(resources.GetObject("btnClose.ImeMode"), System.Windows.Forms.ImeMode) + Me.btnClose.Location = CType(resources.GetObject("btnClose.Location"), System.Drawing.Point) + Me.btnClose.Name = "btnClose" + Me.btnClose.RightToLeft = CType(resources.GetObject("btnClose.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.btnClose.Size = CType(resources.GetObject("btnClose.Size"), System.Drawing.Size) + Me.btnClose.TabIndex = CType(resources.GetObject("btnClose.TabIndex"), Integer) + Me.btnClose.Text = resources.GetString("btnClose.Text") + Me.btnClose.TextAlign = CType(resources.GetObject("btnClose.TextAlign"), System.Drawing.ContentAlignment) + Me.btnClose.Visible = CType(resources.GetObject("btnClose.Visible"), Boolean) + ' + 'frmMain + ' + Me.AccessibleDescription = CType(resources.GetObject("$this.AccessibleDescription"), String) + Me.AccessibleName = CType(resources.GetObject("$this.AccessibleName"), String) + Me.Anchor = CType(resources.GetObject("$this.Anchor"), System.Windows.Forms.AnchorStyles) + Me.AutoScaleBaseSize = CType(resources.GetObject("$this.AutoScaleBaseSize"), System.Drawing.Size) + Me.AutoScroll = CType(resources.GetObject("$this.AutoScroll"), Boolean) + Me.AutoScrollMargin = CType(resources.GetObject("$this.AutoScrollMargin"), System.Drawing.Size) + Me.AutoScrollMinSize = CType(resources.GetObject("$this.AutoScrollMinSize"), System.Drawing.Size) + Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image) + Me.ClientSize = CType(resources.GetObject("$this.ClientSize"), System.Drawing.Size) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnClose, Me.btnInstall, Me.Label1}) + Me.Dock = CType(resources.GetObject("$this.Dock"), System.Windows.Forms.DockStyle) + Me.Enabled = CType(resources.GetObject("$this.Enabled"), Boolean) + Me.Font = CType(resources.GetObject("$this.Font"), System.Drawing.Font) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle + Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) + Me.ImeMode = CType(resources.GetObject("$this.ImeMode"), System.Windows.Forms.ImeMode) + Me.Location = CType(resources.GetObject("$this.Location"), System.Drawing.Point) + Me.MaximizeBox = False + Me.MaximumSize = CType(resources.GetObject("$this.MaximumSize"), System.Drawing.Size) + Me.Menu = Me.mnuMain + Me.MinimumSize = CType(resources.GetObject("$this.MinimumSize"), System.Drawing.Size) + Me.Name = "frmMain" + Me.RightToLeft = CType(resources.GetObject("$this.RightToLeft"), System.Windows.Forms.RightToLeft) + Me.StartPosition = CType(resources.GetObject("$this.StartPosition"), System.Windows.Forms.FormStartPosition) + Me.Text = resources.GetString("$this.Text") + Me.Visible = CType(resources.GetObject("$this.Visible"), Boolean) + Me.ResumeLayout(False) + + End Sub + +#End Region + +#Region " Standard Menu Code " + ' has been added to some procedures since they are + ' not the focus of the demo. Remove them if you wish to debug the procedures. + ' This code simply shows the About form. + Private Sub mnuAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuAbout.Click + ' Open the About form in Dialog Mode + Dim frm As New frmAbout() + frm.ShowDialog(Me) + frm.Dispose() + End Sub + + ' This code will close the form. + Private Sub mnuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuExit.Click + ' Close the current form + Me.Close() + End Sub +#End Region + + ' This button closes the application + Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click + Application.Exit() + End Sub + + ' This button installs the demo screen saver on your machine by copying + ' the SCR file to your Windows System directory. + Private Sub btnInstall_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInstall.Click + + Dim fileName As String = "VB_NET How-To ScreenSaver.scr" + Dim sourceFile As String = Environment.CurrentDirectory & "\..\" & fileName + Dim destFile As String = Environment.SystemDirectory & "\" & fileName + + ' Try to install the screen saver. If not successful, then show + ' the error to the user. + Try + File.Copy(sourceFile, destFile, True) + Catch ex As Exception + MsgBox(ex.ToString(), MsgBoxStyle.Exclamation, Me.Text) + End Try + + + End Sub + + +End Class \ No newline at end of file diff --git a/Ch7 - Screensaver/obj/Debug/VB.NET How-To Creating a Screensaver Using GDI+.exe b/Ch7 - Screensaver/obj/Debug/VB.NET How-To Creating a Screensaver Using GDI+.exe new file mode 100644 index 0000000..bda81a1 Binary files /dev/null and b/Ch7 - Screensaver/obj/Debug/VB.NET How-To Creating a Screensaver Using GDI+.exe differ diff --git a/Ch7 - Screensaver/obj/Debug/VB.NET How-To Creating a Screensaver Using GDI+.pdb b/Ch7 - Screensaver/obj/Debug/VB.NET How-To Creating a Screensaver Using GDI+.pdb new file mode 100644 index 0000000..33684ea Binary files /dev/null and b/Ch7 - Screensaver/obj/Debug/VB.NET How-To Creating a Screensaver Using GDI+.pdb differ diff --git a/Ch7 - Screensaver/obj/Debug/VBNET.HowTo.frmAbout.resources b/Ch7 - Screensaver/obj/Debug/VBNET.HowTo.frmAbout.resources new file mode 100644 index 0000000..4139f75 Binary files /dev/null and b/Ch7 - Screensaver/obj/Debug/VBNET.HowTo.frmAbout.resources differ diff --git a/Ch7 - Screensaver/obj/Debug/VBNET.HowTo.frmMain.resources b/Ch7 - Screensaver/obj/Debug/VBNET.HowTo.frmMain.resources new file mode 100644 index 0000000..d2a9606 Binary files /dev/null and b/Ch7 - Screensaver/obj/Debug/VBNET.HowTo.frmMain.resources differ diff --git a/Ch7 - Simple Encryption/AssemblyInfo.vb b/Ch7 - Simple Encryption/AssemblyInfo.vb new file mode 100644 index 0000000..5ebae04 --- /dev/null +++ b/Ch7 - Simple Encryption/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Simple Encryption/Ch7 - Simple Encryption.sln b/Ch7 - Simple Encryption/Ch7 - Simple Encryption.sln new file mode 100644 index 0000000..53bc2d6 --- /dev/null +++ b/Ch7 - Simple Encryption/Ch7 - Simple Encryption.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Simple Encryption", "Ch7 - Simple Encryption.vbproj", "{52CBD222-E333-4765-AB28-0C9D507C78C2}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {52CBD222-E333-4765-AB28-0C9D507C78C2}.Debug.ActiveCfg = Debug|.NET + {52CBD222-E333-4765-AB28-0C9D507C78C2}.Debug.Build.0 = Debug|.NET + {52CBD222-E333-4765-AB28-0C9D507C78C2}.Release.ActiveCfg = Release|.NET + {52CBD222-E333-4765-AB28-0C9D507C78C2}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Simple Encryption/Ch7 - Simple Encryption.suo b/Ch7 - Simple Encryption/Ch7 - Simple Encryption.suo new file mode 100644 index 0000000..bd6b742 Binary files /dev/null and b/Ch7 - Simple Encryption/Ch7 - Simple Encryption.suo differ diff --git a/Ch7 - Simple Encryption/Ch7 - Simple Encryption.vbproj b/Ch7 - Simple Encryption/Ch7 - Simple Encryption.vbproj new file mode 100644 index 0000000..bf0f8d5 --- /dev/null +++ b/Ch7 - Simple Encryption/Ch7 - Simple Encryption.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Simple Encryption/Ch7 - Simple Encryption.vbproj.user b/Ch7 - Simple Encryption/Ch7 - Simple Encryption.vbproj.user new file mode 100644 index 0000000..eabb41d --- /dev/null +++ b/Ch7 - Simple Encryption/Ch7 - Simple Encryption.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Simple Encryption/Form1.resx b/Ch7 - Simple Encryption/Form1.resx new file mode 100644 index 0000000..8c4a76e --- /dev/null +++ b/Ch7 - Simple Encryption/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Simple Encryption/Form1.vb b/Ch7 - Simple Encryption/Form1.vb new file mode 100644 index 0000000..10ed462 --- /dev/null +++ b/Ch7 - Simple Encryption/Form1.vb @@ -0,0 +1,126 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents TextBox2 As System.Windows.Forms.TextBox + Friend WithEvents Label2 As System.Windows.Forms.Label + Friend WithEvents Label3 As System.Windows.Forms.Label + Friend WithEvents TextBox3 As System.Windows.Forms.TextBox + Private Sub InitializeComponent() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.Label1 = New System.Windows.Forms.Label() + Me.TextBox2 = New System.Windows.Forms.TextBox() + Me.Label2 = New System.Windows.Forms.Label() + Me.Label3 = New System.Windows.Forms.Label() + Me.TextBox3 = New System.Windows.Forms.TextBox() + Me.SuspendLayout() + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(16, 32) + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(336, 20) + Me.TextBox1.TabIndex = 3 + Me.TextBox1.Text = "" + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(16, 16) + Me.Label1.Name = "Label1" + Me.Label1.TabIndex = 5 + Me.Label1.Text = "Type your text:" + ' + 'TextBox2 + ' + Me.TextBox2.Location = New System.Drawing.Point(16, 72) + Me.TextBox2.Name = "TextBox2" + Me.TextBox2.Size = New System.Drawing.Size(336, 20) + Me.TextBox2.TabIndex = 4 + Me.TextBox2.Text = "" + ' + 'Label2 + ' + Me.Label2.Location = New System.Drawing.Point(16, 56) + Me.Label2.Name = "Label2" + Me.Label2.TabIndex = 6 + Me.Label2.Text = "Encrypted:" + ' + 'Label3 + ' + Me.Label3.Location = New System.Drawing.Point(16, 96) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(192, 23) + Me.Label3.TabIndex = 8 + Me.Label3.Text = "... and then unencrypted:" + ' + 'TextBox3 + ' + Me.TextBox3.Location = New System.Drawing.Point(16, 112) + Me.TextBox3.Name = "TextBox3" + Me.TextBox3.Size = New System.Drawing.Size(336, 20) + Me.TextBox3.TabIndex = 7 + Me.TextBox3.Text = "" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(368, 166) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox2, Me.TextBox3, Me.Label3, Me.Label2, Me.TextBox1, Me.Label1}) + Me.Name = "Form1" + Me.Text = "Encryption in Just Twelve Lines of Code!" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged + TextBox2.Text = SimpleCrypt(TextBox1.Text) + TextBox3.Text = SimpleCrypt(TextBox2.Text) + End Sub + + Public Function SimpleCrypt(ByVal Text As String) As String + ' Encrypts/decrypts the passed string using a + ' simple ASCII value-swapping algorithm + Dim strTempChar As String, i As Integer + For i = 1 To Len(Text) + If Asc(Mid$(Text, i, 1)) < 128 Then + strTempChar = CType(Asc(Mid$(Text, i, 1)) + 128, String) + ElseIf Asc(Mid$(Text, i, 1)) > 128 Then + strTempChar = CType(Asc(Mid$(Text, i, 1)) - 128, String) + End If + Mid$(Text, i, 1) = Chr(CType(strTempChar, Integer)) + Next i + Return Text + End Function + +End Class diff --git a/Ch7 - Simple Encryption/bin/Ch7 - Simple Encryption.exe b/Ch7 - Simple Encryption/bin/Ch7 - Simple Encryption.exe new file mode 100644 index 0000000..3f615cd Binary files /dev/null and b/Ch7 - Simple Encryption/bin/Ch7 - Simple Encryption.exe differ diff --git a/Ch7 - Simple Encryption/bin/Ch7 - Simple Encryption.pdb b/Ch7 - Simple Encryption/bin/Ch7 - Simple Encryption.pdb new file mode 100644 index 0000000..1303e20 Binary files /dev/null and b/Ch7 - Simple Encryption/bin/Ch7 - Simple Encryption.pdb differ diff --git a/Ch7 - Simple Encryption/obj/Debug/Ch7 - Simple Encryption.exe b/Ch7 - Simple Encryption/obj/Debug/Ch7 - Simple Encryption.exe new file mode 100644 index 0000000..3f615cd Binary files /dev/null and b/Ch7 - Simple Encryption/obj/Debug/Ch7 - Simple Encryption.exe differ diff --git a/Ch7 - Simple Encryption/obj/Debug/Ch7 - Simple Encryption.pdb b/Ch7 - Simple Encryption/obj/Debug/Ch7 - Simple Encryption.pdb new file mode 100644 index 0000000..1303e20 Binary files /dev/null and b/Ch7 - Simple Encryption/obj/Debug/Ch7 - Simple Encryption.pdb differ diff --git a/Ch7 - Simple Encryption/obj/Debug/Ch7___Simple_Encryption.Form1.resources b/Ch7 - Simple Encryption/obj/Debug/Ch7___Simple_Encryption.Form1.resources new file mode 100644 index 0000000..dac68d6 Binary files /dev/null and b/Ch7 - Simple Encryption/obj/Debug/Ch7___Simple_Encryption.Form1.resources differ diff --git a/Ch7 - Snatch HTML with Timeout/AssemblyInfo.vb b/Ch7 - Snatch HTML with Timeout/AssemblyInfo.vb new file mode 100644 index 0000000..dbd1b42 --- /dev/null +++ b/Ch7 - Snatch HTML with Timeout/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Snatch HTML with Timeout/Ch7 - Snatch HTML with Timeout.sln b/Ch7 - Snatch HTML with Timeout/Ch7 - Snatch HTML with Timeout.sln new file mode 100644 index 0000000..697ae96 --- /dev/null +++ b/Ch7 - Snatch HTML with Timeout/Ch7 - Snatch HTML with Timeout.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Snatch HTML with Timeout", "Ch7 - Snatch HTML with Timeout.vbproj", "{04C5D97B-FB4B-4DB7-91F4-65336F90ADDD}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {04C5D97B-FB4B-4DB7-91F4-65336F90ADDD}.Debug.ActiveCfg = Debug|.NET + {04C5D97B-FB4B-4DB7-91F4-65336F90ADDD}.Debug.Build.0 = Debug|.NET + {04C5D97B-FB4B-4DB7-91F4-65336F90ADDD}.Release.ActiveCfg = Release|.NET + {04C5D97B-FB4B-4DB7-91F4-65336F90ADDD}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Snatch HTML with Timeout/Ch7 - Snatch HTML with Timeout.suo b/Ch7 - Snatch HTML with Timeout/Ch7 - Snatch HTML with Timeout.suo new file mode 100644 index 0000000..2199b26 Binary files /dev/null and b/Ch7 - Snatch HTML with Timeout/Ch7 - Snatch HTML with Timeout.suo differ diff --git a/Ch7 - Snatch HTML with Timeout/Ch7 - Snatch HTML with Timeout.vbproj b/Ch7 - Snatch HTML with Timeout/Ch7 - Snatch HTML with Timeout.vbproj new file mode 100644 index 0000000..ce993fd --- /dev/null +++ b/Ch7 - Snatch HTML with Timeout/Ch7 - Snatch HTML with Timeout.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Snatch HTML with Timeout/Ch7 - Snatch HTML with Timeout.vbproj.user b/Ch7 - Snatch HTML with Timeout/Ch7 - Snatch HTML with Timeout.vbproj.user new file mode 100644 index 0000000..c168d10 --- /dev/null +++ b/Ch7 - Snatch HTML with Timeout/Ch7 - Snatch HTML with Timeout.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Snatch HTML with Timeout/Form1.resx b/Ch7 - Snatch HTML with Timeout/Form1.resx new file mode 100644 index 0000000..4cc4d8a --- /dev/null +++ b/Ch7 - Snatch HTML with Timeout/Form1.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Snatch HTML with Timeout/Form1.vb b/Ch7 - Snatch HTML with Timeout/Form1.vb new file mode 100644 index 0000000..25a35b0 --- /dev/null +++ b/Ch7 - Snatch HTML with Timeout/Form1.vb @@ -0,0 +1,135 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents Label2 As System.Windows.Forms.Label + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents TextBox2 As System.Windows.Forms.TextBox + Friend WithEvents Label1 As System.Windows.Forms.Label + Private Sub InitializeComponent() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.Label2 = New System.Windows.Forms.Label() + Me.Button1 = New System.Windows.Forms.Button() + Me.TextBox2 = New System.Windows.Forms.TextBox() + Me.Label1 = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(16, 72) + Me.TextBox1.Multiline = True + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(448, 144) + Me.TextBox1.TabIndex = 5 + Me.TextBox1.Text = "" + ' + 'Label2 + ' + Me.Label2.Location = New System.Drawing.Point(16, 56) + Me.Label2.Name = "Label2" + Me.Label2.TabIndex = 9 + Me.Label2.Text = "HTML:" + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(336, 16) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(40, 24) + Me.Button1.TabIndex = 8 + Me.Button1.Text = "Go" + ' + 'TextBox2 + ' + Me.TextBox2.Location = New System.Drawing.Point(120, 16) + Me.TextBox2.Name = "TextBox2" + Me.TextBox2.Size = New System.Drawing.Size(176, 20) + Me.TextBox2.TabIndex = 7 + Me.TextBox2.Text = "http://www.bbc.co.uk/" + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(16, 16) + Me.Label1.Name = "Label1" + Me.Label1.TabIndex = 6 + Me.Label1.Text = "Enter a URL:" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(480, 238) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox1, Me.Label2, Me.Button1, Me.TextBox2, Me.Label1}) + Me.Name = "Form1" + Me.Text = "How To Snatch HTML, with a Timeout" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + TextBox1.Text = GetPageHTML(TextBox2.Text, InputBox("Enter the server timeout in seconds:")) + End Sub + + Public Function GetPageHTML(ByVal URL As String, _ + Optional ByVal TimeoutSeconds As Integer = 10) _ + As String + ' Retrieves the HTML from the specified URL, + ' using a default timeout of 10 seconds + Dim objRequest As Net.WebRequest + Dim objResponse As Net.WebResponse + Dim objStreamReceive As System.IO.Stream + Dim objEncoding As System.Text.Encoding + Dim objStreamRead As System.IO.StreamReader + + Try + ' Setup our Web request + objRequest = Net.WebRequest.Create(URL) + objRequest.Timeout = TimeoutSeconds * 1000 + ' Retrieve data from request + objResponse = objRequest.GetResponse + objStreamReceive = objResponse.GetResponseStream + objEncoding = System.Text.Encoding.GetEncoding( _ + "utf-8") + objStreamRead = New System.IO.StreamReader( _ + objStreamReceive, objEncoding) + ' Set function return value + GetPageHTML = objStreamRead.ReadToEnd() + ' Check if available, then close response + If Not objResponse Is Nothing Then + objResponse.Close() + End If + Catch + ' Error occured grabbing data, simply return nothing + Return "" + End Try + End Function + +End Class diff --git a/Ch7 - Snatch HTML with Timeout/bin/Ch7 - Snatch HTML with Timeout.exe b/Ch7 - Snatch HTML with Timeout/bin/Ch7 - Snatch HTML with Timeout.exe new file mode 100644 index 0000000..b0344b7 Binary files /dev/null and b/Ch7 - Snatch HTML with Timeout/bin/Ch7 - Snatch HTML with Timeout.exe differ diff --git a/Ch7 - Snatch HTML with Timeout/bin/Ch7 - Snatch HTML with Timeout.pdb b/Ch7 - Snatch HTML with Timeout/bin/Ch7 - Snatch HTML with Timeout.pdb new file mode 100644 index 0000000..35fa744 Binary files /dev/null and b/Ch7 - Snatch HTML with Timeout/bin/Ch7 - Snatch HTML with Timeout.pdb differ diff --git a/Ch7 - Snatch HTML with Timeout/obj/Debug/Ch7 - Snatch HTML with Timeout.exe b/Ch7 - Snatch HTML with Timeout/obj/Debug/Ch7 - Snatch HTML with Timeout.exe new file mode 100644 index 0000000..b0344b7 Binary files /dev/null and b/Ch7 - Snatch HTML with Timeout/obj/Debug/Ch7 - Snatch HTML with Timeout.exe differ diff --git a/Ch7 - Snatch HTML with Timeout/obj/Debug/Ch7 - Snatch HTML with Timeout.pdb b/Ch7 - Snatch HTML with Timeout/obj/Debug/Ch7 - Snatch HTML with Timeout.pdb new file mode 100644 index 0000000..35fa744 Binary files /dev/null and b/Ch7 - Snatch HTML with Timeout/obj/Debug/Ch7 - Snatch HTML with Timeout.pdb differ diff --git a/Ch7 - Snatch HTML with Timeout/obj/Debug/Ch7___Snatch_HTML_with_Timeout.Form1.resources b/Ch7 - Snatch HTML with Timeout/obj/Debug/Ch7___Snatch_HTML_with_Timeout.Form1.resources new file mode 100644 index 0000000..169d9e2 Binary files /dev/null and b/Ch7 - Snatch HTML with Timeout/obj/Debug/Ch7___Snatch_HTML_with_Timeout.Form1.resources differ diff --git a/Ch7 - Snatch HTML/AssemblyInfo.vb b/Ch7 - Snatch HTML/AssemblyInfo.vb new file mode 100644 index 0000000..4fd2944 --- /dev/null +++ b/Ch7 - Snatch HTML/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Snatch HTML/Ch7 - Snatch HTML.sln b/Ch7 - Snatch HTML/Ch7 - Snatch HTML.sln new file mode 100644 index 0000000..995aaf5 --- /dev/null +++ b/Ch7 - Snatch HTML/Ch7 - Snatch HTML.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Snatch HTML", "Ch7 - Snatch HTML.vbproj", "{2109E646-1A1C-43DB-BF76-B24824A6C3B3}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {2109E646-1A1C-43DB-BF76-B24824A6C3B3}.Debug.ActiveCfg = Debug|.NET + {2109E646-1A1C-43DB-BF76-B24824A6C3B3}.Debug.Build.0 = Debug|.NET + {2109E646-1A1C-43DB-BF76-B24824A6C3B3}.Release.ActiveCfg = Release|.NET + {2109E646-1A1C-43DB-BF76-B24824A6C3B3}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Snatch HTML/Ch7 - Snatch HTML.suo b/Ch7 - Snatch HTML/Ch7 - Snatch HTML.suo new file mode 100644 index 0000000..060e43f Binary files /dev/null and b/Ch7 - Snatch HTML/Ch7 - Snatch HTML.suo differ diff --git a/Ch7 - Snatch HTML/Ch7 - Snatch HTML.vbproj b/Ch7 - Snatch HTML/Ch7 - Snatch HTML.vbproj new file mode 100644 index 0000000..352c5eb --- /dev/null +++ b/Ch7 - Snatch HTML/Ch7 - Snatch HTML.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Snatch HTML/Ch7 - Snatch HTML.vbproj.user b/Ch7 - Snatch HTML/Ch7 - Snatch HTML.vbproj.user new file mode 100644 index 0000000..a6e254a --- /dev/null +++ b/Ch7 - Snatch HTML/Ch7 - Snatch HTML.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Snatch HTML/Form1.resx b/Ch7 - Snatch HTML/Form1.resx new file mode 100644 index 0000000..eec6194 --- /dev/null +++ b/Ch7 - Snatch HTML/Form1.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Snatch HTML/Form1.vb b/Ch7 - Snatch HTML/Form1.vb new file mode 100644 index 0000000..577c111 --- /dev/null +++ b/Ch7 - Snatch HTML/Form1.vb @@ -0,0 +1,108 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents TextBox2 As System.Windows.Forms.TextBox + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents Label2 As System.Windows.Forms.Label + Private Sub InitializeComponent() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.Label1 = New System.Windows.Forms.Label() + Me.TextBox2 = New System.Windows.Forms.TextBox() + Me.Button1 = New System.Windows.Forms.Button() + Me.Label2 = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(32, 80) + Me.TextBox1.Multiline = True + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(448, 144) + Me.TextBox1.TabIndex = 0 + Me.TextBox1.Text = "" + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(32, 24) + Me.Label1.Name = "Label1" + Me.Label1.TabIndex = 1 + Me.Label1.Text = "Enter a URL:" + ' + 'TextBox2 + ' + Me.TextBox2.Location = New System.Drawing.Point(136, 24) + Me.TextBox2.Name = "TextBox2" + Me.TextBox2.Size = New System.Drawing.Size(176, 20) + Me.TextBox2.TabIndex = 2 + Me.TextBox2.Text = "http://www.bbc.co.uk/" + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(352, 24) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(40, 24) + Me.Button1.TabIndex = 3 + Me.Button1.Text = "Go" + ' + 'Label2 + ' + Me.Label2.Location = New System.Drawing.Point(32, 64) + Me.Label2.Name = "Label2" + Me.Label2.TabIndex = 4 + Me.Label2.Text = "HTML:" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(520, 246) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox1, Me.Label2, Me.Button1, Me.TextBox2, Me.Label1}) + Me.Name = "Form1" + Me.Text = "How To Snatch the HTML of a Web Page" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + TextBox1.Text = GetPageHTML(TextBox2.Text) + End Sub + + Public Function GetPageHTML(ByVal URL As String) As String + ' Retrieves the HTML from the specified URL + Dim objWC As New System.Net.WebClient() + Return New System.Text.UTF8Encoding().GetString( _ + objWC.DownloadData(URL)) + End Function + +End Class diff --git a/Ch7 - Snatch HTML/bin/Ch7 - Snatch HTML.exe b/Ch7 - Snatch HTML/bin/Ch7 - Snatch HTML.exe new file mode 100644 index 0000000..f9d2831 Binary files /dev/null and b/Ch7 - Snatch HTML/bin/Ch7 - Snatch HTML.exe differ diff --git a/Ch7 - Snatch HTML/bin/Ch7 - Snatch HTML.pdb b/Ch7 - Snatch HTML/bin/Ch7 - Snatch HTML.pdb new file mode 100644 index 0000000..bd8ec6e Binary files /dev/null and b/Ch7 - Snatch HTML/bin/Ch7 - Snatch HTML.pdb differ diff --git a/Ch7 - Snatch HTML/obj/Debug/Ch7 - Snatch HTML.exe b/Ch7 - Snatch HTML/obj/Debug/Ch7 - Snatch HTML.exe new file mode 100644 index 0000000..f9d2831 Binary files /dev/null and b/Ch7 - Snatch HTML/obj/Debug/Ch7 - Snatch HTML.exe differ diff --git a/Ch7 - Snatch HTML/obj/Debug/Ch7 - Snatch HTML.pdb b/Ch7 - Snatch HTML/obj/Debug/Ch7 - Snatch HTML.pdb new file mode 100644 index 0000000..bd8ec6e Binary files /dev/null and b/Ch7 - Snatch HTML/obj/Debug/Ch7 - Snatch HTML.pdb differ diff --git a/Ch7 - Snatch HTML/obj/Debug/Ch7___Snatch_HTML.Form1.resources b/Ch7 - Snatch HTML/obj/Debug/Ch7___Snatch_HTML.Form1.resources new file mode 100644 index 0000000..169d9e2 Binary files /dev/null and b/Ch7 - Snatch HTML/obj/Debug/Ch7___Snatch_HTML.Form1.resources differ diff --git a/Ch7 - Writing to Temp File/AssemblyInfo.vb b/Ch7 - Writing to Temp File/AssemblyInfo.vb new file mode 100644 index 0000000..1144b47 --- /dev/null +++ b/Ch7 - Writing to Temp File/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Writing to Temp File/Ch7 - Writing to Temp File.sln b/Ch7 - Writing to Temp File/Ch7 - Writing to Temp File.sln new file mode 100644 index 0000000..ab2a349 --- /dev/null +++ b/Ch7 - Writing to Temp File/Ch7 - Writing to Temp File.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Writing to Temp File", "Ch7 - Writing to Temp File.vbproj", "{1A7AF519-3C5C-49A6-B269-3CD951788218}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {1A7AF519-3C5C-49A6-B269-3CD951788218}.Debug.ActiveCfg = Debug|.NET + {1A7AF519-3C5C-49A6-B269-3CD951788218}.Debug.Build.0 = Debug|.NET + {1A7AF519-3C5C-49A6-B269-3CD951788218}.Release.ActiveCfg = Release|.NET + {1A7AF519-3C5C-49A6-B269-3CD951788218}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Writing to Temp File/Ch7 - Writing to Temp File.suo b/Ch7 - Writing to Temp File/Ch7 - Writing to Temp File.suo new file mode 100644 index 0000000..39152c2 Binary files /dev/null and b/Ch7 - Writing to Temp File/Ch7 - Writing to Temp File.suo differ diff --git a/Ch7 - Writing to Temp File/Ch7 - Writing to Temp File.vbproj b/Ch7 - Writing to Temp File/Ch7 - Writing to Temp File.vbproj new file mode 100644 index 0000000..42a3dcd --- /dev/null +++ b/Ch7 - Writing to Temp File/Ch7 - Writing to Temp File.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Writing to Temp File/Ch7 - Writing to Temp File.vbproj.user b/Ch7 - Writing to Temp File/Ch7 - Writing to Temp File.vbproj.user new file mode 100644 index 0000000..eabb41d --- /dev/null +++ b/Ch7 - Writing to Temp File/Ch7 - Writing to Temp File.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Writing to Temp File/Form1.resx b/Ch7 - Writing to Temp File/Form1.resx new file mode 100644 index 0000000..e25f8ab --- /dev/null +++ b/Ch7 - Writing to Temp File/Form1.resx @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Writing to Temp File/Form1.vb b/Ch7 - Writing to Temp File/Form1.vb new file mode 100644 index 0000000..c39b6ba --- /dev/null +++ b/Ch7 - Writing to Temp File/Form1.vb @@ -0,0 +1,79 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Button1.Location = New System.Drawing.Point(80, 64) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(264, 96) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Write sample text and return filename!" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(440, 238) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1}) + Me.Name = "Form1" + Me.Text = "Writing to a Temporary File" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + Dim strFilename = WriteToTempFile("This is my data for the temporary file.") + MessageBox.Show(strFilename) + End Sub + + Public Function WriteToTempFile(ByVal Data As String) As String + ' Writes text to a temporary file and returns path + Dim strFilename As String = System.IO.Path.GetTempFileName() + Dim objFS As New System.IO.FileStream(strFilename, System.IO.FileMode.Append, System.IO.FileAccess.Write) + ' Opens stream and begins writing + Dim Writer As New System.IO.StreamWriter(objFS) + Writer.BaseStream.Seek(0, System.IO.SeekOrigin.End) + Writer.WriteLine(Data) + Writer.Flush() + ' Closes and returns temp path + Writer.Close() + Return strFilename + End Function + + +End Class diff --git a/Ch7 - Writing to Temp File/bin/Ch7 - Writing to Temp File.exe b/Ch7 - Writing to Temp File/bin/Ch7 - Writing to Temp File.exe new file mode 100644 index 0000000..d69a47e Binary files /dev/null and b/Ch7 - Writing to Temp File/bin/Ch7 - Writing to Temp File.exe differ diff --git a/Ch7 - Writing to Temp File/bin/Ch7 - Writing to Temp File.pdb b/Ch7 - Writing to Temp File/bin/Ch7 - Writing to Temp File.pdb new file mode 100644 index 0000000..3804707 Binary files /dev/null and b/Ch7 - Writing to Temp File/bin/Ch7 - Writing to Temp File.pdb differ diff --git a/Ch7 - Writing to Temp File/obj/Debug/Ch7 - Writing to Temp File.exe b/Ch7 - Writing to Temp File/obj/Debug/Ch7 - Writing to Temp File.exe new file mode 100644 index 0000000..d69a47e Binary files /dev/null and b/Ch7 - Writing to Temp File/obj/Debug/Ch7 - Writing to Temp File.exe differ diff --git a/Ch7 - Writing to Temp File/obj/Debug/Ch7 - Writing to Temp File.pdb b/Ch7 - Writing to Temp File/obj/Debug/Ch7 - Writing to Temp File.pdb new file mode 100644 index 0000000..3804707 Binary files /dev/null and b/Ch7 - Writing to Temp File/obj/Debug/Ch7 - Writing to Temp File.pdb differ diff --git a/Ch7 - Writing to Temp File/obj/Debug/Ch7___Writing_to_Temp_File.Form1.resources b/Ch7 - Writing to Temp File/obj/Debug/Ch7___Writing_to_Temp_File.Form1.resources new file mode 100644 index 0000000..ad3ef8f Binary files /dev/null and b/Ch7 - Writing to Temp File/obj/Debug/Ch7___Writing_to_Temp_File.Form1.resources differ diff --git a/Ch7 - Years Between Dates/AssemblyInfo.vb b/Ch7 - Years Between Dates/AssemblyInfo.vb new file mode 100644 index 0000000..cd24cbe --- /dev/null +++ b/Ch7 - Years Between Dates/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch7 - Years Between Dates/Ch7 - Years Between Dates.sln b/Ch7 - Years Between Dates/Ch7 - Years Between Dates.sln new file mode 100644 index 0000000..7d02cc0 --- /dev/null +++ b/Ch7 - Years Between Dates/Ch7 - Years Between Dates.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch7 - Years Between Dates", "Ch7 - Years Between Dates.vbproj", "{1EC4CBE3-287F-49B4-BA6D-35B04019BC20}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {1EC4CBE3-287F-49B4-BA6D-35B04019BC20}.Debug.ActiveCfg = Debug|.NET + {1EC4CBE3-287F-49B4-BA6D-35B04019BC20}.Debug.Build.0 = Debug|.NET + {1EC4CBE3-287F-49B4-BA6D-35B04019BC20}.Release.ActiveCfg = Release|.NET + {1EC4CBE3-287F-49B4-BA6D-35B04019BC20}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch7 - Years Between Dates/Ch7 - Years Between Dates.suo b/Ch7 - Years Between Dates/Ch7 - Years Between Dates.suo new file mode 100644 index 0000000..4ce42d2 Binary files /dev/null and b/Ch7 - Years Between Dates/Ch7 - Years Between Dates.suo differ diff --git a/Ch7 - Years Between Dates/Ch7 - Years Between Dates.vbproj b/Ch7 - Years Between Dates/Ch7 - Years Between Dates.vbproj new file mode 100644 index 0000000..4786c77 --- /dev/null +++ b/Ch7 - Years Between Dates/Ch7 - Years Between Dates.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch7 - Years Between Dates/Ch7 - Years Between Dates.vbproj.user b/Ch7 - Years Between Dates/Ch7 - Years Between Dates.vbproj.user new file mode 100644 index 0000000..a6e254a --- /dev/null +++ b/Ch7 - Years Between Dates/Ch7 - Years Between Dates.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch7 - Years Between Dates/Form1.resx b/Ch7 - Years Between Dates/Form1.resx new file mode 100644 index 0000000..0c30b61 --- /dev/null +++ b/Ch7 - Years Between Dates/Form1.resx @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch7 - Years Between Dates/Form1.vb b/Ch7 - Years Between Dates/Form1.vb new file mode 100644 index 0000000..bc4510c --- /dev/null +++ b/Ch7 - Years Between Dates/Form1.vb @@ -0,0 +1,94 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents MonthCalendar1 As System.Windows.Forms.MonthCalendar + Friend WithEvents MonthCalendar2 As System.Windows.Forms.MonthCalendar + Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel + Private Sub InitializeComponent() + Me.MonthCalendar1 = New System.Windows.Forms.MonthCalendar() + Me.MonthCalendar2 = New System.Windows.Forms.MonthCalendar() + Me.LinkLabel1 = New System.Windows.Forms.LinkLabel() + Me.SuspendLayout() + ' + 'MonthCalendar1 + ' + Me.MonthCalendar1.Location = New System.Drawing.Point(32, 96) + Me.MonthCalendar1.Name = "MonthCalendar1" + Me.MonthCalendar1.TabIndex = 0 + ' + 'MonthCalendar2 + ' + Me.MonthCalendar2.Location = New System.Drawing.Point(280, 96) + Me.MonthCalendar2.Name = "MonthCalendar2" + Me.MonthCalendar2.TabIndex = 1 + ' + 'LinkLabel1 + ' + Me.LinkLabel1.Location = New System.Drawing.Point(32, 40) + Me.LinkLabel1.Name = "LinkLabel1" + Me.LinkLabel1.Size = New System.Drawing.Size(456, 23) + Me.LinkLabel1.TabIndex = 2 + Me.LinkLabel1.TabStop = True + Me.LinkLabel1.Text = "Select a start and end date below, then click here to calculate number of years d" & _ + "ifference" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(504, 278) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.LinkLabel1, Me.MonthCalendar2, Me.MonthCalendar1}) + Me.Name = "Form1" + Me.Text = "Calculating the years between dates" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked + MessageBox.Show("There are " & _ + YearsBetweenDates(MonthCalendar1.SelectionStart, MonthCalendar2.SelectionStart) & _ + " years between the two specified dates.") + End Sub + + Public Function YearsBetweenDates(ByVal StartDate As DateTime, _ + ByVal EndDate As DateTime) As Integer + ' Returns the number of years between the passed dates + If Month(EndDate) < Month(StartDate) Or _ + (Month(EndDate) = Month(StartDate) And _ + (EndDate.Day) < (StartDate.Day)) Then + Return Year(EndDate) - Year(StartDate) - 1 + Else + Return Year(EndDate) - Year(StartDate) + End If + End Function + +End Class diff --git a/Ch7 - Years Between Dates/bin/Ch7 - Years Between Dates.exe b/Ch7 - Years Between Dates/bin/Ch7 - Years Between Dates.exe new file mode 100644 index 0000000..648964c Binary files /dev/null and b/Ch7 - Years Between Dates/bin/Ch7 - Years Between Dates.exe differ diff --git a/Ch7 - Years Between Dates/bin/Ch7 - Years Between Dates.pdb b/Ch7 - Years Between Dates/bin/Ch7 - Years Between Dates.pdb new file mode 100644 index 0000000..7175d4e Binary files /dev/null and b/Ch7 - Years Between Dates/bin/Ch7 - Years Between Dates.pdb differ diff --git a/Ch7 - Years Between Dates/obj/Debug/Ch7 - Years Between Dates.exe b/Ch7 - Years Between Dates/obj/Debug/Ch7 - Years Between Dates.exe new file mode 100644 index 0000000..648964c Binary files /dev/null and b/Ch7 - Years Between Dates/obj/Debug/Ch7 - Years Between Dates.exe differ diff --git a/Ch7 - Years Between Dates/obj/Debug/Ch7 - Years Between Dates.pdb b/Ch7 - Years Between Dates/obj/Debug/Ch7 - Years Between Dates.pdb new file mode 100644 index 0000000..7175d4e Binary files /dev/null and b/Ch7 - Years Between Dates/obj/Debug/Ch7 - Years Between Dates.pdb differ diff --git a/Ch7 - Years Between Dates/obj/Debug/Ch7___Years_Between_Dates.Form1.resources b/Ch7 - Years Between Dates/obj/Debug/Ch7___Years_Between_Dates.Form1.resources new file mode 100644 index 0000000..cd119f3 Binary files /dev/null and b/Ch7 - Years Between Dates/obj/Debug/Ch7___Years_Between_Dates.Form1.resources differ diff --git a/Ch8 - Define Your Own HTML/AssemblyInfo.vb b/Ch8 - Define Your Own HTML/AssemblyInfo.vb new file mode 100644 index 0000000..5c76819 --- /dev/null +++ b/Ch8 - Define Your Own HTML/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Ch8 - Define Your Own HTML/Ch8 - Define Your Own HTML.sln b/Ch8 - Define Your Own HTML/Ch8 - Define Your Own HTML.sln new file mode 100644 index 0000000..0a25a60 --- /dev/null +++ b/Ch8 - Define Your Own HTML/Ch8 - Define Your Own HTML.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ch8 - Define Your Own HTML", "Ch8 - Define Your Own HTML.vbproj", "{B9CF9CAE-F05D-49BF-BFDC-635D2B5B3F9F}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {B9CF9CAE-F05D-49BF-BFDC-635D2B5B3F9F}.Debug.ActiveCfg = Debug|.NET + {B9CF9CAE-F05D-49BF-BFDC-635D2B5B3F9F}.Debug.Build.0 = Debug|.NET + {B9CF9CAE-F05D-49BF-BFDC-635D2B5B3F9F}.Release.ActiveCfg = Release|.NET + {B9CF9CAE-F05D-49BF-BFDC-635D2B5B3F9F}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Ch8 - Define Your Own HTML/Ch8 - Define Your Own HTML.suo b/Ch8 - Define Your Own HTML/Ch8 - Define Your Own HTML.suo new file mode 100644 index 0000000..b6a248e Binary files /dev/null and b/Ch8 - Define Your Own HTML/Ch8 - Define Your Own HTML.suo differ diff --git a/Ch8 - Define Your Own HTML/Ch8 - Define Your Own HTML.vbproj b/Ch8 - Define Your Own HTML/Ch8 - Define Your Own HTML.vbproj new file mode 100644 index 0000000..1b1df1e --- /dev/null +++ b/Ch8 - Define Your Own HTML/Ch8 - Define Your Own HTML.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ch8 - Define Your Own HTML/Ch8 - Define Your Own HTML.vbproj.user b/Ch8 - Define Your Own HTML/Ch8 - Define Your Own HTML.vbproj.user new file mode 100644 index 0000000..c168d10 --- /dev/null +++ b/Ch8 - Define Your Own HTML/Ch8 - Define Your Own HTML.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Ch8 - Define Your Own HTML/Form1.resx b/Ch8 - Define Your Own HTML/Form1.resx new file mode 100644 index 0000000..375821d --- /dev/null +++ b/Ch8 - Define Your Own HTML/Form1.resx @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Ch8 - Define Your Own HTML/Form1.vb b/Ch8 - Define Your Own HTML/Form1.vb new file mode 100644 index 0000000..31bd77c --- /dev/null +++ b/Ch8 - Define Your Own HTML/Form1.vb @@ -0,0 +1,159 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents TextBox2 As System.Windows.Forms.TextBox + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.TextBox2 = New System.Windows.Forms.TextBox() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(24, 136) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(376, 40) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Convert ""your"" HTML codes to real HTML" + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(16, 16) + Me.TextBox1.Multiline = True + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical + Me.TextBox1.Size = New System.Drawing.Size(392, 104) + Me.TextBox1.TabIndex = 1 + Me.TextBox1.Text = "[i]Thanks [b]very[/b] much for visiting me[/i] at [url=http://www.karlmoore.com/]" & _ + "Karl Moore.com[/url]." + ' + 'TextBox2 + ' + Me.TextBox2.Location = New System.Drawing.Point(16, 200) + Me.TextBox2.Multiline = True + Me.TextBox2.Name = "TextBox2" + Me.TextBox2.ScrollBars = System.Windows.Forms.ScrollBars.Vertical + Me.TextBox2.Size = New System.Drawing.Size(392, 104) + Me.TextBox2.TabIndex = 2 + Me.TextBox2.Text = "" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(424, 326) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox2, Me.TextBox1, Me.Button1}) + Me.Name = "Form1" + Me.Text = "Define Your Own HTML" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + Dim strResult As String + Dim YourData As String = TextBox1.Text + + ' [url]http://www.karlmoore.com/ /[/url] + strResult = System.Text.RegularExpressions.Regex.Replace(YourData, _ + "\[url[^>]*?=\s*?[""']?([^'"" >]+?)[ '""]?\]([^\""]*?)\[/url\]", _ + "$2", _ + System.Text.RegularExpressions.RegexOptions.IgnoreCase) + + ' [url=http://www.karlmoore.com/]Karl Moore.com[/url] + strResult = System.Text.RegularExpressions.Regex.Replace(strResult, _ + "\[URL\]([^\""]*?)\[/URL\]", _ + "$1", _ + System.Text.RegularExpressions.RegexOptions.IgnoreCase) + + ' [email=myname@domain.com]Click here to email me[/email] + strResult = System.Text.RegularExpressions.Regex.Replace(strResult, _ + "\[email[^>]*?=\s*?[""']?([^'"" >]+?)[ '""]?\]([^\""]*?)\[/email\]", _ + "$2", _ + System.Text.RegularExpressions.RegexOptions.IgnoreCase) + + ' [email]myname@domain.com[/email] + strResult = System.Text.RegularExpressions.Regex.Replace(strResult, _ + "\[email\]([^\""]*?)\[/email\]", _ + "$1", _ + System.Text.RegularExpressions.RegexOptions.IgnoreCase) + + ' [b]some text[/b] produces bold text + strResult = System.Text.RegularExpressions.Regex.Replace(strResult, _ + "\[b\]([^\""]*?)\[/b\]", "$1", _ + System.Text.RegularExpressions.RegexOptions.IgnoreCase) + + ' [u]some text[/u] produces underlined text + strResult = System.Text.RegularExpressions.Regex.Replace(strResult, _ + "\[u\]([^\""]*?)\[/u\]", "$1", _ + System.Text.RegularExpressions.RegexOptions.IgnoreCase) + + ' [i]some text[/i] produces italicised text + strResult = System.Text.RegularExpressions.Regex.Replace(strResult, _ + "\[i\]([^\""]*?)\[/i\]", "$1", _ + System.Text.RegularExpressions.RegexOptions.IgnoreCase) + + ' [color=blue]some text[/color] produces blue text + strResult = System.Text.RegularExpressions.Regex.Replace(strResult, _ + "\[color[^>]*?=\s*[""']?([^'"" >]+?)[ '""]?\]([^\""]*)\[/color\]", _ + "$2", _ + System.Text.RegularExpressions.RegexOptions.IgnoreCase) + + ' [size=4]some text[/size] produces size 4 text + strResult = System.Text.RegularExpressions.Regex.Replace(strResult, _ + "\[size[^>]*?=\s*[""']?([^'"" >]+?)[ '""]?\]([^\""]*)\[/size\]", _ + "$2", _ + System.Text.RegularExpressions.RegexOptions.IgnoreCase) + + ' [font=courier]some text[/font] produces courier font text + strResult = System.Text.RegularExpressions.Regex.Replace(strResult, _ + "\[font[^>]*?=\s*[""']?([^'"" >]+?)[ '""]?\]([^\""]*)\[/font\]", _ + "$2", _ + System.Text.RegularExpressions.RegexOptions.IgnoreCase) + + ' [img]http://www.vbforums.com/images/vBulletin_logo.gif[/img] + strResult = System.Text.RegularExpressions.Regex.Replace(strResult, _ + "\[img\]([^\""]*?)\[/img\]", "", _ + System.Text.RegularExpressions.RegexOptions.IgnoreCase) + + ' [quote]No. Try not. + ' Do or do not, there is no try.[/quote] + strResult = System.Text.RegularExpressions.Regex.Replace(strResult, _ + "\[quote\]([^\""]*?)\[/quote\]", _ + "


$1

", _ + System.Text.RegularExpressions.RegexOptions.IgnoreCase) + + TextBox2.Text = strResult + + End Sub +End Class diff --git a/Ch8 - Define Your Own HTML/bin/Ch8 - Define Your Own HTML.exe b/Ch8 - Define Your Own HTML/bin/Ch8 - Define Your Own HTML.exe new file mode 100644 index 0000000..27b4a47 Binary files /dev/null and b/Ch8 - Define Your Own HTML/bin/Ch8 - Define Your Own HTML.exe differ diff --git a/Ch8 - Define Your Own HTML/bin/Ch8 - Define Your Own HTML.pdb b/Ch8 - Define Your Own HTML/bin/Ch8 - Define Your Own HTML.pdb new file mode 100644 index 0000000..8ccd14f Binary files /dev/null and b/Ch8 - Define Your Own HTML/bin/Ch8 - Define Your Own HTML.pdb differ diff --git a/Ch8 - Define Your Own HTML/obj/Debug/Ch8 - Define Your Own HTML.exe b/Ch8 - Define Your Own HTML/obj/Debug/Ch8 - Define Your Own HTML.exe new file mode 100644 index 0000000..27b4a47 Binary files /dev/null and b/Ch8 - Define Your Own HTML/obj/Debug/Ch8 - Define Your Own HTML.exe differ diff --git a/Ch8 - Define Your Own HTML/obj/Debug/Ch8 - Define Your Own HTML.pdb b/Ch8 - Define Your Own HTML/obj/Debug/Ch8 - Define Your Own HTML.pdb new file mode 100644 index 0000000..8ccd14f Binary files /dev/null and b/Ch8 - Define Your Own HTML/obj/Debug/Ch8 - Define Your Own HTML.pdb differ diff --git a/Ch8 - Define Your Own HTML/obj/Debug/Ch8___Define_Your_Own_HTML.Form1.resources b/Ch8 - Define Your Own HTML/obj/Debug/Ch8___Define_Your_Own_HTML.Form1.resources new file mode 100644 index 0000000..fe49a7c Binary files /dev/null and b/Ch8 - Define Your Own HTML/obj/Debug/Ch8___Define_Your_Own_HTML.Form1.resources differ diff --git a/Ch8 - Regular Expression Listings/Expression List.txt b/Ch8 - Regular Expression Listings/Expression List.txt new file mode 100644 index 0000000..e19364e --- /dev/null +++ b/Ch8 - Regular Expression Listings/Expression List.txt @@ -0,0 +1,94 @@ +One Digit Regular Expression +Expression: ^\d$ + +One Digit In Range Regular Expression +Expression: ^[5-8]$ +(the 5 and 8 boundaries can be altered to any single digit) + +Real Number Regular Expression +Expression: ^[-+]?\d+(\.\d+)?$ + +Alphanumerical Regular Expression +Expression: ^[a-zA-Z0-9]+$ + +24-Hour HH:MM Regular Expression +Expression: ^([0-1][0-9]|[2][0-3]):([0-5][0-9])$ + +XX/XX/YYYY Date Checker Regular Expression +Expression: ^\d{1,2}(\/|-)\d{1,2}(\/|-)\d{4}$ + +File Path Regular Expression +Expression: ^([a-zA-Z]\:|\\)\\([^\\]+\\)*[^\/:*?"<>|]+\.DOC(l)?$ +(alter the DOC here to your “valid” file extension, use “IgnoreCase”) + +Repeated Words Regular Expression +Expression: \b(\w+)\s+\1\b +(use “IgnoreCase”) + +Capitalised Word Regular Expression +Expression: (\b[^\Wa-z0-9_][^\WA-Z0-9_]*\b) + +Matching Numbers Regular Expression +Expression: (\d+\.?\d*|\.\d+) + +Valid Name Regular Expression +Expression: ^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$ + +Profanity Filter Regular Expression +Expression: (\bdamn\b)|(\bhell\b) +(change to use your own words. Use “IgnoreCase” where appropriate) + +Real E-Mail Regular Expression +Expression: ^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$ + +Web Site Address Regular Expression +Expression: ^(http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?)$ + +FTP/HTTP/HTTPS URL Regular Expression +Expression: (http|ftp|https):\/\/[\w]+(.[\w]+)([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])? + +Domain Format Regular Expression +Expression: ^[a-zA-Z0-9]+([a-zA-Z0-9\-\.]+)?\.(com|org|net|mil|edu|info)$ + +IP Address Regular Expression +Expression: ^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$ + +HTML Color Code Regular Expression +Expression: ^#?([a-f]|[A-F]|[0-9]){3}(([a-f]|[A-F]|[0-9]){3})?$ + +Credit Card Regular Expression +Expression: ^((?:4\d{3})|(?:5[1-5]\d{2})|(?:6011)|(?:3[68]\d{2})|(?:30[012345]\d))[ -]?(\d{4})[ -]?(\d{4})[ -]?(\d{4}|3[4,7]\d{13})$ + +Password Format Regular Expression +Expression: ^[a-zA-Z]\w{3,14}$ + +ISBN Regular Expression +Expression: ^\d{9}[\d|X]$ + +GUID Regular Expression +Expression: ^[A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12}$ +(use “IgnoreCase”) + +US Zip Code Regular Expression +Expression: ^(^\d{5}(-\d{4})?)$ + +US Social Security Regular Expression +Expression: ^\d{3}-\d{2}-\d{4}$ + +US Phone Regular Expression +Expression: ^(?:\d{3}-)?\d{3}-\d{4}$ + +US State Regular Expression +Expression: ^A[KLRZ]$|^C[AOT]$|^D[CE]$|^FL$|^GA$|^HI$|^I[ADLN]$| ^K[SY]$|^LA$|^M[ADEINOST]$|^N[BCDHJMVY]$|^O[HKR]$|^PA$|^RI$|^S[CD]$|^T[NX]$|^UT$|^V[AT]$|^W[AIVY]$ + +UK Postal Code Regular Expression +Expression: ^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$ + +UK National Insurance Number Regular Expression +Expression: ^[A-Za-z]{2}[0-9]{6}[A-Za-z]{1}$ + +UK Telephone Number Regular Expression +Expression: (0\d{2} ?\d{4} ?\d{4}$)|(0\d{3} ?\d{3} ?\d{3}$)|(0\d{4} ?\d{3} ?\d{3}$) + +American/British Date Regular Expression +Expression: \b(?\d{1,2})/(?\d{1,2})/(?\d{2,4})\b \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..3ca5dc0 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,27 @@ +Freeware License, some rights reserved + +Copyright (c) 2003 Karl Moore + +Permission is hereby granted, free of charge, to anyone obtaining a copy +of this software and associated documentation files (the "Software"), +to work with the Software within the limits of freeware distribution and fair use. +This includes the rights to use, copy, and modify the Software for personal use. +Users are also allowed and encouraged to submit corrections and modifications +to the Software for the benefit of other users. + +It is not allowed to reuse, modify, or redistribute the Software for +commercial use in any way, or for a user’s educational materials such as books +or blog articles without prior permission from the copyright holder. + +The above copyright notice and this permission notice need to be included +in all copies or substantial portions of the software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS OR APRESS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..d838445 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +#Apress Source Code + +This repository accompanies [*The Ultimate VB .NET and ASP.NET Code Book*](http://www.apress.com/9781590591062) by Karl Moore (Apress, 2003). + +![Cover image](9781590591062.jpg) + +Download the files as a zip using the green button, or clone the repository to your machine using Git. + +##Releases + +Release v1.0 corresponds to the code in the published book, without corrections or updates. + +##Contributions + +See the file Contributing.md for more information on how you can contribute to this repository. diff --git a/ReadMe.txt.txt b/ReadMe.txt.txt new file mode 100644 index 0000000..4c1d92c --- /dev/null +++ b/ReadMe.txt.txt @@ -0,0 +1,43 @@ +Hello and welcome to the downloadable source for... + +* - * - * - * - * - * - * - * - * - * - * - * - * - * + +The Ultimate VB .NET and ASP.NET Code Book! +============================================ +by Karl Moore + +* - * - * - * - * - * - * - * - * - * - * - * - * - * + + +To get started, simply explore the folders and open the relevant projects in VS .NET. Most have been created in VS .NET 2002, yet have been tested to easily upgrade simply by opening in VS .NET 2003. + +Some projects have special setup instructions: be sure to check out the ReadMe.txt file in the folder, if available. + + +* - * - * - * - * - * - * - * - * - * - * - * - * - * + +New tips +========= + +Thousands of tips didn't make it to press because they simply didn't pack enough punch. The following list of tips didn't make it to the book... not because they weren't exciting, but because we simply couldn't fit them in. If you enjoyed the book, you'll be interested in... + + * ASP.NET: Letting the user pick a date through a pop-up window + - Read this online article and check out the online sample from my good + - friend, Don Carter. http://aspalliance.com/Colt/Articles/Article4.aspx + + * User Controls: You may have read my tip about using never being able to + overuse user controls in an ASP.NET page. You can learn more about how + to use multiple user controls on *one* Web page, showing and hiding as + appropriate, thereby allowing you to maintain one "style" of page with + minimum maintenance. Expand on my technique by reading the articles at + http://www.smartisans.com/articles/vb_templates.aspx and + http://www.fawcette.com/vsm/2001_12/magazine/columns/aspnet/default.asp + - watch out, these articles are entirely up-to-date. For example, + the Smartisans.com article refers to the ControlBase class, which has + been replaced with the Control class. Keep your eye out! + + + * More tips to be added as and when! Send your submissions to karl@karlmoore.com + + +* - * - * - * - * - * - * - * - * - * - * - * - * - * \ No newline at end of file diff --git a/contributing.md b/contributing.md new file mode 100644 index 0000000..f6005ad --- /dev/null +++ b/contributing.md @@ -0,0 +1,14 @@ +# Contributing to Apress Source Code + +Copyright for Apress source code belongs to the author(s). However, under fair use you are encouraged to fork and contribute minor corrections and updates for the benefit of the author(s) and other readers. + +## How to Contribute + +1. Make sure you have a GitHub account. +2. Fork the repository for the relevant book. +3. Create a new branch on which to make your change, e.g. +`git checkout -b my_code_contribution` +4. Commit your change. Include a commit message describing the correction. Please note that if your commit message is not clear, the correction will not be accepted. +5. Submit a pull request. + +Thank you for your contribution! \ No newline at end of file