From 930acef4b43079c365b53ddae6520d39ca044114 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Fri, 5 Mar 2021 16:58:46 +0200 Subject: Added the Bookstore VB.Net project --- VB.Net Projects/Bookstore/Bookstore.sln | 25 ++ .../Bookstore/Bookstore/ApplicationEvents.vb | 22 + VB.Net Projects/Bookstore/Bookstore/Book.vb | 36 ++ .../Bookstore/Bookstore/Bookstore.vbproj | 37 ++ .../Bookstore/Bookstore/Bookstore.vbproj.user | 8 + .../Bookstore/Bookstore/Form1.Designer.vb | 446 +++++++++++++++++++++ VB.Net Projects/Bookstore/Bookstore/Form1.resx | 60 +++ VB.Net Projects/Bookstore/Bookstore/Form1.vb | 99 +++++ .../My Project/Application.Designer.HighDpi.vb | 69 ++++ .../Bookstore/My Project/Application.Designer.vb | 38 ++ .../Bookstore/My Project/Application.myapp | 10 + VB.Net Projects/Bookstore/Bookstore/Purchase.vb | 15 + 12 files changed, 865 insertions(+) create mode 100644 VB.Net Projects/Bookstore/Bookstore.sln create mode 100644 VB.Net Projects/Bookstore/Bookstore/ApplicationEvents.vb create mode 100644 VB.Net Projects/Bookstore/Bookstore/Book.vb create mode 100644 VB.Net Projects/Bookstore/Bookstore/Bookstore.vbproj create mode 100644 VB.Net Projects/Bookstore/Bookstore/Bookstore.vbproj.user create mode 100644 VB.Net Projects/Bookstore/Bookstore/Form1.Designer.vb create mode 100644 VB.Net Projects/Bookstore/Bookstore/Form1.resx create mode 100644 VB.Net Projects/Bookstore/Bookstore/Form1.vb create mode 100644 VB.Net Projects/Bookstore/Bookstore/My Project/Application.Designer.HighDpi.vb create mode 100644 VB.Net Projects/Bookstore/Bookstore/My Project/Application.Designer.vb create mode 100644 VB.Net Projects/Bookstore/Bookstore/My Project/Application.myapp create mode 100644 VB.Net Projects/Bookstore/Bookstore/Purchase.vb (limited to 'VB.Net Projects') diff --git a/VB.Net Projects/Bookstore/Bookstore.sln b/VB.Net Projects/Bookstore/Bookstore.sln new file mode 100644 index 0000000..6e6b953 --- /dev/null +++ b/VB.Net Projects/Bookstore/Bookstore.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31019.35 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Bookstore", "Bookstore\Bookstore.vbproj", "{4AA1DE24-905D-49B7-859A-E3317C871389}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4AA1DE24-905D-49B7-859A-E3317C871389}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4AA1DE24-905D-49B7-859A-E3317C871389}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4AA1DE24-905D-49B7-859A-E3317C871389}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4AA1DE24-905D-49B7-859A-E3317C871389}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C71BC870-09EC-4FBD-9069-96E69C9654D4} + EndGlobalSection +EndGlobal diff --git a/VB.Net Projects/Bookstore/Bookstore/ApplicationEvents.vb b/VB.Net Projects/Bookstore/Bookstore/ApplicationEvents.vb new file mode 100644 index 0000000..b892537 --- /dev/null +++ b/VB.Net Projects/Bookstore/Bookstore/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/Bookstore/Bookstore/Book.vb b/VB.Net Projects/Bookstore/Bookstore/Book.vb new file mode 100644 index 0000000..3643ab5 --- /dev/null +++ b/VB.Net Projects/Bookstore/Bookstore/Book.vb @@ -0,0 +1,36 @@ +Imports System.ComponentModel + +Public Class Book + Public Shared ReadOnly Genres As BindingList(Of String) = New BindingList(Of String) From { + "Хуманитанитарна литература", + "Художествена литература", + "Психология", + "Компютри", + "Чужди езици", + "Техника", + "Медицина", + "Икономика", + "Справочна литература", + "Право", + "Хоби", + "Психология", + "Друг" + } + + Public Title, Publisher, Author As String + Public Price As Single + Public GenreIndex, Amount As Integer + + Public Sub New(title As String, publisher As String, author As String, genreIndex As Integer, price As Single, amount As Integer) + Me.Title = title + Me.Publisher = publisher + Me.Author = author + Me.GenreIndex = genreIndex + Me.Price = price + Me.Amount = amount + End Sub + + Public Overrides Function ToString() As String + Return Me.Title + End Function +End Class diff --git a/VB.Net Projects/Bookstore/Bookstore/Bookstore.vbproj b/VB.Net Projects/Bookstore/Bookstore/Bookstore.vbproj new file mode 100644 index 0000000..7c9a5b3 --- /dev/null +++ b/VB.Net Projects/Bookstore/Bookstore/Bookstore.vbproj @@ -0,0 +1,37 @@ + + + + WinExe + net5.0-windows + Bookstore + Sub Main + true + WindowsForms + + + + + + + + + + + + + + + True + True + Application.myapp + + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + + \ No newline at end of file diff --git a/VB.Net Projects/Bookstore/Bookstore/Bookstore.vbproj.user b/VB.Net Projects/Bookstore/Bookstore/Bookstore.vbproj.user new file mode 100644 index 0000000..c392cf0 --- /dev/null +++ b/VB.Net Projects/Bookstore/Bookstore/Bookstore.vbproj.user @@ -0,0 +1,8 @@ + + + + + Form + + + diff --git a/VB.Net Projects/Bookstore/Bookstore/Form1.Designer.vb b/VB.Net Projects/Bookstore/Bookstore/Form1.Designer.vb new file mode 100644 index 0000000..9299ce9 --- /dev/null +++ b/VB.Net Projects/Bookstore/Bookstore/Form1.Designer.vb @@ -0,0 +1,446 @@ + _ +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.TabControl1 = New System.Windows.Forms.TabControl() + Me.TabPage1 = New System.Windows.Forms.TabPage() + Me.cbGenre = New System.Windows.Forms.ComboBox() + Me.txtAmount = New System.Windows.Forms.TextBox() + Me.txtPrice = New System.Windows.Forms.TextBox() + Me.txtPublisher = New System.Windows.Forms.TextBox() + Me.txtAuthor = New System.Windows.Forms.TextBox() + Me.txtTitle = New System.Windows.Forms.TextBox() + Me.Label8 = New System.Windows.Forms.Label() + Me.Label7 = New System.Windows.Forms.Label() + Me.Label6 = New System.Windows.Forms.Label() + Me.Label5 = New System.Windows.Forms.Label() + Me.Label4 = New System.Windows.Forms.Label() + Me.Label3 = New System.Windows.Forms.Label() + Me.cbReport = New System.Windows.Forms.ComboBox() + Me.lblTotalCount = New System.Windows.Forms.Label() + Me.Label1 = New System.Windows.Forms.Label() + Me.btnCreateNew = New System.Windows.Forms.Button() + Me.btnAdd = New System.Windows.Forms.Button() + Me.btnReport = New System.Windows.Forms.Button() + Me.btnSave = New System.Windows.Forms.Button() + Me.btnLoad = New System.Windows.Forms.Button() + Me.TabPage2 = New System.Windows.Forms.TabPage() + Me.btnClearPurchases = New System.Windows.Forms.Button() + Me.lblSum = New System.Windows.Forms.Label() + Me.Label12 = New System.Windows.Forms.Label() + Me.lbChosenBooks = New System.Windows.Forms.ListBox() + Me.btnPurchase = New System.Windows.Forms.Button() + Me.Label11 = New System.Windows.Forms.Label() + Me.lblPrice = New System.Windows.Forms.Label() + Me.Label9 = New System.Windows.Forms.Label() + Me.txtAmountToBuy = New System.Windows.Forms.TextBox() + Me.cbPurchase = New System.Windows.Forms.ComboBox() + Me.Label2 = New System.Windows.Forms.Label() + Me.TabControl1.SuspendLayout() + Me.TabPage1.SuspendLayout() + Me.TabPage2.SuspendLayout() + Me.SuspendLayout() + ' + 'TabControl1 + ' + Me.TabControl1.Controls.Add(Me.TabPage1) + Me.TabControl1.Controls.Add(Me.TabPage2) + Me.TabControl1.Location = New System.Drawing.Point(12, 12) + Me.TabControl1.Name = "TabControl1" + Me.TabControl1.SelectedIndex = 0 + Me.TabControl1.Size = New System.Drawing.Size(460, 337) + Me.TabControl1.TabIndex = 0 + ' + 'TabPage1 + ' + Me.TabPage1.Controls.Add(Me.cbGenre) + Me.TabPage1.Controls.Add(Me.txtAmount) + Me.TabPage1.Controls.Add(Me.txtPrice) + Me.TabPage1.Controls.Add(Me.txtPublisher) + Me.TabPage1.Controls.Add(Me.txtAuthor) + Me.TabPage1.Controls.Add(Me.txtTitle) + Me.TabPage1.Controls.Add(Me.Label8) + Me.TabPage1.Controls.Add(Me.Label7) + Me.TabPage1.Controls.Add(Me.Label6) + Me.TabPage1.Controls.Add(Me.Label5) + Me.TabPage1.Controls.Add(Me.Label4) + Me.TabPage1.Controls.Add(Me.Label3) + Me.TabPage1.Controls.Add(Me.cbReport) + Me.TabPage1.Controls.Add(Me.lblTotalCount) + Me.TabPage1.Controls.Add(Me.Label1) + Me.TabPage1.Controls.Add(Me.btnCreateNew) + Me.TabPage1.Controls.Add(Me.btnAdd) + Me.TabPage1.Controls.Add(Me.btnReport) + Me.TabPage1.Controls.Add(Me.btnSave) + Me.TabPage1.Controls.Add(Me.btnLoad) + Me.TabPage1.Location = New System.Drawing.Point(4, 24) + Me.TabPage1.Name = "TabPage1" + Me.TabPage1.Padding = New System.Windows.Forms.Padding(3) + Me.TabPage1.Size = New System.Drawing.Size(452, 309) + Me.TabPage1.TabIndex = 0 + Me.TabPage1.Text = "Въвеждане" + Me.TabPage1.UseVisualStyleBackColor = True + ' + 'cbGenre + ' + Me.cbGenre.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.cbGenre.FormattingEnabled = True + Me.cbGenre.Location = New System.Drawing.Point(110, 189) + Me.cbGenre.Name = "cbGenre" + Me.cbGenre.Size = New System.Drawing.Size(331, 23) + Me.cbGenre.TabIndex = 21 + ' + 'txtAmount + ' + Me.txtAmount.Location = New System.Drawing.Point(246, 263) + Me.txtAmount.Name = "txtAmount" + Me.txtAmount.Size = New System.Drawing.Size(97, 23) + Me.txtAmount.TabIndex = 20 + ' + 'txtPrice + ' + Me.txtPrice.Location = New System.Drawing.Point(58, 263) + Me.txtPrice.Name = "txtPrice" + Me.txtPrice.Size = New System.Drawing.Size(120, 23) + Me.txtPrice.TabIndex = 19 + ' + 'txtPublisher + ' + Me.txtPublisher.Location = New System.Drawing.Point(110, 218) + Me.txtPublisher.Name = "txtPublisher" + Me.txtPublisher.Size = New System.Drawing.Size(331, 23) + Me.txtPublisher.TabIndex = 17 + ' + 'txtAuthor + ' + Me.txtAuthor.Location = New System.Drawing.Point(110, 162) + Me.txtAuthor.Name = "txtAuthor" + Me.txtAuthor.Size = New System.Drawing.Size(331, 23) + Me.txtAuthor.TabIndex = 16 + ' + 'txtTitle + ' + Me.txtTitle.Location = New System.Drawing.Point(110, 133) + Me.txtTitle.Name = "txtTitle" + Me.txtTitle.Size = New System.Drawing.Size(331, 23) + Me.txtTitle.TabIndex = 15 + ' + 'Label8 + ' + Me.Label8.AutoSize = True + Me.Label8.Location = New System.Drawing.Point(199, 266) + Me.Label8.Name = "Label8" + Me.Label8.Size = New System.Drawing.Size(38, 15) + Me.Label8.TabIndex = 13 + Me.Label8.Text = "Брой:" + ' + 'Label7 + ' + Me.Label7.AutoSize = True + Me.Label7.Location = New System.Drawing.Point(11, 266) + Me.Label7.Name = "Label7" + Me.Label7.Size = New System.Drawing.Size(38, 15) + Me.Label7.TabIndex = 12 + Me.Label7.Text = "Цена:" + ' + 'Label6 + ' + Me.Label6.AutoSize = True + Me.Label6.Location = New System.Drawing.Point(11, 221) + Me.Label6.Name = "Label6" + Me.Label6.Size = New System.Drawing.Size(78, 15) + Me.Label6.TabIndex = 11 + Me.Label6.Text = "Издателство:" + ' + 'Label5 + ' + Me.Label5.AutoSize = True + Me.Label5.Location = New System.Drawing.Point(11, 192) + Me.Label5.Name = "Label5" + Me.Label5.Size = New System.Drawing.Size(41, 15) + Me.Label5.TabIndex = 10 + Me.Label5.Text = "Жанр:" + ' + 'Label4 + ' + Me.Label4.AutoSize = True + Me.Label4.Location = New System.Drawing.Point(11, 165) + Me.Label4.Name = "Label4" + Me.Label4.Size = New System.Drawing.Size(43, 15) + Me.Label4.TabIndex = 9 + Me.Label4.Text = "Автор:" + ' + 'Label3 + ' + Me.Label3.AutoSize = True + Me.Label3.Location = New System.Drawing.Point(11, 136) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(60, 15) + Me.Label3.TabIndex = 8 + Me.Label3.Text = "Заглавие:" + ' + 'cbReport + ' + Me.cbReport.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.cbReport.FormattingEnabled = True + Me.cbReport.Location = New System.Drawing.Point(110, 42) + Me.cbReport.Name = "cbReport" + Me.cbReport.Size = New System.Drawing.Size(331, 23) + Me.cbReport.TabIndex = 7 + ' + 'lblTotalCount + ' + Me.lblTotalCount.AutoSize = True + Me.lblTotalCount.ForeColor = System.Drawing.Color.Red + Me.lblTotalCount.Location = New System.Drawing.Point(248, 11) + Me.lblTotalCount.Name = "lblTotalCount" + Me.lblTotalCount.Size = New System.Drawing.Size(27, 15) + Me.lblTotalCount.TabIndex = 6 + Me.lblTotalCount.Text = "ERR" + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(116, 11) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(119, 15) + Me.Label1.TabIndex = 5 + Me.Label1.Text = "Общ брой заглавия:" + ' + 'btnCreateNew + ' + Me.btnCreateNew.Location = New System.Drawing.Point(11, 89) + Me.btnCreateNew.Name = "btnCreateNew" + Me.btnCreateNew.Size = New System.Drawing.Size(113, 23) + Me.btnCreateNew.TabIndex = 4 + Me.btnCreateNew.Text = "Ново заглавие" + Me.btnCreateNew.UseVisualStyleBackColor = True + ' + 'btnAdd + ' + Me.btnAdd.Location = New System.Drawing.Point(364, 263) + Me.btnAdd.Name = "btnAdd" + Me.btnAdd.Size = New System.Drawing.Size(77, 23) + Me.btnAdd.TabIndex = 3 + Me.btnAdd.Text = "Добави" + Me.btnAdd.UseVisualStyleBackColor = True + ' + 'btnReport + ' + Me.btnReport.Location = New System.Drawing.Point(11, 42) + Me.btnReport.Name = "btnReport" + Me.btnReport.Size = New System.Drawing.Size(77, 23) + Me.btnReport.TabIndex = 2 + Me.btnReport.Text = "Справка" + Me.btnReport.UseVisualStyleBackColor = True + ' + 'btnSave + ' + Me.btnSave.Location = New System.Drawing.Point(364, 7) + Me.btnSave.Name = "btnSave" + Me.btnSave.Size = New System.Drawing.Size(77, 23) + Me.btnSave.TabIndex = 1 + Me.btnSave.Text = "Запази" + Me.btnSave.UseVisualStyleBackColor = True + ' + 'btnLoad + ' + Me.btnLoad.Location = New System.Drawing.Point(11, 7) + Me.btnLoad.Name = "btnLoad" + Me.btnLoad.Size = New System.Drawing.Size(77, 23) + Me.btnLoad.TabIndex = 0 + Me.btnLoad.Text = "Зареди" + Me.btnLoad.UseVisualStyleBackColor = True + ' + 'TabPage2 + ' + Me.TabPage2.Controls.Add(Me.btnClearPurchases) + Me.TabPage2.Controls.Add(Me.lblSum) + Me.TabPage2.Controls.Add(Me.Label12) + Me.TabPage2.Controls.Add(Me.lbChosenBooks) + Me.TabPage2.Controls.Add(Me.btnPurchase) + Me.TabPage2.Controls.Add(Me.Label11) + Me.TabPage2.Controls.Add(Me.lblPrice) + Me.TabPage2.Controls.Add(Me.Label9) + Me.TabPage2.Controls.Add(Me.txtAmountToBuy) + Me.TabPage2.Controls.Add(Me.cbPurchase) + Me.TabPage2.Controls.Add(Me.Label2) + Me.TabPage2.Location = New System.Drawing.Point(4, 24) + Me.TabPage2.Name = "TabPage2" + Me.TabPage2.Padding = New System.Windows.Forms.Padding(3) + Me.TabPage2.Size = New System.Drawing.Size(452, 309) + Me.TabPage2.TabIndex = 1 + Me.TabPage2.Text = "Продажба" + Me.TabPage2.UseVisualStyleBackColor = True + ' + 'btnClearPurchases + ' + Me.btnClearPurchases.Location = New System.Drawing.Point(353, 268) + Me.btnClearPurchases.Name = "btnClearPurchases" + Me.btnClearPurchases.Size = New System.Drawing.Size(77, 26) + Me.btnClearPurchases.TabIndex = 10 + Me.btnClearPurchases.Text = "Изчисти" + Me.btnClearPurchases.UseVisualStyleBackColor = True + ' + 'lblSum + ' + Me.lblSum.AutoSize = True + Me.lblSum.ForeColor = System.Drawing.Color.Red + Me.lblSum.Location = New System.Drawing.Point(58, 274) + Me.lblSum.Name = "lblSum" + Me.lblSum.Size = New System.Drawing.Size(27, 15) + Me.lblSum.TabIndex = 9 + Me.lblSum.Text = "ERR" + ' + 'Label12 + ' + Me.Label12.AutoSize = True + Me.Label12.Location = New System.Drawing.Point(13, 274) + Me.Label12.Name = "Label12" + Me.Label12.Size = New System.Drawing.Size(39, 15) + Me.Label12.TabIndex = 8 + Me.Label12.Text = "Сума:" + ' + 'lbChosenBooks + ' + Me.lbChosenBooks.FormattingEnabled = True + Me.lbChosenBooks.ItemHeight = 15 + Me.lbChosenBooks.Location = New System.Drawing.Point(13, 107) + Me.lbChosenBooks.Name = "lbChosenBooks" + Me.lbChosenBooks.Size = New System.Drawing.Size(417, 139) + Me.lbChosenBooks.TabIndex = 7 + ' + 'btnPurchase + ' + Me.btnPurchase.Location = New System.Drawing.Point(353, 60) + Me.btnPurchase.Name = "btnPurchase" + Me.btnPurchase.Size = New System.Drawing.Size(77, 23) + Me.btnPurchase.TabIndex = 6 + Me.btnPurchase.Text = "Добави" + Me.btnPurchase.UseVisualStyleBackColor = True + ' + 'Label11 + ' + Me.Label11.AutoSize = True + Me.Label11.Location = New System.Drawing.Point(150, 63) + Me.Label11.Name = "Label11" + Me.Label11.Size = New System.Drawing.Size(38, 15) + Me.Label11.TabIndex = 5 + Me.Label11.Text = "Брой:" + ' + 'lblPrice + ' + Me.lblPrice.AutoSize = True + Me.lblPrice.ForeColor = System.Drawing.Color.Blue + Me.lblPrice.Location = New System.Drawing.Point(57, 63) + Me.lblPrice.Name = "lblPrice" + Me.lblPrice.Size = New System.Drawing.Size(27, 15) + Me.lblPrice.TabIndex = 4 + Me.lblPrice.Text = "ERR" + ' + 'Label9 + ' + Me.Label9.AutoSize = True + Me.Label9.Location = New System.Drawing.Point(13, 63) + Me.Label9.Name = "Label9" + Me.Label9.Size = New System.Drawing.Size(38, 15) + Me.Label9.TabIndex = 3 + Me.Label9.Text = "Цена:" + ' + 'txtAmountToBuy + ' + Me.txtAmountToBuy.Location = New System.Drawing.Point(203, 60) + Me.txtAmountToBuy.Name = "txtAmountToBuy" + Me.txtAmountToBuy.Size = New System.Drawing.Size(62, 23) + Me.txtAmountToBuy.TabIndex = 2 + ' + 'cbPurchase + ' + Me.cbPurchase.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.cbPurchase.FormattingEnabled = True + Me.cbPurchase.Location = New System.Drawing.Point(85, 13) + Me.cbPurchase.Name = "cbPurchase" + Me.cbPurchase.Size = New System.Drawing.Size(345, 23) + Me.cbPurchase.TabIndex = 1 + ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(13, 16) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(42, 15) + Me.Label2.TabIndex = 0 + Me.Label2.Text = "Книга:" + ' + 'Form1 + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 15.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(484, 361) + Me.Controls.Add(Me.TabControl1) + Me.Name = "Form1" + Me.Text = "Книжарница" + Me.TabControl1.ResumeLayout(False) + Me.TabPage1.ResumeLayout(False) + Me.TabPage1.PerformLayout() + Me.TabPage2.ResumeLayout(False) + Me.TabPage2.PerformLayout() + Me.ResumeLayout(False) + + End Sub + + Friend WithEvents TabControl1 As TabControl + Friend WithEvents TabPage1 As TabPage + Friend WithEvents cbGenre As ComboBox + Friend WithEvents txtAmount As TextBox + Friend WithEvents txtPrice As TextBox + Friend WithEvents txtPublisher As TextBox + Friend WithEvents txtAuthor As TextBox + Friend WithEvents txtTitle As TextBox + Friend WithEvents Label8 As Label + Friend WithEvents Label7 As Label + Friend WithEvents Label6 As Label + Friend WithEvents Label5 As Label + Friend WithEvents Label4 As Label + Friend WithEvents Label3 As Label + Friend WithEvents cbReport As ComboBox + Friend WithEvents lblTotalCount As Label + Friend WithEvents Label1 As Label + Friend WithEvents btnCreateNew As Button + Friend WithEvents btnAdd As Button + Friend WithEvents btnReport As Button + Friend WithEvents btnSave As Button + Friend WithEvents btnLoad As Button + Friend WithEvents TabPage2 As TabPage + Friend WithEvents btnClearPurchases As Button + Friend WithEvents lblSum As Label + Friend WithEvents Label12 As Label + Friend WithEvents lbChosenBooks As ListBox + Friend WithEvents btnPurchase As Button + Friend WithEvents Label11 As Label + Friend WithEvents lblPrice As Label + Friend WithEvents Label9 As Label + Friend WithEvents txtAmountToBuy As TextBox + Friend WithEvents cbPurchase As ComboBox + Friend WithEvents Label2 As Label +End Class diff --git a/VB.Net Projects/Bookstore/Bookstore/Form1.resx b/VB.Net Projects/Bookstore/Bookstore/Form1.resx new file mode 100644 index 0000000..b5ae26c --- /dev/null +++ b/VB.Net Projects/Bookstore/Bookstore/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/Bookstore/Bookstore/Form1.vb b/VB.Net Projects/Bookstore/Bookstore/Form1.vb new file mode 100644 index 0000000..dd8f7ba --- /dev/null +++ b/VB.Net Projects/Bookstore/Bookstore/Form1.vb @@ -0,0 +1,99 @@ +Imports System.ComponentModel +Imports System.IO +Imports Newtonsoft.Json + +Public Class Form1 + ReadOnly filePath As String = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\Desktop\data.json" + ReadOnly Books As BindingList(Of Book) = New BindingList(Of Book) + ReadOnly Purchases As BindingList(Of Purchase) = New BindingList(Of Purchase) + + Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load + cbReport.DataSource = Books + cbGenre.DataSource = Book.Genres + cbPurchase.DataSource = Books + lbChosenBooks.DataSource = Purchases + End Sub + + ' Въвеждане tab + + Private Sub ClearInputs(sender As Object, e As EventArgs) Handles btnCreateNew.Click, MyBase.Load + For Each control As Control In {txtTitle, txtAuthor, txtAmount, txtPrice, txtPublisher} + control.ResetText() + Next + End Sub + + Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click + If Not IsNumeric(txtPrice.Text) Or Not IsNumeric(txtAmount.Text) Then + MsgBox("Цена и брой могат да бъдат само числа!", MsgBoxStyle.Critical, "Грешка!") + Return + End If + + Books.Add(New Book(txtTitle.Text, txtPublisher.Text, txtAuthor.Text, cbGenre.SelectedIndex, txtPrice.Text, txtAmount.Text)) + MsgBox("Книгата е добавена!", MsgBoxStyle.DefaultButton1, "Успех!") + End Sub + + + Private Sub btnReport_Click(sender As Object, e As EventArgs) Handles btnReport.Click + If cbReport.SelectedItem Is Nothing Then + Return + End If + + txtTitle.Text = Books(cbReport.SelectedIndex).Title + txtAuthor.Text = Books(cbReport.SelectedIndex).Author + cbGenre.SelectedIndex = Books(cbReport.SelectedIndex).GenreIndex + txtPublisher.Text = Books(cbReport.SelectedIndex).Publisher + txtPrice.Text = Books(cbReport.SelectedIndex).Price + txtAmount.Text = Books(cbReport.SelectedIndex).Amount + End Sub + + Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click + File.WriteAllText(filePath, JsonConvert.SerializeObject(Books)) + MsgBox("Данните са запазени!", MsgBoxStyle.OkOnly, "Успех!") + End Sub + + Private Sub btnLoad_Click(sender As Object, e As EventArgs) Handles btnLoad.Click + Dim deserializedBooks = JsonConvert.DeserializeObject(Of List(Of Book))(File.ReadAllText(filePath)) + Books.Clear() + deserializedBooks.ForEach(Sub(b) Books.Add(b)) + MsgBox("Данните са заредени!", MsgBoxStyle.OkOnly, "Успех!") + End Sub + + Private Sub UpdateTotalCountLabel(sender As Object, e As EventArgs) Handles btnAdd.Click, btnLoad.Click, MyBase.Load + lblTotalCount.Text = Books.Count() + End Sub + + ' Продажба tab + + Private Sub cbPurchase_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbPurchase.SelectedIndexChanged, btnLoad.Click, MyBase.Load + If cbPurchase.SelectedIndex > -1 Then + lblPrice.Text = FormatCurrency(Books(cbPurchase.SelectedIndex).Price, 2) + Else + lblPrice.Text = FormatCurrency(0, 2) + End If + End Sub + + Private Sub btnPurchase_Click(sender As Object, e As EventArgs) Handles btnPurchase.Click + If Books(cbPurchase.SelectedIndex).Amount = 0 Then + MsgBox("Няма налични издания на тази книга!", MsgBoxStyle.Critical, "Грешка!") + Return + ElseIf Not IsNumeric(txtAmountToBuy.Text) Then + MsgBox("Трябва да въведете брой на закупени издания!", MsgBoxStyle.Critical, "Грешка!") + Return + ElseIf txtAmountToBuy.Text > Books(cbPurchase.SelectedIndex).Amount Then + MsgBox($"Има само {Books(cbPurchase.SelectedIndex).Amount} брой налични издания!", MsgBoxStyle.Critical, "Грешка!") + Return + End If + + Dim purchasedBook = Books(cbPurchase.SelectedIndex) + Purchases.Add(New Purchase(purchasedBook.Title, purchasedBook.Price, txtAmountToBuy.Text)) + purchasedBook.Amount -= txtAmountToBuy.Text + End Sub + + Private Sub btnClearPurchases_Click(sender As Object, e As EventArgs) Handles btnClearPurchases.Click, btnLoad.Click + Purchases.Clear() + txtAmountToBuy.ResetText() + End Sub + Private Sub UpdateSum(sender As Object, e As EventArgs) Handles btnPurchase.Click, btnClearPurchases.Click, btnLoad.Click, MyBase.Load + lblSum.Text = FormatCurrency(Purchases.Sum(Function(p) p.ItemPrice * p.Amount), 2) + End Sub +End Class diff --git a/VB.Net Projects/Bookstore/Bookstore/My Project/Application.Designer.HighDpi.vb b/VB.Net Projects/Bookstore/Bookstore/My Project/Application.Designer.HighDpi.vb new file mode 100644 index 0000000..a3576c4 --- /dev/null +++ b/VB.Net Projects/Bookstore/Bookstore/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/Bookstore/Bookstore/My Project/Application.Designer.vb b/VB.Net Projects/Bookstore/Bookstore/My Project/Application.Designer.vb new file mode 100644 index 0000000..8b8d4fc --- /dev/null +++ b/VB.Net Projects/Bookstore/Bookstore/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/Bookstore/Bookstore/My Project/Application.myapp b/VB.Net Projects/Bookstore/Bookstore/My Project/Application.myapp new file mode 100644 index 0000000..fbb5858 --- /dev/null +++ b/VB.Net Projects/Bookstore/Bookstore/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + true + Form1 + false + 0 + true + 0 + true + \ No newline at end of file diff --git a/VB.Net Projects/Bookstore/Bookstore/Purchase.vb b/VB.Net Projects/Bookstore/Bookstore/Purchase.vb new file mode 100644 index 0000000..6bb9171 --- /dev/null +++ b/VB.Net Projects/Bookstore/Bookstore/Purchase.vb @@ -0,0 +1,15 @@ +Public Class Purchase + Public ItemTitle As String + Public ItemPrice As Single + Public Amount As Integer + + Public Sub New(itemTitle As String, itemPrice As Single, amount As Integer) + Me.ItemTitle = itemTitle + Me.ItemPrice = itemPrice + Me.Amount = amount + End Sub + + Public Overrides Function ToString() As String + Return $"{Me.Amount} {Me.ItemTitle}" + End Function +End Class -- cgit v1.2.3