From 1d36ce5429cec1dab418203ad34fca4baa75e5a3 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 23 Mar 2021 12:26:51 +0200 Subject: Added the EnglishNumbers VB.Net project --- VB.Net Projects/EnglishNumbers/EnglishNumbers.sln | 25 +++++ .../EnglishNumbers/ApplicationEvents.vb | 22 ++++ .../EnglishNumbers/EnglishNumbers.vbproj | 33 ++++++ .../EnglishNumbers/EnglishNumbers.vbproj.user | 8 ++ .../EnglishNumbers/Form1.Designer.vb | 112 +++++++++++++++++++++ .../EnglishNumbers/EnglishNumbers/Form1.resx | 60 +++++++++++ .../EnglishNumbers/EnglishNumbers/Form1.vb | 34 +++++++ .../My Project/Application.Designer.HighDpi.vb | 69 +++++++++++++ .../My Project/Application.Designer.vb | 38 +++++++ .../EnglishNumbers/My Project/Application.myapp | 10 ++ 10 files changed, 411 insertions(+) create mode 100644 VB.Net Projects/EnglishNumbers/EnglishNumbers.sln create mode 100644 VB.Net Projects/EnglishNumbers/EnglishNumbers/ApplicationEvents.vb create mode 100644 VB.Net Projects/EnglishNumbers/EnglishNumbers/EnglishNumbers.vbproj create mode 100644 VB.Net Projects/EnglishNumbers/EnglishNumbers/EnglishNumbers.vbproj.user create mode 100644 VB.Net Projects/EnglishNumbers/EnglishNumbers/Form1.Designer.vb create mode 100644 VB.Net Projects/EnglishNumbers/EnglishNumbers/Form1.resx create mode 100644 VB.Net Projects/EnglishNumbers/EnglishNumbers/Form1.vb create mode 100644 VB.Net Projects/EnglishNumbers/EnglishNumbers/My Project/Application.Designer.HighDpi.vb create mode 100644 VB.Net Projects/EnglishNumbers/EnglishNumbers/My Project/Application.Designer.vb create mode 100644 VB.Net Projects/EnglishNumbers/EnglishNumbers/My Project/Application.myapp (limited to 'VB.Net Projects/EnglishNumbers') diff --git a/VB.Net Projects/EnglishNumbers/EnglishNumbers.sln b/VB.Net Projects/EnglishNumbers/EnglishNumbers.sln new file mode 100644 index 0000000..bef9ff4 --- /dev/null +++ b/VB.Net Projects/EnglishNumbers/EnglishNumbers.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31105.61 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EnglishNumbers", "EnglishNumbers\EnglishNumbers.vbproj", "{C4F451BC-0479-4B62-917A-46C2A7A8CC0A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C4F451BC-0479-4B62-917A-46C2A7A8CC0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C4F451BC-0479-4B62-917A-46C2A7A8CC0A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C4F451BC-0479-4B62-917A-46C2A7A8CC0A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C4F451BC-0479-4B62-917A-46C2A7A8CC0A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BC575B04-D155-4F38-9746-3BAA4C1FD2D3} + EndGlobalSection +EndGlobal diff --git a/VB.Net Projects/EnglishNumbers/EnglishNumbers/ApplicationEvents.vb b/VB.Net Projects/EnglishNumbers/EnglishNumbers/ApplicationEvents.vb new file mode 100644 index 0000000..b892537 --- /dev/null +++ b/VB.Net Projects/EnglishNumbers/EnglishNumbers/ApplicationEvents.vb @@ -0,0 +1,22 @@ +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** ApplyHighDpiMode: Raised when the application queries the HighDpiMode to set it for the application. + + ' Example: + + ' Private Sub MyApplication_ApplyHighDpiMode(sender As Object, e As ApplyHighDpiModeEventArgs) Handles Me.ApplyHighDpiMode + ' e.HighDpiMode = HighDpiMode.PerMonitorV2 + ' End Sub + + Partial Friend Class MyApplication + + End Class +End Namespace diff --git a/VB.Net Projects/EnglishNumbers/EnglishNumbers/EnglishNumbers.vbproj b/VB.Net Projects/EnglishNumbers/EnglishNumbers/EnglishNumbers.vbproj new file mode 100644 index 0000000..68335de --- /dev/null +++ b/VB.Net Projects/EnglishNumbers/EnglishNumbers/EnglishNumbers.vbproj @@ -0,0 +1,33 @@ + + + + WinExe + net5.0-windows + EnglishNumbers + Sub Main + true + WindowsForms + + + + + + + + + + + True + True + Application.myapp + + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + + \ No newline at end of file diff --git a/VB.Net Projects/EnglishNumbers/EnglishNumbers/EnglishNumbers.vbproj.user b/VB.Net Projects/EnglishNumbers/EnglishNumbers/EnglishNumbers.vbproj.user new file mode 100644 index 0000000..c392cf0 --- /dev/null +++ b/VB.Net Projects/EnglishNumbers/EnglishNumbers/EnglishNumbers.vbproj.user @@ -0,0 +1,8 @@ + + + + + Form + + + diff --git a/VB.Net Projects/EnglishNumbers/EnglishNumbers/Form1.Designer.vb b/VB.Net Projects/EnglishNumbers/EnglishNumbers/Form1.Designer.vb new file mode 100644 index 0000000..d4d0c8e --- /dev/null +++ b/VB.Net Projects/EnglishNumbers/EnglishNumbers/Form1.Designer.vb @@ -0,0 +1,112 @@ + _ +Partial Class Form1 + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + 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. + _ + Private Sub InitializeComponent() + Me.Label1 = New System.Windows.Forms.Label() + Me.Label2 = New System.Windows.Forms.Label() + Me.lblResult = New System.Windows.Forms.Label() + Me.cbNumberNames = New System.Windows.Forms.ComboBox() + Me.txtNumberGuess = New System.Windows.Forms.TextBox() + Me.btnCheck = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(12, 32) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(146, 15) + Me.Label1.TabIndex = 0 + Me.Label1.Text = "Наименование на число:" + ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(12, 64) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(99, 15) + Me.Label2.TabIndex = 1 + Me.Label2.Text = "Въведено число:" + ' + 'lblResult + ' + Me.lblResult.AutoSize = True + Me.lblResult.Location = New System.Drawing.Point(258, 114) + Me.lblResult.Name = "lblResult" + Me.lblResult.Size = New System.Drawing.Size(27, 15) + Me.lblResult.TabIndex = 2 + Me.lblResult.Text = "ERR" + ' + 'cbNumberNames + ' + Me.cbNumberNames.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.cbNumberNames.FormattingEnabled = True + Me.cbNumberNames.Location = New System.Drawing.Point(172, 29) + Me.cbNumberNames.Name = "cbNumberNames" + Me.cbNumberNames.Size = New System.Drawing.Size(213, 23) + Me.cbNumberNames.TabIndex = 3 + ' + 'txtNumberGuess + ' + Me.txtNumberGuess.Location = New System.Drawing.Point(172, 61) + Me.txtNumberGuess.Name = "txtNumberGuess" + Me.txtNumberGuess.Size = New System.Drawing.Size(213, 23) + Me.txtNumberGuess.TabIndex = 4 + ' + 'btnCheck + ' + Me.btnCheck.Location = New System.Drawing.Point(12, 110) + Me.btnCheck.Name = "btnCheck" + Me.btnCheck.Size = New System.Drawing.Size(146, 23) + Me.btnCheck.TabIndex = 5 + Me.btnCheck.Text = "Провери" + Me.btnCheck.UseVisualStyleBackColor = True + ' + 'Form1 + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 15.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(401, 160) + Me.Controls.Add(Me.btnCheck) + Me.Controls.Add(Me.txtNumberGuess) + Me.Controls.Add(Me.cbNumberNames) + Me.Controls.Add(Me.lblResult) + Me.Controls.Add(Me.Label2) + Me.Controls.Add(Me.Label1) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog + Me.MaximizeBox = False + Me.MinimizeBox = False + Me.Name = "Form1" + Me.Text = "English Numbers" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents Label1 As Label + Friend WithEvents Label2 As Label + Friend WithEvents lblResult As Label + Friend WithEvents cbNumberNames As ComboBox + Friend WithEvents txtNumberGuess As TextBox + Friend WithEvents btnCheck As Button +End Class diff --git a/VB.Net Projects/EnglishNumbers/EnglishNumbers/Form1.resx b/VB.Net Projects/EnglishNumbers/EnglishNumbers/Form1.resx new file mode 100644 index 0000000..b5ae26c --- /dev/null +++ b/VB.Net Projects/EnglishNumbers/EnglishNumbers/Form1.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/VB.Net Projects/EnglishNumbers/EnglishNumbers/Form1.vb b/VB.Net Projects/EnglishNumbers/EnglishNumbers/Form1.vb new file mode 100644 index 0000000..c967b53 --- /dev/null +++ b/VB.Net Projects/EnglishNumbers/EnglishNumbers/Form1.vb @@ -0,0 +1,34 @@ +Imports System.ComponentModel + +Public Class Form1 + Private ReadOnly numberNames = New BindingList(Of String) From { + "Zero", + "One", + "Two", + "Three", + "Four", + "Five", + "Six", + "Seven", + "Eight", + "Nine", + "Ten" + } + + Private Sub Init() Handles Me.Load + cbNumberNames.DataSource = numberNames + lblResult.Text = String.Empty + End Sub + + Private Sub CheckGuess() Handles btnCheck.Click + ' Val makes the String a number by removing all non-number characters, + ' but if there are no numbers, it returns 0, which mustn't happen + If cbNumberNames.SelectedIndex = Val(txtNumberGuess.Text) And txtNumberGuess.Text.Any(Function(x) Char.IsDigit(x)) Then + lblResult.Text = "Вярно!" + lblResult.ForeColor = Color.Green + Else + lblResult.Text = "Грешно!" + lblResult.ForeColor = Color.Red + End If + End Sub +End Class \ No newline at end of file diff --git a/VB.Net Projects/EnglishNumbers/EnglishNumbers/My Project/Application.Designer.HighDpi.vb b/VB.Net Projects/EnglishNumbers/EnglishNumbers/My Project/Application.Designer.HighDpi.vb new file mode 100644 index 0000000..a3576c4 --- /dev/null +++ b/VB.Net Projects/EnglishNumbers/EnglishNumbers/My Project/Application.Designer.HighDpi.vb @@ -0,0 +1,69 @@ +Option Strict On +Option Explicit On + +'This constant indicates whether the Application Framework is in use. +#Const APPLICATION_FRAMEWORK = True + +#If APPLICATION_FRAMEWORK Then + +#If NET5_0 And Not NET6_0 Then + +Imports System.Collections.ObjectModel + +Namespace My + + Partial Friend Class MyApplication + + Public Event ApplyHighDpiMode(sender As Object, e As ApplyHighDpiModeEventArgs) + + Private _highDpiMode As HighDpiMode? + + Friend Shadows Property HighDpiMode As HighDpiMode + Get + Return If( + _highDpiMode Is Nothing, + Application.HighDpiMode, + _highDpiMode.Value) + End Get + Set(value As HighDpiMode) + _highDpiMode = value + End Set + End Property + + ' IMPORTANT: + ' If this method causes an compilation error after you've unchecked 'Application Framework' + ' in the project properties, go to the top of this file and change the value to 'False' in this line: + ' #Const APPLICATION_FRAMEWORK = False + + ' For more about using WinForms without the Application Framework + ' see: https://aka.ms/visualbasic-appframework-net5 + Protected Overrides Function OnInitialize(commandLineArgs As ReadOnlyCollection(Of String)) As Boolean + Dim eventArgs = New ApplyHighDpiModeEventArgs( + If( + _highDpiMode Is Nothing, + HighDpiMode.SystemAware, + _highDpiMode.Value)) + + RaiseEvent ApplyHighDpiMode(Me, eventArgs) + + Windows.Forms.Application.SetHighDpiMode(eventArgs.HighDpiMode) + + Return MyBase.OnInitialize(commandLineArgs) + End Function + End Class + + Public Class ApplyHighDpiModeEventArgs + Inherits EventArgs + + Public Sub New(highDpiMode As HighDpiMode) + Me.HighDpiMode = highDpiMode + End Sub + + Public Property HighDpiMode As HighDpiMode + + End Class + +End Namespace + +#End If ' #If NET5_0 And Not NET6_0 +#End If ' #If APPLICATION_FRAMEWORK diff --git a/VB.Net Projects/EnglishNumbers/EnglishNumbers/My Project/Application.Designer.vb b/VB.Net Projects/EnglishNumbers/EnglishNumbers/My Project/Application.Designer.vb new file mode 100644 index 0000000..8b8d4fc --- /dev/null +++ b/VB.Net Projects/EnglishNumbers/EnglishNumbers/My Project/Application.Designer.vb @@ -0,0 +1,38 @@ +'------------------------------------------------------------------------------ +' +' 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. +' +'------------------------------------------------------------------------------ + +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 + + + 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 + + + Protected Overrides Sub OnCreateMainForm() + Me.MainForm = Form1 + End Sub + End Class +End Namespace diff --git a/VB.Net Projects/EnglishNumbers/EnglishNumbers/My Project/Application.myapp b/VB.Net Projects/EnglishNumbers/EnglishNumbers/My Project/Application.myapp new file mode 100644 index 0000000..fbb5858 --- /dev/null +++ b/VB.Net Projects/EnglishNumbers/EnglishNumbers/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + true + Form1 + false + 0 + true + 0 + true + \ No newline at end of file -- cgit v1.2.3