Skip to content
Snippets Groups Projects
Commit 80b13b7e authored by Rsge's avatar Rsge
Browse files

Rewritten in .NET 6

parent e615aef4
No related branches found
No related tags found
No related merge requests found
Showing
with 293 additions and 1532 deletions

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30503.244
# Visual Studio Version 17
VisualStudioVersion = 17.2.32526.322
MinimumVisualStudioVersion = 10.0.40219.1
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Deficiency-Calculator", "Deficiency-Calculator\Deficiency-Calculator.vbproj", "{F678487B-1B0E-45AD-B479-2F1F9DDC152B}"
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Deficiency Calculator", "Deficiency Calculator\Deficiency Calculator.vbproj", "{4686B742-4C08-48BB-B171-B60473E2A74E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F678487B-1B0E-45AD-B479-2F1F9DDC152B}.Debug|x86.ActiveCfg = Debug|Any CPU
{F678487B-1B0E-45AD-B479-2F1F9DDC152B}.Debug|x86.Build.0 = Debug|Any CPU
{F678487B-1B0E-45AD-B479-2F1F9DDC152B}.Release|x86.ActiveCfg = Release|Any CPU
{F678487B-1B0E-45AD-B479-2F1F9DDC152B}.Release|x86.Build.0 = Release|Any CPU
{4686B742-4C08-48BB-B171-B60473E2A74E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4686B742-4C08-48BB-B171-B60473E2A74E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4686B742-4C08-48BB-B171-B60473E2A74E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4686B742-4C08-48BB-B171-B60473E2A74E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {145593E2-0A2F-4AAD-A76A-C0C361AA2ABD}
SolutionGuid = {44E6CD54-4B4F-4275-9C41-0873019A4D43}
EndGlobalSection
EndGlobal
Imports Microsoft.VisualBasic.ApplicationServices
Namespace My
' The following events are available for MyApplication:
' Startup: Raised when the application starts, before the startup form is created.
' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
' UnhandledException: Raised if the application encounters an unhandled exception.
' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
' **NEW** ApplyApplicationDefaults: Raised when the application queries default values to be set for the application.
' Example:
' Private Sub MyApplication_ApplyApplicationDefaults(sender As Object, e As ApplyApplicationDefaultsEventArgs) Handles Me.ApplyApplicationDefaults
'
' ' Setting the application-wide default Font:
' e.Font = New Font(FontFamily.GenericSansSerif, 12, FontStyle.Regular)
'
' ' Setting the HighDpiMode for the Application:
' e.HighDpiMode = HighDpiMode.PerMonitorV2
'
' ' If a splash dialog is used, this sets the minimum display time:
' e.MinimumSplashScreenDisplayTime = 4000
' End Sub
Partial Friend Class MyApplication
End Class
End Namespace
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<RootNamespace>DeficiencyCalculator</RootNamespace>
<StartupObject>Sub Main</StartupObject>
<UseWindowsForms>true</UseWindowsForms>
<MyType>WindowsForms</MyType>
<ApplicationIcon>Calculator.ico</ApplicationIcon>
<Authors>Jan G. (Rsge)</Authors>
<FileVersion>3.0.0.0</FileVersion>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<Description>A small app to calculate the deficiency of two decimal values.</Description>
<Version>3.0.0</Version>
<Copyright>Copyright © Jan G. 2022</Copyright>
<RepositoryUrl>https://github.com/Rsge/Deficiency-Calculator</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>GPL-3.0</PackageLicenseExpression>
</PropertyGroup>
<ItemGroup>
<Import Include="System.Data" />
<Import Include="System.Drawing" />
<Import Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Update="My Project\Application.Designer.vb">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Update="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
</ItemGroup>
</Project>
\ No newline at end of file
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class MainForm
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()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(MainForm))
Me.StartButton = New System.Windows.Forms.Button()
Me.MeasuredInputLabel = New System.Windows.Forms.Label()
Me.ReferenceInputLabel = New System.Windows.Forms.Label()
Me.OutputTxt = New System.Windows.Forms.TextBox()
Me.ReferenceInputTxt = New System.Windows.Forms.TextBox()
Me.MeasuredInputTxt = New System.Windows.Forms.TextBox()
Me.SplitContainer1 = New System.Windows.Forms.SplitContainer()
CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainer1.Panel1.SuspendLayout()
Me.SplitContainer1.Panel2.SuspendLayout()
Me.SplitContainer1.SuspendLayout()
Me.SuspendLayout()
'
'StartButton
'
Me.StartButton.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.StartButton.Location = New System.Drawing.Point(12, 65)
Me.StartButton.Name = "StartButton"
Me.StartButton.Size = New System.Drawing.Size(295, 37)
Me.StartButton.TabIndex = 3
Me.StartButton.Text = "Calculate"
Me.StartButton.UseVisualStyleBackColor = True
'
'MeasuredInputLabel
'
Me.MeasuredInputLabel.AutoSize = True
Me.MeasuredInputLabel.Location = New System.Drawing.Point(3, -3)
Me.MeasuredInputLabel.Name = "MeasuredInputLabel"
Me.MeasuredInputLabel.Size = New System.Drawing.Size(114, 20)
Me.MeasuredInputLabel.TabIndex = 1
Me.MeasuredInputLabel.Text = "Measured Value"
'
'ReferenceInputLabel
'
Me.ReferenceInputLabel.AutoSize = True
Me.ReferenceInputLabel.Location = New System.Drawing.Point(3, -3)
Me.ReferenceInputLabel.Name = "ReferenceInputLabel"
Me.ReferenceInputLabel.Size = New System.Drawing.Size(115, 20)
Me.ReferenceInputLabel.TabIndex = 2
Me.ReferenceInputLabel.Text = "Reference Value"
'
'OutputTxt
'
Me.OutputTxt.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.OutputTxt.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.OutputTxt.Location = New System.Drawing.Point(12, 108)
Me.OutputTxt.Multiline = True
Me.OutputTxt.Name = "OutputTxt"
Me.OutputTxt.ReadOnly = True
Me.OutputTxt.Size = New System.Drawing.Size(295, 111)
Me.OutputTxt.TabIndex = 4
Me.OutputTxt.Text = "This program calculates the error of a measured value with a reference value usin" &
"g the following formula:" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "(Absolute(x/y - 1) + Absolute(y/x - 1)) / 2"
'
'ReferenceInputTxt
'
Me.ReferenceInputTxt.Dock = System.Windows.Forms.DockStyle.Bottom
Me.ReferenceInputTxt.Location = New System.Drawing.Point(0, 20)
Me.ReferenceInputTxt.Name = "ReferenceInputTxt"
Me.ReferenceInputTxt.Size = New System.Drawing.Size(148, 27)
Me.ReferenceInputTxt.TabIndex = 2
'
'MeasuredInputTxt
'
Me.MeasuredInputTxt.Dock = System.Windows.Forms.DockStyle.Bottom
Me.MeasuredInputTxt.Location = New System.Drawing.Point(0, 20)
Me.MeasuredInputTxt.Name = "MeasuredInputTxt"
Me.MeasuredInputTxt.Size = New System.Drawing.Size(143, 27)
Me.MeasuredInputTxt.TabIndex = 1
'
'SplitContainer1
'
Me.SplitContainer1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.SplitContainer1.Location = New System.Drawing.Point(12, 12)
Me.SplitContainer1.Name = "SplitContainer1"
'
'SplitContainer1.Panel1
'
Me.SplitContainer1.Panel1.Controls.Add(Me.MeasuredInputTxt)
Me.SplitContainer1.Panel1.Controls.Add(Me.MeasuredInputLabel)
'
'SplitContainer1.Panel2
'
Me.SplitContainer1.Panel2.Controls.Add(Me.ReferenceInputTxt)
Me.SplitContainer1.Panel2.Controls.Add(Me.ReferenceInputLabel)
Me.SplitContainer1.Size = New System.Drawing.Size(295, 47)
Me.SplitContainer1.SplitterDistance = 143
Me.SplitContainer1.TabIndex = 0
'
'MainForm
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 20.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(319, 231)
Me.Controls.Add(Me.SplitContainer1)
Me.Controls.Add(Me.OutputTxt)
Me.Controls.Add(Me.StartButton)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "MainForm"
Me.Text = "Deficiency Calculator"
Me.SplitContainer1.Panel1.ResumeLayout(False)
Me.SplitContainer1.Panel1.PerformLayout()
Me.SplitContainer1.Panel2.ResumeLayout(False)
Me.SplitContainer1.Panel2.PerformLayout()
CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).EndInit()
Me.SplitContainer1.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents StartButton As Button
Friend WithEvents MeasuredInputLabel As Label
Friend WithEvents ReferenceInputLabel As Label
Friend WithEvents OutputTxt As TextBox
Friend WithEvents ReferenceInputTxt As TextBox
Friend WithEvents MeasuredInputTxt As TextBox
Friend WithEvents SplitContainer1 As SplitContainer
End Class
......@@ -57,208 +57,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Input1Label.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="Input1Label.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 10pt</value>
</data>
<data name="Input1Label.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 11</value>
</data>
<data name="Input1Label.Size" type="System.Drawing.Size, System.Drawing">
<value>131, 23</value>
</data>
<data name="Input1Label.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="Input1Label.Text" xml:space="preserve">
<value>Ermittelter Wert</value>
</data>
<data name="&gt;&gt;Input1Label.Name" xml:space="preserve">
<value>Input1Label</value>
</data>
<data name="&gt;&gt;Input1Label.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;Input1Label.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;Input1Label.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<data name="Input2Label.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="Input2Label.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 10pt</value>
</data>
<data name="Input2Label.Location" type="System.Drawing.Point, System.Drawing">
<value>261, 11</value>
</data>
<data name="Input2Label.Size" type="System.Drawing.Size, System.Drawing">
<value>120, 23</value>
</data>
<data name="Input2Label.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
</data>
<data name="Input2Label.Text" xml:space="preserve">
<value>Vergleichswert</value>
</data>
<data name="&gt;&gt;Input2Label.Name" xml:space="preserve">
<value>Input2Label</value>
</data>
<data name="&gt;&gt;Input2Label.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;Input2Label.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;Input2Label.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="Input1Txt.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 12pt</value>
</data>
<data name="Input1Txt.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 40</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Input1Txt.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 4, 3, 4</value>
</data>
<data name="Input1Txt.Size" type="System.Drawing.Size, System.Drawing">
<value>246, 34</value>
</data>
<data name="Input1Txt.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Input1Txt.TextAlign" type="System.Windows.Forms.HorizontalAlignment, System.Windows.Forms">
<value>Right</value>
</data>
<data name="&gt;&gt;Input1Txt.Name" xml:space="preserve">
<value>Input1Txt</value>
</data>
<data name="&gt;&gt;Input1Txt.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;Input1Txt.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;Input1Txt.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="Input2Txt.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 12pt</value>
</data>
<data name="Input2Txt.Location" type="System.Drawing.Point, System.Drawing">
<value>265, 40</value>
</data>
<data name="Input2Txt.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 4, 3, 4</value>
</data>
<data name="Input2Txt.Size" type="System.Drawing.Size, System.Drawing">
<value>247, 34</value>
</data>
<data name="Input2Txt.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="Input2Txt.TextAlign" type="System.Windows.Forms.HorizontalAlignment, System.Windows.Forms">
<value>Right</value>
</data>
<data name="&gt;&gt;Input2Txt.Name" xml:space="preserve">
<value>Input2Txt</value>
</data>
<data name="&gt;&gt;Input2Txt.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;Input2Txt.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;Input2Txt.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="OutputTxt.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 10pt</value>
</data>
<data name="OutputTxt.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 141</value>
</data>
<data name="OutputTxt.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 4, 3, 4</value>
</data>
<data name="OutputTxt.Multiline" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="OutputTxt.Size" type="System.Drawing.Size, System.Drawing">
<value>499, 210</value>
</data>
<data name="OutputTxt.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="OutputTxt.Text" xml:space="preserve">
<value>Dieser Rechner berechnet den Fehler eines ermittelten Wertes
mit einem Vergleichswert mittels folgender Formel:
(Betrag( x/y - 1 ) + Betrag( y/x - 1 )) / 2
Dezimalzahlen mit einem Komma trennen.</value>
</data>
<data name="&gt;&gt;OutputTxt.Name" xml:space="preserve">
<value>OutputTxt</value>
</data>
<data name="&gt;&gt;OutputTxt.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;OutputTxt.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;OutputTxt.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="StartButton.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 16pt</value>
</data>
<data name="StartButton.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 85</value>
</data>
<data name="StartButton.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 4, 3, 4</value>
</data>
<data name="StartButton.Size" type="System.Drawing.Size, System.Drawing">
<value>499, 49</value>
</data>
<data name="StartButton.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="StartButton.Text" xml:space="preserve">
<value>Berechnen</value>
</data>
<data name="&gt;&gt;StartButton.Name" xml:space="preserve">
<value>StartButton</value>
</data>
<data name="&gt;&gt;StartButton.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;StartButton.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;StartButton.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>8, 20</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>523, 366</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
......@@ -335,19 +134,4 @@ Dezimalzahlen mit einem Komma trennen.</value>
5gfh/+YH4f/gB+H/8AfgAAAH8AAAD/gAAB8=
</value>
</data>
<data name="$this.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 4, 3, 4</value>
</data>
<data name="$this.MinimumSize" type="System.Drawing.Size, System.Drawing">
<value>541, 413</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Fehler-Rechner</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>DeficiencyCalculatorForm</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.Form, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>
\ No newline at end of file
Imports System.Math
Public Class MainForm
''' <summary>
''' Error when nothing is input.
''' </summary>
Private Shared ReadOnly _noOutputExc As String = "Without input nothing can be calculated."
''' <summary>
''' On clicking te start button, calculate deficiency.
''' </summary>
''' <param name="sender">Event sender.</param>
''' <param name="e">Triggering event.</param>
Private Sub StartButton_Click(sender As Object, e As EventArgs) Handles StartButton.Click
'Defining variables
Dim measuredValue As Double
Dim referencedValue As Double
Dim out As Double
Dim percOut As Double
'Getting input
Try
If MeasuredInputTxt.TextLength = 0 Or ReferenceInputTxt.TextLength = 0 Then
Throw New NoNullAllowedException(_noOutputExc)
End If
measuredValue = CDbl(MeasuredInputTxt.Text)
referencedValue = CDbl(ReferenceInputTxt.Text)
Catch ex As SystemException
OutputTxt.Text = Environment.NewLine & ex.Message
Exit Sub
End Try
'Calculating deficiency
out = (Abs((measuredValue / referencedValue) - 1) + Abs((referencedValue / measuredValue) - 1)) / 2
percOut = Round(out * 100, 2)
'Outputting
OutputTxt.Text = $"{out}
{percOut} %"
End Sub
End Class
......@@ -32,7 +32,7 @@ Namespace My
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.DeficiencyCalculator.DeficiencyCalculatorForm
Me.MainForm = Global.DeficiencyCalculator.MainForm
End Sub
End Class
End Namespace
<?xml version="1.0" encoding="utf-16"?>
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>true</MySubMain>
<MainForm>DeficiencyCalculatorForm</MainForm>
<MainForm>MainForm</MainForm>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<OutputType>WinExe</OutputType>
<StartupObject>DeficiencyCalculator.My.MyApplication</StartupObject>
<RootNamespace>DeficiencyCalculator</RootNamespace>
<AssemblyName>DeficiencyCalculator</AssemblyName>
<MyType>WindowsForms</MyType>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>C:\Users\Rsge\Downloads\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DocumentationFile>DeficiencyCalculator.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DefineDebug>false</DefineDebug>
<DocumentationFile>DeficiencyCalculator.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>calculator.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>5FE47044102702807C89369D194E9FE2D40326F3</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>Deficiency-Calculator_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>false</SignManifests>
<PackageId>Deficiency Calculator</PackageId>
<Authors>Jan G. (Rsge)</Authors>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/Rsge/Deficiency-Calculator</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
<Import Include="System.Drawing" />
<Import Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Update="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<Compile Update="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Update="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Update="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Update="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="calculator.ico" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 und x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.3.252501">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Windows.Compatibility" Version="5.0.2" />
</ItemGroup>
</Project>
\ No newline at end of file
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class DeficiencyCalculatorForm
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<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
'Wird vom Windows Form-Designer benötigt.
Private components As System.ComponentModel.IContainer
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(DeficiencyCalculatorForm))
Me.Input1Label = New System.Windows.Forms.Label()
Me.Input2Label = New System.Windows.Forms.Label()
Me.Input1Txt = New System.Windows.Forms.TextBox()
Me.Input2Txt = New System.Windows.Forms.TextBox()
Me.OutputTxt = New System.Windows.Forms.TextBox()
Me.StartButton = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Input1Label
'
resources.ApplyResources(Me.Input1Label, "Input1Label")
Me.Input1Label.Name = "Input1Label"
'
'Input2Label
'
resources.ApplyResources(Me.Input2Label, "Input2Label")
Me.Input2Label.Name = "Input2Label"
'
'Input1Txt
'
resources.ApplyResources(Me.Input1Txt, "Input1Txt")
Me.Input1Txt.Name = "Input1Txt"
'
'Input2Txt
'
resources.ApplyResources(Me.Input2Txt, "Input2Txt")
Me.Input2Txt.Name = "Input2Txt"
'
'OutputTxt
'
Me.OutputTxt.BorderStyle = System.Windows.Forms.BorderStyle.None
resources.ApplyResources(Me.OutputTxt, "OutputTxt")
Me.OutputTxt.Name = "OutputTxt"
Me.OutputTxt.ReadOnly = True
'
'StartButton
'
resources.ApplyResources(Me.StartButton, "StartButton")
Me.StartButton.Name = "StartButton"
Me.StartButton.UseVisualStyleBackColor = True
'
'DeficiencyCalculatorForm
'
resources.ApplyResources(Me, "$this")
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.Controls.Add(Me.StartButton)
Me.Controls.Add(Me.OutputTxt)
Me.Controls.Add(Me.Input2Txt)
Me.Controls.Add(Me.Input1Txt)
Me.Controls.Add(Me.Input2Label)
Me.Controls.Add(Me.Input1Label)
Me.Name = "DeficiencyCalculatorForm"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents Input1Label As System.Windows.Forms.Label
Friend WithEvents Input2Label As System.Windows.Forms.Label
Friend WithEvents Input1Txt As System.Windows.Forms.TextBox
Friend WithEvents Input2Txt As System.Windows.Forms.TextBox
Friend WithEvents OutputTxt As System.Windows.Forms.TextBox
Friend WithEvents StartButton As System.Windows.Forms.Button
End Class
This diff is collapsed.
This diff is collapsed.
Imports System.Data
Imports System.Math
Public Class DeficiencyCalculatorForm
Private Shared ReadOnly NoOutputExc As String = "Without input nothing can be calculated.;Ohne Eingabe kann nichts berechnet werden."
Private Shared ReadOnly InvalidFormatExc As String = "Invalid conversion of string {} in type Double.;Ungültige Konvertierung von der Zeichenfolge {} in Typ Double."
Private Sub StartButton_Click(sender As System.Object, e As System.EventArgs) Handles StartButton.Click
Dim In1 As Double
Dim In2 As Double
Dim Out As Double
Dim PercOut As Double
Dim Txt As String()
Try
If (Input1Txt.Text = "") Or (Input2Txt.Text = "") Then
Throw New NoNullAllowedException(NoOutputExc)
End If
If (Not IsNumeric(Input1Txt.Text) OrElse Not IsNumeric(Input2Txt.Text)) OrElse (Input1Txt.Text.Contains(".")) Then
Throw New InvalidCastException(InvalidFormatExc.Replace("{}", Input1Txt.Text))
ElseIf (Input2Txt.Text.Contains(".")) Then
Throw New InvalidCastException(InvalidFormatExc.Replace("{}", Input2Txt.Text))
End If
In1 = Input1Txt.Text
In2 = Input2Txt.Text
Out = (Abs((In1 / In2) - 1) + Abs((In2 / In1) - 1)) / 2
PercOut = Round(Out * 100, 2)
OutputTxt.Text = vbCrLf & Out.ToString & vbCrLf & vbCrLf & "≈" & vbCrLf & vbCrLf & PercOut.ToString & " %"
Catch ex As SystemException
Txt = ex.Message.Split(";")
OutputTxt.Text = vbCrLf & Txt(0) & vbCrLf & "Please use a comma for decimal numbers." & vbCrLf & vbCrLf & Txt(1) & vbCrLf & "Bitte nur mit Komma getrennte Dezimalzahlen verwenden."
End Try
End Sub
End Class
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' Allgemeine Informationen über eine Assembly werden über die folgenden
' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
' die mit einer Assembly verknüpft sind.
' Die Werte der Assemblyattribute überprüfen
<Assembly: AssemblyTitle("WindowsApplication1")>
<Assembly: AssemblyDescription("A small app to calculate the deficiency of two decimal values.")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("Deficiency Calculator")>
<Assembly: AssemblyCopyright("GPL-3.0")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
<Assembly: Guid("03634bbe-d545-4415-8c58-5c9dcae3640f")>
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
'
' Hauptversion
' Nebenversion
' Buildnummer
' Revision
'
' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.0.0.0")>
<Assembly: AssemblyFileVersion("2.0.0.0")>
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' 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", "16.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("DeficiencyCalculator.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
End Module
End Namespace
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' 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 DeficiencyCalculator.My_Project
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.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(sender As Global.System.Object, 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.DeficiencyCalculator.DeficiencyCalculator.My_Project.MySettings
Get
Return Global.DeficiencyCalculator.DeficiencyCalculator.My_Project.MySettings.Default
End Get
End Property
End Module
End Namespace
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment