Visual Basic
Chap05/Net Income Solution/Net Income Project/App.config
Chap05/Net Income Solution/Net Income Project/frmMain.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class frmMain Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try 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. <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() Me.PictureBox1 = New System.Windows.Forms.PictureBox() Me.lblNetIncome = New System.Windows.Forms.Label() Me.txtRevenue = New System.Windows.Forms.TextBox() Me.txtExpenses = New System.Windows.Forms.TextBox() Me.btnCalc = New System.Windows.Forms.Button() Me.btnExit = New System.Windows.Forms.Button() Me.Label1 = New System.Windows.Forms.Label() Me.Label2 = New System.Windows.Forms.Label() Me.Label3 = New System.Windows.Forms.Label() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'PictureBox1 ' Me.PictureBox1.Image = Global.Net_Income_Project.My.Resources.Resources.EdwardsAndSon Me.PictureBox1.Location = New System.Drawing.Point(59, 14) Me.PictureBox1.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.PictureBox1.Name = "PictureBox1" Me.PictureBox1.Size = New System.Drawing.Size(314, 64) Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage Me.PictureBox1.TabIndex = 0 Me.PictureBox1.TabStop = False ' 'lblNetIncome ' Me.lblNetIncome.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.lblNetIncome.Location = New System.Drawing.Point(305, 134) Me.lblNetIncome.Name = "lblNetIncome" Me.lblNetIncome.Size = New System.Drawing.Size(100, 27) Me.lblNetIncome.TabIndex = 6 Me.lblNetIncome.TextAlign = System.Drawing.ContentAlignment.MiddleCenter ' 'txtRevenue ' Me.txtRevenue.Location = New System.Drawing.Point(38, 134) Me.txtRevenue.Name = "txtRevenue" Me.txtRevenue.Size = New System.Drawing.Size(100, 27) Me.txtRevenue.TabIndex = 1 ' 'txtExpenses ' Me.txtExpenses.Location = New System.Drawing.Point(170, 134) Me.txtExpenses.Name = "txtExpenses" Me.txtExpenses.Size = New System.Drawing.Size(100, 27) Me.txtExpenses.TabIndex = 3 ' 'btnCalc ' Me.btnCalc.Location = New System.Drawing.Point(116, 207) Me.btnCalc.Name = "btnCalc" Me.btnCalc.Size = New System.Drawing.Size(83, 32) Me.btnCalc.TabIndex = 4 Me.btnCalc.Text = "&Calculate" Me.btnCalc.UseVisualStyleBackColor = True ' 'btnExit ' Me.btnExit.Location = New System.Drawing.Point(219, 207) Me.btnExit.Name = "btnExit" Me.btnExit.Size = New System.Drawing.Size(75, 32) Me.btnExit.TabIndex = 5 Me.btnExit.Text = "E&xit" Me.btnExit.UseVisualStyleBackColor = True ' 'Label1 ' Me.Label1.AutoSize = True Me.Label1.Location = New System.Drawing.Point(34, 111) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(102, 20) Me.Label1.TabIndex = 0 Me.Label1.Text = "Sales &revenue:" ' 'Label2 ' Me.Label2.AutoSize = True Me.Label2.Location = New System.Drawing.Point(166, 111) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(72, 20) Me.Label2.TabIndex = 2 Me.Label2.Text = "&Expenses:" ' 'Label3 ' Me.Label3.AutoSize = True Me.Label3.Location = New System.Drawing.Point(301, 111) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(89, 20) Me.Label3.TabIndex = 7 Me.Label3.Text = "Net income:" ' 'frmMain ' Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 20.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(432, 286) Me.Controls.Add(Me.Label3) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.btnExit) Me.Controls.Add(Me.btnCalc) Me.Controls.Add(Me.txtExpenses) Me.Controls.Add(Me.txtRevenue) Me.Controls.Add(Me.lblNetIncome) Me.Controls.Add(Me.PictureBox1) Me.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.Name = "frmMain" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Annual Net Income" CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() End Sub Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox Friend WithEvents lblNetIncome As System.Windows.Forms.Label Friend WithEvents txtRevenue As System.Windows.Forms.TextBox Friend WithEvents txtExpenses As System.Windows.Forms.TextBox Friend WithEvents btnCalc As System.Windows.Forms.Button Friend WithEvents btnExit As System.Windows.Forms.Button Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Label3 As System.Windows.Forms.Label End Class
Chap05/Net Income Solution/Net Income Project/frmMain.resx
text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 True True True True True True True True True True
Chap05/Net Income Solution/Net Income Project/frmMain.vb
' Name: Net Income Project ' Purpose: Display the annual net income ' Programmer: <your name> on <current date> Public Class frmMain Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click Me.Close() End Sub Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click ' calculates and displays the annual net income lblNetIncome.Text = Val(txtRevenue.Text) - Val(txtExpenses.Text) End Sub End Class
Chap05/Net Income Solution/Net Income Project/My Project/Application.Designer.vb
'------------------------------------------------------------------------------ ' <auto-generated> ' This code was generated by a tool. ' Runtime Version:4.0.30319.17626 ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. ' </auto-generated> '------------------------------------------------------------------------------ Option Strict On Option Explicit On Namespace My 'NOTE: This file is auto-generated; do not modify it directly. To make changes, ' or if you encounter build errors in this file, go to the Project Designer ' (go to Project Properties or double-click the My Project node in ' Solution Explorer), and make changes on the Application tab. ' Partial Friend Class MyApplication <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _ Public Sub New() MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) Me.IsSingleInstance = false Me.EnableVisualStyles = true Me.SaveMySettingsOnExit = true Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses End Sub <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _ Protected Overrides Sub OnCreateMainForm() Me.MainForm = Global.Net_Income_Project.frmMain End Sub End Class End Namespace
Chap05/Net Income Solution/Net Income Project/My Project/Application.myapp
<?xml version="1.0" encoding="utf-16"?> <MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <MySubMain>true</MySubMain> <MainForm>frmMain</MainForm> <SingleInstance>false</SingleInstance> <ShutdownMode>0</ShutdownMode> <EnableVisualStyles>true</EnableVisualStyles> <AuthenticationMode>0</AuthenticationMode> <SaveMySettingsOnExit>true</SaveMySettingsOnExit> </MyApplicationData>
Chap05/Net Income Solution/Net Income Project/My Project/AssemblyInfo.vb
Imports System 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 <Assembly: AssemblyTitle("Net Income Project")> <Assembly: AssemblyDescription("")> <Assembly: AssemblyCompany("")> <Assembly: AssemblyProduct("Net Income Project")> <Assembly: AssemblyCopyright("Copyright © 2012")> <Assembly: AssemblyTrademark("")> <Assembly: ComVisible(False)> 'The following GUID is for the ID of the typelib if this project is exposed to COM <Assembly: Guid("603452dd-3f73-4715-a9bc-52d04e926eb1")> ' 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: ' <Assembly: AssemblyVersion("1.0.*")> <Assembly: AssemblyVersion("1.0.0.0")> <Assembly: AssemblyFileVersion("1.0.0.0")>
Chap05/Net Income Solution/Net Income Project/My Project/Resources.Designer.vb
'------------------------------------------------------------------------------ ' <auto-generated> ' This code was generated by a tool. ' Runtime Version:4.0.30319.17626 ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. ' </auto-generated> '------------------------------------------------------------------------------ Option Strict On Option Explicit On Imports System Namespace My.Resources 'This class was auto-generated by the StronglyTypedResourceBuilder 'class via a tool like ResGen or Visual Studio. 'To add or remove a member, edit your .ResX file then rerun ResGen 'with the /str option, or rebuild your VS project. '''<summary> ''' A strongly-typed resource class, for looking up localized strings, etc. '''</summary> <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _ Friend Module Resources Private resourceMan As Global.System.Resources.ResourceManager Private resourceCulture As Global.System.Globalization.CultureInfo '''<summary> ''' Returns the cached ResourceManager instance used by this class. '''</summary> <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager Get If Object.ReferenceEquals(resourceMan, Nothing) Then Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Net_Income_Project.Resources", GetType(Resources).Assembly) resourceMan = temp End If Return resourceMan End Get End Property '''<summary> ''' Overrides the current thread's CurrentUICulture property for all ''' resource lookups using this strongly typed resource class. '''</summary> <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ Friend Property Culture() As Global.System.Globalization.CultureInfo Get Return resourceCulture End Get Set resourceCulture = value End Set End Property '''<summary> ''' Looks up a localized resource of type System.Drawing.Bitmap. '''</summary> Friend ReadOnly Property EdwardsAndSon() As System.Drawing.Bitmap Get Dim obj As Object = ResourceManager.GetObject("EdwardsAndSon", resourceCulture) Return CType(obj,System.Drawing.Bitmap) End Get End Property End Module End Namespace
Chap05/Net Income Solution/Net Income Project/My Project/Resources.resx
text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ..\Resources\EdwardsAndSon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Chap05/Net Income Solution/Net Income Project/My Project/Settings.Designer.vb
'------------------------------------------------------------------------------ ' <auto-generated> ' This code was generated by a tool. ' Runtime Version:4.0.30319.17626 ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. ' </auto-generated> '------------------------------------------------------------------------------ Option Strict On Option Explicit On Namespace My <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _ Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ Partial Friend NotInheritable Class MySettings Inherits Global.System.Configuration.ApplicationSettingsBase Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) #Region "My.Settings Auto-Save Functionality" #If _MyType = "WindowsForms" Then Private Shared addedHandler As Boolean Private Shared addedHandlerLockObject As New Object <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) If My.Application.SaveMySettingsOnExit Then My.Settings.Save() End If End Sub #End If #End Region Public Shared ReadOnly Property [Default]() As MySettings Get #If _MyType = "WindowsForms" Then If Not addedHandler Then SyncLock addedHandlerLockObject If Not addedHandler Then AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings addedHandler = True End If End SyncLock End If #End If Return defaultInstance End Get End Property End Class End Namespace Namespace My <Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _ Friend Module MySettingsProperty <Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _ Friend ReadOnly Property Settings() As Global.Net_Income_Project.My.MySettings Get Return Global.Net_Income_Project.My.MySettings.Default End Get End Property End Module End Namespace
Chap05/Net Income Solution/Net Income Project/My Project/Settings.settings
Chap05/Net Income Solution/Net Income Project/Net Income Project.vbproj
Debug AnyCPU {5A1F54E2-41B8-41B0-A843-8965E83905C7} WinExe Net_Income_Project.My.MyApplication Net_Income_Project Net Income Project 512 WindowsForms v4.5 AnyCPU true full true true bin\Debug\ Net Income Project.xml 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 AnyCPU pdbonly false true true bin\Release\ Net Income Project.xml 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 On Binary Off On Form frmMain.vb Form True Application.myapp True True Resources.resx True Settings.settings True frmMain.vb VbMyResourcesResXFileCodeGenerator Resources.Designer.vb My.Resources Designer MyApplicationCodeGenerator Application.Designer.vb SettingsSingleFileGenerator My Settings.Designer.vb
Chap05/Net Income Solution/Net Income Project/Resources/EdwardsAndSon.png
Chap05/Net Income Solution/Net Income Solution.sln
Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Net Income Project", "Net Income Project\Net Income Project.vbproj", "{5A1F54E2-41B8-41B0-A843-8965E83905C7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {5A1F54E2-41B8-41B0-A843-8965E83905C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5A1F54E2-41B8-41B0-A843-8965E83905C7}.Debug|Any CPU.Build.0 = Debug|Any CPU {5A1F54E2-41B8-41B0-A843-8965E83905C7}.Release|Any CPU.ActiveCfg = Release|Any CPU {5A1F54E2-41B8-41B0-A843-8965E83905C7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal