From 222e4d956f485174e9ed87aae5d2d3dd4e4a5973 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Fri, 19 Feb 2021 20:50:49 +0200 Subject: Added the two most recent VB.Net projects - MaxMin and catalog --- Visual Basic Projects/catalog/catalog.sln | 25 ++++ .../catalog/catalog/ApplicationEvents.vb | 22 ++++ .../catalog/catalog/Form1.Designer.vb | 146 +++++++++++++++++++++ Visual Basic Projects/catalog/catalog/Form1.resx | 60 +++++++++ Visual Basic Projects/catalog/catalog/Form1.vb | 65 +++++++++ .../My Project/Application.Designer.HighDpi.vb | 69 ++++++++++ .../catalog/My Project/Application.Designer.vb | 38 ++++++ .../catalog/catalog/My Project/Application.myapp | 10 ++ .../catalog/catalog/catalog.vbproj | 33 +++++ .../catalog/catalog/catalog.vbproj.user | 8 ++ 10 files changed, 476 insertions(+) create mode 100644 Visual Basic Projects/catalog/catalog.sln create mode 100644 Visual Basic Projects/catalog/catalog/ApplicationEvents.vb create mode 100644 Visual Basic Projects/catalog/catalog/Form1.Designer.vb create mode 100644 Visual Basic Projects/catalog/catalog/Form1.resx create mode 100644 Visual Basic Projects/catalog/catalog/Form1.vb create mode 100644 Visual Basic Projects/catalog/catalog/My Project/Application.Designer.HighDpi.vb create mode 100644 Visual Basic Projects/catalog/catalog/My Project/Application.Designer.vb create mode 100644 Visual Basic Projects/catalog/catalog/My Project/Application.myapp create mode 100644 Visual Basic Projects/catalog/catalog/catalog.vbproj create mode 100644 Visual Basic Projects/catalog/catalog/catalog.vbproj.user (limited to 'Visual Basic Projects/catalog') diff --git a/Visual Basic Projects/catalog/catalog.sln b/Visual Basic Projects/catalog/catalog.sln new file mode 100644 index 0000000..d0fa698 --- /dev/null +++ b/Visual Basic Projects/catalog/catalog.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31005.135 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "catalog", "catalog\catalog.vbproj", "{FA219779-9B80-45C5-9614-7DE9493ABF12}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FA219779-9B80-45C5-9614-7DE9493ABF12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA219779-9B80-45C5-9614-7DE9493ABF12}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA219779-9B80-45C5-9614-7DE9493ABF12}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA219779-9B80-45C5-9614-7DE9493ABF12}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {47CF79BF-BA4A-4B4A-9574-FD06C0060079} + EndGlobalSection +EndGlobal diff --git a/Visual Basic Projects/catalog/catalog/ApplicationEvents.vb b/Visual Basic Projects/catalog/catalog/ApplicationEvents.vb new file mode 100644 index 0000000..b892537 --- /dev/null +++ b/Visual Basic Projects/catalog/catalog/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/Visual Basic Projects/catalog/catalog/Form1.Designer.vb b/Visual Basic Projects/catalog/catalog/Form1.Designer.vb new file mode 100644 index 0000000..7337d03 --- /dev/null +++ b/Visual Basic Projects/catalog/catalog/Form1.Designer.vb @@ -0,0 +1,146 @@ + +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.cbProducts = New System.Windows.Forms.ComboBox() + Me.lblProducts = New System.Windows.Forms.Label() + Me.lblProductPriceLabel = New System.Windows.Forms.Label() + Me.lblProductPrice = New System.Windows.Forms.Label() + Me.btnAddProduct = New System.Windows.Forms.Button() + Me.btnRemoveProduct = New System.Windows.Forms.Button() + Me.lbChosenProducts = New System.Windows.Forms.ListBox() + Me.lblSumLabel = New System.Windows.Forms.Label() + Me.lblSum = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'cbProducts + ' + Me.cbProducts.FormattingEnabled = True + Me.cbProducts.Location = New System.Drawing.Point(17, 53) + Me.cbProducts.Name = "cbProducts" + Me.cbProducts.Size = New System.Drawing.Size(289, 23) + Me.cbProducts.TabIndex = 0 + ' + 'lblProducts + ' + Me.lblProducts.AutoSize = True + Me.lblProducts.Location = New System.Drawing.Point(17, 22) + Me.lblProducts.Name = "lblProducts" + Me.lblProducts.Size = New System.Drawing.Size(98, 15) + Me.lblProducts.TabIndex = 1 + Me.lblProducts.Text = "Избери продукт:" + ' + 'lblProductPriceLabel + ' + Me.lblProductPriceLabel.AutoSize = True + Me.lblProductPriceLabel.Location = New System.Drawing.Point(28, 94) + Me.lblProductPriceLabel.Name = "lblProductPriceLabel" + Me.lblProductPriceLabel.Size = New System.Drawing.Size(107, 15) + Me.lblProductPriceLabel.TabIndex = 2 + Me.lblProductPriceLabel.Text = "Цена на продукта:" + ' + 'lblProductPrice + ' + Me.lblProductPrice.AutoSize = True + Me.lblProductPrice.Location = New System.Drawing.Point(210, 94) + Me.lblProductPrice.Name = "lblProductPrice" + Me.lblProductPrice.Size = New System.Drawing.Size(32, 15) + Me.lblProductPrice.TabIndex = 3 + Me.lblProductPrice.Text = "0 лв." + ' + 'btnAddProduct + ' + Me.btnAddProduct.Location = New System.Drawing.Point(17, 134) + Me.btnAddProduct.Name = "btnAddProduct" + Me.btnAddProduct.Size = New System.Drawing.Size(118, 39) + Me.btnAddProduct.TabIndex = 4 + Me.btnAddProduct.Text = "Добави" + Me.btnAddProduct.UseVisualStyleBackColor = True + ' + 'btnRemoveProduct + ' + Me.btnRemoveProduct.Location = New System.Drawing.Point(17, 179) + Me.btnRemoveProduct.Name = "btnRemoveProduct" + Me.btnRemoveProduct.Size = New System.Drawing.Size(118, 36) + Me.btnRemoveProduct.TabIndex = 5 + Me.btnRemoveProduct.Text = "Премахни" + Me.btnRemoveProduct.UseVisualStyleBackColor = True + ' + 'lbChosenProducts + ' + Me.lbChosenProducts.FormattingEnabled = True + Me.lbChosenProducts.ItemHeight = 15 + Me.lbChosenProducts.Location = New System.Drawing.Point(141, 120) + Me.lbChosenProducts.Name = "lbChosenProducts" + Me.lbChosenProducts.Size = New System.Drawing.Size(165, 109) + Me.lbChosenProducts.TabIndex = 6 + ' + 'lblSumLabel + ' + Me.lblSumLabel.AutoSize = True + Me.lblSumLabel.Location = New System.Drawing.Point(94, 245) + Me.lblSumLabel.Name = "lblSumLabel" + Me.lblSumLabel.Size = New System.Drawing.Size(41, 15) + Me.lblSumLabel.TabIndex = 7 + Me.lblSumLabel.Text = "СУМА" + ' + 'lblSum + ' + Me.lblSum.AutoSize = True + Me.lblSum.Location = New System.Drawing.Point(141, 245) + Me.lblSum.Name = "lblSum" + Me.lblSum.Size = New System.Drawing.Size(32, 15) + Me.lblSum.TabIndex = 8 + Me.lblSum.Text = "0 лв." + ' + 'Form1 + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 15.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(324, 275) + Me.Controls.Add(Me.lblSum) + Me.Controls.Add(Me.lblSumLabel) + Me.Controls.Add(Me.lbChosenProducts) + Me.Controls.Add(Me.btnRemoveProduct) + Me.Controls.Add(Me.btnAddProduct) + Me.Controls.Add(Me.lblProductPrice) + Me.Controls.Add(Me.lblProductPriceLabel) + Me.Controls.Add(Me.lblProducts) + Me.Controls.Add(Me.cbProducts) + Me.Name = "Form1" + Me.Text = "Пазаруване по каталог" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents cbProducts As ComboBox + Friend WithEvents lblProducts As Label + Friend WithEvents lblProductPriceLabel As Label + Friend WithEvents lblProductPrice As Label + Friend WithEvents btnAddProduct As Button + Friend WithEvents btnRemoveProduct As Button + Friend WithEvents lbChosenProducts As ListBox + Friend WithEvents lblSumLabel As Label + Friend WithEvents lblSum As Label +End Class \ No newline at end of file diff --git a/Visual Basic Projects/catalog/catalog/Form1.resx b/Visual Basic Projects/catalog/catalog/Form1.resx new file mode 100644 index 0000000..b5ae26c --- /dev/null +++ b/Visual Basic Projects/catalog/catalog/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/Visual Basic Projects/catalog/catalog/Form1.vb b/Visual Basic Projects/catalog/catalog/Form1.vb new file mode 100644 index 0000000..71af62b --- /dev/null +++ b/Visual Basic Projects/catalog/catalog/Form1.vb @@ -0,0 +1,65 @@ +Public Class Form1 + Dim Sum As Double + Dim Products As String() = { + "Магнитни наколенки", + "Магнитен колан", + "Магни Иър", + "Масажираща седалка", + "Сауна за лице", + "Електрическо одеяло", + "Инфраред масажор за тяло", + "Гривна за баланс", + "Цитрус джусер", + "Апарат за кръвно налягане" + } + Dim Prices As Single() = { + 59.9, + 39.9, + 39.9, + 59.9, + 49.9, + 56.9, + 147.0, + 54.9, + 49.9, + 109.8 + } + + Private Function ToCurrency(Optional value As Double = 0) As String + Return FormatCurrency(value, 2) + End Function + + Private Sub Form_Load(sender As Object, e As EventArgs) Handles MyBase.Load + cbProducts.Items.AddRange(Products) + lblSum.Text = ToCurrency() + lblProductPrice.Text = ToCurrency() + End Sub + + Private Sub cbProducts_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbProducts.SelectedIndexChanged + lblProductPrice.Text = ToCurrency(Prices(cbProducts.SelectedIndex)) + End Sub + + Private Sub btnAddProduct_Click(sender As Object, e As EventArgs) Handles btnAddProduct.Click + If String.IsNullOrEmpty(cbProducts.Text) Then + Return + End If + + lbChosenProducts.Items.Add(cbProducts.Text) + Sum += Prices(cbProducts.SelectedIndex) + lblSum.Text = ToCurrency(Sum) + End Sub + + Private Sub btnRemoveProduct_Click(sender As Object, e As EventArgs) Handles btnRemoveProduct.Click + If String.IsNullOrEmpty(cbProducts.Text) Then + Return + End If + + If Not lbChosenProducts.Items.Contains(cbProducts.SelectedItem) Then + Return + End If + + lbChosenProducts.Items.Remove(cbProducts.SelectedItem) + Sum -= Prices(cbProducts.SelectedIndex) + lblSum.Text = ToCurrency(Sum) + End Sub +End Class \ No newline at end of file diff --git a/Visual Basic Projects/catalog/catalog/My Project/Application.Designer.HighDpi.vb b/Visual Basic Projects/catalog/catalog/My Project/Application.Designer.HighDpi.vb new file mode 100644 index 0000000..a3576c4 --- /dev/null +++ b/Visual Basic Projects/catalog/catalog/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/Visual Basic Projects/catalog/catalog/My Project/Application.Designer.vb b/Visual Basic Projects/catalog/catalog/My Project/Application.Designer.vb new file mode 100644 index 0000000..8b8d4fc --- /dev/null +++ b/Visual Basic Projects/catalog/catalog/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/Visual Basic Projects/catalog/catalog/My Project/Application.myapp b/Visual Basic Projects/catalog/catalog/My Project/Application.myapp new file mode 100644 index 0000000..fbb5858 --- /dev/null +++ b/Visual Basic Projects/catalog/catalog/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + true + Form1 + false + 0 + true + 0 + true + \ No newline at end of file diff --git a/Visual Basic Projects/catalog/catalog/catalog.vbproj b/Visual Basic Projects/catalog/catalog/catalog.vbproj new file mode 100644 index 0000000..76fdf00 --- /dev/null +++ b/Visual Basic Projects/catalog/catalog/catalog.vbproj @@ -0,0 +1,33 @@ + + + + WinExe + net5.0-windows + catalog + Sub Main + true + WindowsForms + + + + + + + + + + + True + True + Application.myapp + + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + + \ No newline at end of file diff --git a/Visual Basic Projects/catalog/catalog/catalog.vbproj.user b/Visual Basic Projects/catalog/catalog/catalog.vbproj.user new file mode 100644 index 0000000..c392cf0 --- /dev/null +++ b/Visual Basic Projects/catalog/catalog/catalog.vbproj.user @@ -0,0 +1,8 @@ + + + + + Form + + + -- cgit v1.2.3