Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can I have this code converted to visualbasic.... Anonymous answered this Was th

ID: 3701316 • Letter: C

Question

Can I have this code converted to visualbasic.... Anonymous answered this Was this answer helpful? 2,933 answers Program.cs using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace InvoiceTotal { static class Program { /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmInvoiceTotal()); } } } frmInvoiceTotal.Designer.cs namespace InvoiceTotal { partial class frmInvoiceTotal { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.btnExit = new System.Windows.Forms.Button(); this.btnCalculate = new System.Windows.Forms.Button(); this.txtProductTotal = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.txtDiscountAmount = new System.Windows.Forms.TextBox(); this.txtTotal = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.txtSubtotal = new System.Windows.Forms.TextBox(); this.label6 = new System.Windows.Forms.Label(); this.txtTax = new System.Windows.Forms.TextBox(); this.btnChange = new System.Windows.Forms.Button(); this.SuspendLayout(); // // btnExit // this.btnExit.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnExit.Location = new System.Drawing.Point(130, 161); this.btnExit.Name = "btnExit"; this.btnExit.Size = new System.Drawing.Size(75, 23); this.btnExit.TabIndex = 16; this.btnExit.Text = "E&xit"; this.btnExit.Click += new System.EventHandler(this.btnExit_Click); // // btnCalculate // this.btnCalculate.Location = new System.Drawing.Point(36, 161); this.btnCalculate.Name = "btnCalculate"; this.btnCalculate.Size = new System.Drawing.Size(75, 23); this.btnCalculate.TabIndex = 15; this.btnCalculate.Text = "&Calculate"; this.btnCalculate.Click += new System.EventHandler(this.btnCalculate_Click); // // txtProductTotal // this.txtProductTotal.Location = new System.Drawing.Point(121, 16); this.txtProductTotal.Name = "txtProductTotal"; this.txtProductTotal.Size = new System.Drawing.Size(84, 20); this.txtProductTotal.TabIndex = 14; // // label3 // this.label3.Location = new System.Drawing.Point(17, 121); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(94, 20); this.label3.TabIndex = 5; this.label3.Text = "Total:"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.Location = new System.Drawing.Point(17, 42); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(94, 20); this.label2.TabIndex = 8; this.label2.Text = "Discount amount:"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label1 // this.label1.Location = new System.Drawing.Point(17, 16); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(94, 20); this.label1.TabIndex = 7; this.label1.Text = "Product total:"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // txtDiscountAmount // this.txtDiscountAmount.Location = new System.Drawing.Point(121, 42); this.txtDiscountAmount.Name = "txtDiscountAmount"; this.txtDiscountAmount.ReadOnly = true; this.txtDiscountAmount.Size = new System.Drawing.Size(84, 20); this.txtDiscountAmount.TabIndex = 18; this.txtDiscountAmount.TabStop = false; // // txtTotal // this.txtTotal.Location = new System.Drawing.Point(121, 122); this.txtTotal.Name = "txtTotal"; this.txtTotal.ReadOnly = true; this.txtTotal.Size = new System.Drawing.Size(84, 20); this.txtTotal.TabIndex = 19; this.txtTotal.TabStop = false; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(17, 72); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(49, 13); this.label4.TabIndex = 20; this.label4.Text = "Subtotal:"; // // txtSubtotal // this.txtSubtotal.Location = new System.Drawing.Point(121, 69); this.txtSubtotal.Name = "txtSubtotal"; this.txtSubtotal.ReadOnly = true; this.txtSubtotal.Size = new System.Drawing.Size(84, 20); this.txtSubtotal.TabIndex = 21; this.txtSubtotal.TabStop = false; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(17, 99); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(66, 13); this.label6.TabIndex = 22; this.label6.Text = "Tax (7.75%):"; // // txtTax // this.txtTax.Location = new System.Drawing.Point(121, 96); this.txtTax.Name = "txtTax"; this.txtTax.ReadOnly = true; this.txtTax.Size = new System.Drawing.Size(84, 20); this.txtTax.TabIndex = 23; this.txtTax.TabStop = false; // // btnChange // this.btnChange.Location = new System.Drawing.Point(230, 94); this.btnChange.Name = "btnChange"; this.btnChange.Size = new System.Drawing.Size(75, 23); this.btnChange.TabIndex = 24; this.btnChange.Text = "Change Percent"; this.btnChange.UseVisualStyleBackColor = true; this.btnChange.Click += new System.EventHandler(this.btnChange_Click); // // frmInvoiceTotal // this.AcceptButton = this.btnCalculate; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.btnExit; this.ClientSize = new System.Drawing.Size(343, 202); this.Controls.Add(this.btnChange); this.Controls.Add(this.txtTax); this.Controls.Add(this.label6); this.Controls.Add(this.txtSubtotal); this.Controls.Add(this.label4); this.Controls.Add(this.txtTotal); this.Controls.Add(this.txtDiscountAmount); this.Controls.Add(this.btnExit); this.Controls.Add(this.btnCalculate); this.Controls.Add(this.txtProductTotal); this.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Name = "frmInvoiceTotal"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Invoice Total"; this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Button btnExit; private System.Windows.Forms.Button btnCalculate; private System.Windows.Forms.TextBox txtProductTotal; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox txtDiscountAmount; private System.Windows.Forms.TextBox txtTotal; private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox txtSubtotal; private System.Windows.Forms.Label label6; private System.Windows.Forms.TextBox txtTax; private System.Windows.Forms.Button btnChange; } } frmInvoiceTotal.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace InvoiceTotal { public partial class frmInvoiceTotal : Form { public frmInvoiceTotal() { InitializeComponent(); } decimal SalesTaxPct = 7.75m; private void btnCalculate_Click(object sender, EventArgs e) { if (IsValidData()) { decimal productTotal = Convert.ToDecimal(txtProductTotal.Text); decimal discountPercent = .0m; if (productTotal < 100) discountPercent = .0m; else if (productTotal >= 100 && productTotal < 250) discountPercent = .1m; else if (productTotal >= 250) discountPercent = .25m; decimal discountAmount = productTotal * discountPercent; decimal subtotal = productTotal - discountAmount; decimal tax = subtotal * SalesTaxPct / 100; decimal total = subtotal + tax; txtDiscountAmount.Text = discountAmount.ToString("c"); txtSubtotal.Text = subtotal.ToString("c"); txtTax.Text = tax.ToString("c"); txtTotal.Text = total.ToString("c"); txtProductTotal.Focus(); } } public bool IsValidData() { return IsPresent(txtProductTotal, "Subtotal") && IsDecimal(txtProductTotal, "Subtotal") && IsWithinRange(txtProductTotal, "Subtotal", 0, 1000000); } public bool IsPresent(TextBox textBox, string name) { if (textBox.Text == "") { MessageBox.Show(name + " is a required field.", "Entry Error"); textBox.Focus(); return false; } return true; } public bool IsDecimal(TextBox textBox, string name) { decimal number = 0m; if (Decimal.TryParse(textBox.Text, out number)) { return true; } else { MessageBox.Show(name + " must be a decimal number.", "Entry Error"); textBox.Focus(); return false; } } public bool IsWithinRange(TextBox textBox, string name, decimal min, decimal max) { decimal number = Convert.ToDecimal(textBox.Text); if (number <= min || number >= max) { MessageBox.Show(name + " must be between " + min + " and " + max + ".", "Entry Error"); textBox.Focus(); return false; } return true; } private void btnExit_Click(object sender, EventArgs e) { this.Close(); } private void btnChange_Click(object sender, EventArgs e) { frmSalesTax f = new frmSalesTax(); //f.Show(); if (f.ShowDialog() == DialogResult.OK) { SalesTaxPct = Convert.ToDecimal(f.Tag); f.Close(); } } } } frmSalesTax.Designer.cs namespace InvoiceTotal { partial class frmSalesTax { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.txtInput = new System.Windows.Forms.TextBox(); this.btnOK = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(13, 89); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(60, 13); this.label1.TabIndex = 0; this.label1.Text = "Sales Tax: "; // // txtInput // this.txtInput.Location = new System.Drawing.Point(79, 86); this.txtInput.Name = "txtInput"; this.txtInput.Size = new System.Drawing.Size(100, 20); this.txtInput.TabIndex = 1; // // btnOK // this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; this.btnOK.Location = new System.Drawing.Point(33, 127); this.btnOK.Name = "btnOK"; this.btnOK.Size = new System.Drawing.Size(75, 23); this.btnOK.TabIndex = 2; this.btnOK.Text = "OK"; this.btnOK.UseVisualStyleBackColor = true; this.btnOK.Click += new System.EventHandler(this.btnOK_Click); // // btnCancel // this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnCancel.Location = new System.Drawing.Point(123, 127); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.TabIndex = 3; this.btnCancel.Text = "Cancel"; this.btnCancel.UseVisualStyleBackColor = true; // // frmSalesTax // this.AcceptButton = this.btnOK; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.btnCancel; this.ClientSize = new System.Drawing.Size(284, 261); this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnOK); this.Controls.Add(this.txtInput); this.Controls.Add(this.label1); this.Name = "frmSalesTax"; this.Text = "frmSalesTax"; this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox txtInput; private System.Windows.Forms.Button btnOK; private System.Windows.Forms.Button btnCancel; } } frmSalesTax.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace InvoiceTotal { public partial class frmSalesTax : Form { public frmSalesTax() { InitializeComponent(); } private void btnOK_Click(object sender, EventArgs e) { decimal salesTax = Convert.ToDecimal(txtInput.Text); Tag = salesTax; } } }

Explanation / Answer

// Please find below properly indented, translated and updated code

// -------- InvoiceTotal -----------
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading.Tasks
Imports System.Windows.Forms

Namespace InvoiceTotal

Module Program

Private Sub Main()
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(False)
Application.Run(New frmInvoiceTotal())
End Sub
End Module
End Namespace


// ------------- frmInvoiceTotal.Designer --------------

Namespace InvoiceTotal

Partial Class frmInvoiceTotal

Private components As System.ComponentModel.IContainer = Nothing

Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso (components IsNot Nothing) Then
components.Dispose()
End If

MyBase.Dispose(disposing)
End Sub

Private Sub InitializeComponent()
Me.btnExit = New System.Windows.Forms.Button()
Me.btnCalculate = New System.Windows.Forms.Button()
Me.txtProductTotal = New System.Windows.Forms.TextBox()
Me.label3 = New System.Windows.Forms.Label()
Me.label2 = New System.Windows.Forms.Label()
Me.label1 = New System.Windows.Forms.Label()
Me.txtDiscountAmount = New System.Windows.Forms.TextBox()
Me.txtTotal = New System.Windows.Forms.TextBox()
Me.label4 = New System.Windows.Forms.Label()
Me.txtSubtotal = New System.Windows.Forms.TextBox()
Me.label6 = New System.Windows.Forms.Label()
Me.txtTax = New System.Windows.Forms.TextBox()
Me.btnChange = New System.Windows.Forms.Button()
Me.SuspendLayout()
Me.btnExit.Location = New System.Drawing.Point(130, 161)
Me.btnExit.Name = "btnExit"
Me.btnExit.Size = New System.Drawing.Size(75, 23)
Me.btnExit.TabIndex = 16
Me.btnExit.Text = "E&xit"
Me.btnExit.Click += New System.EventHandler(Me.btnExit_Click)
Me.btnCalculate.Name = "btnCalculate"
Me.btnCalculate.Size = New System.Drawing.Size(75, 23)
Me.btnCalculate.TabIndex = 15
Me.btnCalculate.Text = "&Calculate"
Me.btnCalculate.Click += New System.EventHandler(Me.btnCalculate_Click)
Me.txtProductTotal.Name = "txtProductTotal"
Me.txtProductTotal.Size = New System.Drawing.Size(84, 20)
Me.txtProductTotal.TabIndex = 14
Me.label3.Name = "label3"
Me.label3.Size = New System.Drawing.Size(94, 20)
Me.label3.TabIndex = 5
Me.label3.Text = "Total:"
Me.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.label2.Name = "label2"
Me.label2.Size = New System.Drawing.Size(94, 20)
Me.label2.TabIndex = 8
Me.label2.Text = "Discount amount:"
Me.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.label1.Name = "label1"
Me.label1.Size = New System.Drawing.Size(94, 20)
Me.label1.TabIndex = 7
Me.label1.Text = "Product total:"
Me.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.txtDiscountAmount.Name = "txtDiscountAmount"
Me.txtDiscountAmount.[ReadOnly] = True
Me.txtDiscountAmount.Size = New System.Drawing.Size(84, 20)
Me.txtDiscountAmount.TabIndex = 18
Me.txtDiscountAmount.TabStop = False
Me.txtTotal.Name = "txtTotal"
Me.txtTotal.[ReadOnly] = True
Me.txtTotal.Size = New System.Drawing.Size(84, 20)
Me.txtTotal.TabIndex = 19
Me.txtTotal.TabStop = False
Me.label4.Location = New System.Drawing.Point(17, 72)
Me.label4.Name = "label4"
Me.label4.Size = New System.Drawing.Size(49, 13)
Me.label4.TabIndex = 20
Me.label4.Text = "Subtotal:"
Me.txtSubtotal.Name = "txtSubtotal"
Me.txtSubtotal.[ReadOnly] = True
Me.txtSubtotal.Size = New System.Drawing.Size(84, 20)
Me.txtSubtotal.TabIndex = 21
Me.txtSubtotal.TabStop = False
Me.label6.Location = New System.Drawing.Point(17, 99)
Me.label6.Name = "label6"
Me.label6.Size = New System.Drawing.Size(66, 13)
Me.label6.TabIndex = 22
Me.label6.Text = "Tax (7.75%):"
Me.txtTax.Name = "txtTax"
Me.txtTax.[ReadOnly] = True
Me.txtTax.Size = New System.Drawing.Size(84, 20)
Me.txtTax.TabIndex = 23
Me.txtTax.TabStop = False
Me.btnChange.Name = "btnChange"
Me.btnChange.Size = New System.Drawing.Size(75, 23)
Me.btnChange.TabIndex = 24
Me.btnChange.Text = "Change Percent"
Me.btnChange.UseVisualStyleBackColor = True
Me.btnChange.Click += New System.EventHandler(Me.btnChange_Click)
Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.CancelButton = Me.btnExit
Me.ClientSize = New System.Drawing.Size(343, 202)
Me.Controls.Add(Me.btnChange)
Me.Controls.Add(Me.txtTax)
Me.Controls.Add(Me.label6)
Me.Controls.Add(Me.txtSubtotal)
Me.Controls.Add(Me.label4)
Me.Controls.Add(Me.txtTotal)
Me.Controls.Add(Me.txtDiscountAmount)
Me.Controls.Add(Me.btnExit)
Me.Controls.Add(Me.btnCalculate)
Me.Controls.Add(Me.txtProductTotal)
Me.Controls.Add(Me.label3)
Me.Controls.Add(Me.label2)
Me.Controls.Add(Me.label1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Name = "frmInvoiceTotal"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Invoice Total"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub

Private btnCalculate As System.Windows.Forms.Button

Private txtProductTotal As System.Windows.Forms.TextBox

Private label3 As System.Windows.Forms.Label

Private label2 As System.Windows.Forms.Label

Private label1 As System.Windows.Forms.Label

Private txtDiscountAmount As System.Windows.Forms.TextBox

Private txtTotal As System.Windows.Forms.TextBox

Private label4 As System.Windows.Forms.Label

Private txtSubtotal As System.Windows.Forms.TextBox

Private label6 As System.Windows.Forms.Label

Private txtTax As System.Windows.Forms.TextBox

Private btnChange As System.Windows.Forms.Button
End Class
End Namespace


// ----------------- frmInvoiceTotal -------------------------------
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Imports System.Windows.Forms

Namespace InvoiceTotal

Public Partial Class frmInvoiceTotal
Inherits Form

Public Sub New()
InitializeComponent()
End Sub

Private SalesTaxPct As Decimal = 7.75D

Private Sub btnCalculate_Click(ByVal sender As Object, ByVal e As EventArgs)
If IsValidData() Then
Dim productTotal As Decimal = Convert.ToDecimal(txtProductTotal.Text)
Dim discountPercent As Decimal = 0.0D
If productTotal < 100 Then
discountPercent = 0.0D
ElseIf productTotal >= 100 AndAlso productTotal < 250 Then
discountPercent = 0.1D
ElseIf productTotal >= 250 Then
discountPercent = 0.25D
End If

Dim discountAmount As Decimal = productTotal * discountPercent
Dim subtotal As Decimal = productTotal - discountAmount
Dim tax As Decimal = subtotal * SalesTaxPct / 100
Dim total As Decimal = subtotal + tax
txtDiscountAmount.Text = discountAmount.ToString("c")
txtSubtotal.Text = subtotal.ToString("c")
txtTax.Text = tax.ToString("c")
txtTotal.Text = total.ToString("c")
txtProductTotal.Focus()
End If
End Sub

Public Function IsValidData() As Boolean
Return IsPresent(txtProductTotal, "Subtotal") AndAlso IsDecimal(txtProductTotal, "Subtotal") AndAlso IsWithinRange(txtProductTotal, "Subtotal", 0, 1000000)
End Function

Public Function IsPresent(ByVal textBox As TextBox, ByVal name As String) As Boolean
If textBox.Text = "" Then
MessageBox.Show(name & " is a required field.", "Entry Error")
textBox.Focus()
Return False
End If

Return True
End Function

Public Function IsDecimal(ByVal textBox As TextBox, ByVal name As String) As Boolean
Dim number As Decimal = 0D
If Decimal.TryParse(textBox.Text, number) Then
Return True
Else
MessageBox.Show(name & " must be a decimal number.", "Entry Error")
textBox.Focus()
Return False
End If
End Function

Public Function IsWithinRange(ByVal textBox As TextBox, ByVal name As String, ByVal min As Decimal, ByVal max As Decimal) As Boolean
Dim number As Decimal = Convert.ToDecimal(textBox.Text)
If number <= min OrElse number >= max Then
MessageBox.Show(name & " must be between " + min & " and " + max & ".", "Entry Error")
textBox.Focus()
Return False
End If

Return True
End Function

Private Sub btnExit_Click(ByVal sender As Object, ByVal e As EventArgs)
Me.Close()
End Sub

Private Sub btnChange_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim f As frmSalesTax = New frmSalesTax()
If f.ShowDialog() = DialogResult.OK Then
SalesTaxPct = Convert.ToDecimal(f.Tag)
f.Close()
End If
End Sub
End Class
End Namespace

// ---------------------- frmSalesTax.Designer ---------------------
Namespace InvoiceTotal

Partial Class frmSalesTax

Private components As System.ComponentModel.IContainer = Nothing

Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso (components IsNot Nothing) Then
components.Dispose()
End If

MyBase.Dispose(disposing)
End Sub

Private Sub InitializeComponent()
Me.label1 = New System.Windows.Forms.Label()
Me.txtInput = New System.Windows.Forms.TextBox()
Me.btnOK = New System.Windows.Forms.Button()
Me.btnCancel = New System.Windows.Forms.Button()
Me.SuspendLayout()
Me.label1.Location = New System.Drawing.Point(13, 89)
Me.label1.Name = "label1"
Me.label1.Size = New System.Drawing.Size(60, 13)
Me.label1.TabIndex = 0
Me.label1.Text = "Sales Tax: "
Me.txtInput.Name = "txtInput"
Me.txtInput.Size = New System.Drawing.Size(100, 20)
Me.txtInput.TabIndex = 1
Me.btnOK.Location = New System.Drawing.Point(33, 127)
Me.btnOK.Name = "btnOK"
Me.btnOK.Size = New System.Drawing.Size(75, 23)
Me.btnOK.TabIndex = 2
Me.btnOK.Text = "OK"
Me.btnOK.UseVisualStyleBackColor = True
Me.btnOK.Click += New System.EventHandler(Me.btnOK_Click)
Me.btnCancel.Location = New System.Drawing.Point(123, 127)
Me.btnCancel.Name = "btnCancel"
Me.btnCancel.Size = New System.Drawing.Size(75, 23)
Me.btnCancel.TabIndex = 3
Me.btnCancel.Text = "Cancel"
Me.btnCancel.UseVisualStyleBackColor = True
Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.CancelButton = Me.btnCancel
Me.ClientSize = New System.Drawing.Size(284, 261)
Me.Controls.Add(Me.btnCancel)
Me.Controls.Add(Me.btnOK)
Me.Controls.Add(Me.txtInput)
Me.Controls.Add(Me.label1)
Me.Name = "frmSalesTax"
Me.Text = "frmSalesTax"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub

Private label1 As System.Windows.Forms.Label

Private txtInput As System.Windows.Forms.TextBox

Private btnOK As System.Windows.Forms.Button

Private btnCancel As System.Windows.Forms.Button
End Class
End Namespace

// ----------------- frmSalesTax ----------------------------
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Imports System.Windows.Forms

Namespace InvoiceTotal

Public Partial Class frmSalesTax
Inherits Form

Public Sub New()
InitializeComponent()
End Sub

Private Sub btnOK_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim salesTax As Decimal = Convert.ToDecimal(txtInput.Text)
Tag = salesTax
End Sub
End Class
End Namespace

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote