Lists-Based Applications: The Music Store |
|
The DataSet of the .NET Framework is a very impressive class. It allows you to create and manage any type of list, making it a central point for a list-based application, although it is highly used in formal database applications such as those intended for Microsoft SQL Server or Microsoft Access. To support the creation and management of any type of list, the DataSet class has complete built-in mechanisms for creating tables, their associated columns, and to perform data entry. To demonstrate these functionalities of the DataSet, we are going to create a list-based application that can serve as another introduction to databases. The application simulates a music instrument store that processes orders for customers. When a customer places an order in the store to purchase a product, the employee can select items by categories, specify the quantity, calculate the total order, and save it. |
Practical Learning: Creating the Application |
|
|
|
|
Private Sub btnNewItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles btnNewItem.Click Dim frm As NewStoreItem = New NewStoreItem frm.ShowDialog() End Sub |
Private Sub btnCalculate_Click(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles btnCalculate.Click Dim item1UnitPrice As Decimal = 0.0 Dim item2UnitPrice As Decimal = 0.0 Dim item3UnitPrice As Decimal = 0.0 Dim item4UnitPrice As Decimal = 0.0 Dim item5UnitPrice As Decimal = 0.0 Dim item6UnitPrice As Decimal = 0.0 Dim quantity1 As Integer = 0 Dim quantity2 As Integer = 0 Dim quantity3 As Integer = 0 Dim quantity4 As Integer = 0 Dim quantity5 As Integer = 0 Dim quantity6 As Integer = 0 Dim item1SubTotal As Decimal = 0.0 Dim item2SubTotal As Decimal = 0.0 Dim item3SubTotal As Decimal = 0.0 Dim item4SubTotal As Decimal = 0.0 Dim item5SubTotal As Decimal = 0.0 Dim item6SubTotal As Decimal = 0.0 Dim totalOrder As Decimal Try item1UnitPrice = CDec(Me.txtUnitPrice1.Text) Catch ex As FormatException MsgBox("Invalid Unit Price") Me.txtUnitPrice1.Text = "0.00" Me.txtUnitPrice1.Focus() End Try Try quantity1 = CInt(Me.txtQuantity1.Text) Catch ex As FormatException MsgBox("Invalid Quantity") Me.txtQuantity1.Text = "0" Me.txtQuantity1.Focus() End Try Try item2UnitPrice = CDec(Me.txtUnitPrice2.Text) Catch ex As FormatException MsgBox("Invalid Unit Price") Me.txtUnitPrice2.Text = "0.00" Me.txtUnitPrice2.Focus() End Try Try quantity2 = CInt(Me.txtQuantity2.Text) Catch ex As FormatException MsgBox("Invalid Quantity") Me.txtQuantity2.Text = "0" Me.txtQuantity2.Focus() End Try Try item3UnitPrice = CDec(Me.txtUnitPrice3.Text) Catch ex As FormatException MsgBox("Invalid Unit Price") Me.txtUnitPrice3.Text = "0.00" Me.txtUnitPrice3.Focus() End Try Try quantity3 = CInt(Me.txtQuantity3.Text) Catch ex As FormatException MsgBox("Invalid Quantity") Me.txtQuantity3.Text = "0" Me.txtQuantity3.Focus() End Try Try item4UnitPrice = CDec(Me.txtUnitPrice4.Text) Catch ex As FormatException MsgBox("Invalid Unit Price") Me.txtUnitPrice4.Text = "0.00" Me.txtUnitPrice4.Focus() End Try Try quantity4 = CInt(Me.txtQuantity4.Text) Catch ex As FormatException MsgBox("Invalid Quantity") Me.txtQuantity4.Text = "0" Me.txtQuantity4.Focus() End Try Try item5UnitPrice = CDec(Me.txtUnitPrice5.Text) Catch ex As FormatException MsgBox("Invalid Unit Price") Me.txtUnitPrice5.Text = "0.00" Me.txtUnitPrice5.Focus() End Try Try quantity5 = CInt(Me.txtQuantity5.Text) Catch ex As FormatException MsgBox("Invalid Quantity") Me.txtQuantity5.Text = "0" Me.txtQuantity5.Focus() End Try Try item6UnitPrice = CDec(Me.txtUnitPrice6.Text) Catch ex As FormatException MsgBox("Invalid Unit Price") Me.txtUnitPrice6.Text = "0.00" Me.txtUnitPrice6.Focus() End Try Try quantity6 = CInt(Me.txtQuantity6.Text) Catch ex As FormatException MsgBox("Invalid Quantity") Me.txtQuantity6.Text = "0" Me.txtQuantity6.Focus() End Try item1SubTotal = item1UnitPrice * quantity1 item2SubTotal = item2UnitPrice * quantity2 item3SubTotal = item3UnitPrice * quantity3 item4SubTotal = item4UnitPrice * quantity4 item5SubTotal = item5UnitPrice * quantity5 item6SubTotal = item6UnitPrice * quantity6 totalOrder = item1SubTotal + item2SubTotal + item3SubTotal + _ item4SubTotal + item5SubTotal + item6SubTotal Me.txtSubTotal1.Text = Format(item1SubTotal, "F") Me.txtSubTotal2.Text = Format(item2SubTotal, "F") Me.txtSubTotal3.Text = Format(item3SubTotal, "F") Me.txtSubTotal4.Text = Format(item4SubTotal, "F") Me.txtSubTotal5.Text = Format(item5SubTotal, "F") Me.txtSubTotal6.Text = Format(item6SubTotal, "F") Me.txtTotalOrder.Text = Format(totalOrder, "F") End Sub |
|
Private Sub btnNewItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles btnNewItem.Click Dim frm As NewStoreItem = New NewStoreItem frm.ShowDialog() End Sub |
Private Sub btnNewOrder_Click(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles btnNewOrder.Click Dim frm As PurchaseOrder = New PurchaseOrder frm.ShowDialog() End Sub |
Private Sub btnClose_Click(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles btnClose.Click End End Sub |
Application Data Entry |
To perform data entry, we will apply the concepts reviewed for data records. |
Practical Learning: Introducing Data Entry |
(Name) | ColumnName | Modifiers |
colItemNumber | ItemNumber | Public |
colItemCategory | Category | Public |
colTypeOfItem | ItemType | Public |
colItemName | ItemName | Public |
colUnitPrice | UnitPrice | Public |
Imports System.IO Imports System.Xml Imports System.Data Public Class Categories Inherits System.Windows.Forms.Form |
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles btnAdd.Click ' Get a reference to the Data Center because ' that's where the DataSet object resides Dim frmData As DataCenter = New DataCenter ' This is the XML file that will holds the Categories Dim strFilename As String = "Categories.xml" ' If the file exists already, open it If File.Exists(strFilename) Then frmData.dsMusicStore.ReadXml(strFilename) End If ' Create a new record for the Categories table Dim rowNewCategory As DataRow = frmData.dsMusicStore.Tables("Categories").NewRow() ' Specify only the Category column since the CategoryID is auto-incrementing rowNewCategory(0) = Me.txtNewCategory.Text ' Add the new record to the Categories table frmData.dsMusicStore.Tables("Categories").Rows.Add(rowNewCategory) ' Update the XML file frmData.dsMusicStore.WriteXml(strFilename) ' Display the current records of the Categories table so ' the user would know what categories are already in the table Me.dataGrid1.DataSource = frmData.dsMusicStore Me.dataGrid1.DataMember = "Categories" ' Reset the text box in case the user wants to add another category Me.txtNewCategory.Text = "" Me.txtNewCategory.Focus() End Sub |
Imports System.IO Imports System.Xml Imports System.Data Public Class ItemTypes Inherits System.Windows.Forms.Form |
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles btnAdd.Click Dim frmData As DataCenter = New DataCenter Dim strFilename As String = "ItemTypes.xml" If File.Exists(strFilename) Then frmData.dsMusicStore.ReadXml(strFilename) End If Dim rowNewType As DataRow = frmData.dsMusicStore.Tables("ItemTypes").NewRow() rowNewType(frmData.colItemType) = Me.txtNewItemType.Text frmData.dsMusicStore.Tables("ItemTypes").Rows.Add(rowNewType) frmData.dsMusicStore.WriteXml(strFilename) Me.dataGrid1.DataSource = frmData.dsMusicStore Me.dataGrid1.DataMember = "ItemTypes" Me.txtNewItemType.Text = "" Me.txtNewItemType.Focus() End Sub |
Saving the Items and the Orders |
Based on the close relationship between the DataSet class and XML, we will save our records as XML. |
Practical Learning: Opening an XML File |
Imports System.IO Imports System.Xml Imports System.Data Public Class NewStoreItem Inherits System.Windows.Forms.Form |
Private Sub NewStoreItem_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles MyBase.Load Dim frmData As DataCenter = New DataCenter Dim rdrMusicStore As XmlTextReader = Nothing Try Dim strFilename As String = "Categories.xml" If File.Exists(strFilename) Then rdrMusicStore = New XmlTextReader(strFilename) ' Scan the XML file While rdrMusicStore.Read() ' every time you find an element, find out what type it is ' If you find a category, put it in the Categories list box If (XmlNodeType.Element <> 0) And (rdrMusicStore.Name = "Category") Then Me.cboCategories.Items.Add(rdrMusicStore.ReadElementString("Category")) End If End While End If strFilename = "ItemTypes.xml" If File.Exists(strFilename) Then rdrMusicStore = New XmlTextReader(strFilename) ' Scan the XML file While rdrMusicStore.Read() ' every time you find an element, find out what type it is ' If you find an ItemType, put it in the Item Types list box If (XmlNodeType.Element <> 0) And (rdrMusicStore.Name = "ItemType") Then Me.cboItemTypes.Items.Add(rdrMusicStore.ReadElementString("ItemType")) End If End While End If Catch ex As XmlException MsgBox("Invalid XML file") Finally If Not (rdrMusicStore Is Nothing) Then rdrMusicStore.Close() End Try ' We will generate a random number for the store item Dim tmeNow As DateTime = DateTime.Now Dim rndNumber As Random = New Random(tmeNow.Millisecond) Dim strNumber As String = CStr(rndNumber.Next(100000, 999999)) ' Display the new number in the Part # text box Me.txtItemNumber.Text = strNumber ' Disable the Create button to indicate that the item is not ready Me.btnCreate.Enabled = False End Sub |
Private Sub btnNewCategory_Click(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles btnNewCategory.Click Dim frmCat As Categories = New Categories frmCat.ShowDialog() Dim rdrMusicStore As XmlTextReader = Nothing Try Dim strFilename As String = "Categories.xml" If File.Exists(strFilename) Then Me.cboCategories.Items.Clear() rdrMusicStore = New XmlTextReader(strFilename) ' Scan the XML file While rdrMusicStore.Read() ' every time you find an element, find out what type it is ' If you find a category, put it in the Categories list box If (XmlNodeType.Element <> Nothing) And (rdrMusicStore.Name = "Category") Then Dim strNew As String = rdrMusicStore.ReadElementString("Category") If Not (Me.cboCategories.Items.Contains(strNew)) Then Me.cboCategories.Items.Add(strNew) End If End If End While End If Catch ex As XmlException MsgBox("Invalid XML file") Finally If Not (rdrMusicStore Is Nothing) Then rdrMusicStore.Close() End If end try End Sub |
Private Sub btnNewType_Click(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles btnNewType.Click Dim frmTypes As ItemTypes = New ItemTypes frmTypes.ShowDialog() Dim rdrMusicStore As XmlTextReader = Nothing Try Dim strFilename As String = "ItemTypes.xml" If File.Exists(strFilename) Then rdrMusicStore = New XmlTextReader(strFilename) While rdrMusicStore.Read() If (XmlNodeType.Element <> 0) And (rdrMusicStore.Name = "ItemType") Then Dim strNewType As String = rdrMusicStore.ReadElementString("ItemType") If Not Me.cboItemTypes.Items.Contains(strNewType) Then Me.cboItemTypes.Items.Add(strNewType) End If End If End While End If Catch ex As XmlException MsgBox("Invalid XML file") Finally If Not (rdrMusicStore Is Nothing) Then rdrMusicStore.Close() End If End Try End Sub |
Private Sub txtItemName_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles txtItemName.TextChanged If Me.txtItemName.Text = "" Then Me.btnCreate.Enabled = False Else Me.btnCreate.Enabled = True End If End Sub |
Private Sub txtUnitPrice_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles txtUnitPrice.TextChanged If Me.txtUnitPrice.Text = "" Then Me.btnCreate.Enabled = False Else Me.btnCreate.Enabled = True End If End Sub |
Private Sub txtItemNumber_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles txtItemNumber.TextChanged If Me.txtItemNumber.Text = "" Then Me.btnCreate.Enabled = False Else Me.btnCreate.Enabled = True End If End Sub |
Private Sub btnCreate_Click(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles btnCreate.Click ' Get a reference to the Data Center because ' that's where the DataSet object resides Dim frmData As DataCenter = New DataCenter ' This is the XML file that will holds the general inventory ' of the current items in the store Dim strAvailableItems As String = "Inventory.xml" ' If the file exists already, open it If File.Exists(strAvailableItems) Then frmData.dsMusicStore.ReadXml(strAvailableItems) End If ' Create a new record for the AvailableItems table Dim rowNewItem As DataRow = frmData.dsMusicStore.Tables("AvailableItems").NewRow() rowNewItem("ItemNumber") = Me.txtItemNumber.Text rowNewItem("Category") = Me.cboCategories.Text rowNewItem("ItemType") = Me.cboItemTypes.Text rowNewItem("ItemName") = Me.txtItemName.Text rowNewItem("UnitPrice") = Me.txtUnitPrice.Text ' Add the new record to the AvailableItems table frmData.dsMusicStore.Tables("AvailableItems").Rows.Add(rowNewItem) ' Update the XML file frmData.dsMusicStore.WriteXml(strAvailableItems) ' Reset the controls in case the user wants to add another record Me.cboCategories.SelectedIndex = -1 Me.cboItemTypes.SelectedIndex = -1 Me.txtItemName.Text = "" Me.txtUnitPrice.Text = "0.00" ' We will generate a random number for the store item Dim tmeNow As DateTime = DateTime.Now Dim rndNumber As Random = New Random(tmeNow.Millisecond) Dim strNumber As String = CStr(rndNumber.Next(100000, 999999)) ' Display the new number in the Part # text box Me.txtItemNumber.Text = strNumber ' Disable the OK button to indicate that the item is not ready Me.btnCreate.Enabled = False End Sub |
|
|||||||||
|
||||||||||
Category | Item Type | Item Name | Unit Price |
Electric Guitar | Solid Body | Gibson Les Paul Standard Electric Guitar | 1950.00 |
Bass | 6-String | Ibanez SR506 6-string Electric Bass | 595.50 |
Electric Guitar | Hollow Body | Oscar Schmidt OE40 Hollow Body Electric Guitar | 205.95 |
Acoustic Guitar | Left-Handed | Yamaha Left-Handed FG413SL Acoustic Guitar | 295.95 |
Cables | Instrument Cable | Monster Cable S-100 Straight Instrument Cable | 12.95 |
Bass | Combo Amps | Behringer BX1200 Ultrabass Amplifier (120 Watts, 2-Channel) | 150.00 |
Keyboard | Synthesizers | Korg Triton Le 61-Key Workstation Synth | 895.95 |
Stands | Guitar Stand | string Swing Metal Guitar Wall Hanger | 9.95 |
Electric Guitar | Solid Body | Epiphone LP-100 Electric Guitar | 275.95 |
Keyboard | Digital Piano | Yamaha YDP223 88-Key Graded Hammer Piano With Bench | 1490.00 |
Cables | Guitar Cable | Spectraflex Guitar Cable | 42.25 |
Electric Guitar | Solid Body | Gibson Les Paul Classic Electric Guitar | 1625.95 |
Stands | Guitar Stand | Locking Tubular Guitar Stand | 4.95 |
Electric Guitar | Solid Body | ESP LTD Viper 400 Electric Guitar | 585.50 |
Acoustic Guitar | 12-String | Washburn J28S12DL Cumberland 12-string Guitar | 650.75 |
Electric Guitar | Hollow Body | Ibanez Artcore AF75 Electric Guitar | 315.95 |
Keyboard | Synthesizers | Korg Triton Extreme 61-Key Synth Workstation | 1895.00 |
Electric Guitar | Solid Body | Epiphone Les Paul Standard | 525.95 |
Stands | Guitar Stand | Guitar Folding Stand | 12.95 |
Electric Guitar | Hollow Body | Gibson ES-335 Reissue | 1850.00 |
Acoustic Guitar | 12-String | Martin DM12 | 850.00 |
Stands | Guitar Stand | Metal Guitar Wall Hanger | 9.95 |
Acoustic Guitar | Left Handed | Yamaha FG413SL | 295.95 |
Electric Guitar | Solid Body | Gibson Faded SG Special | 625.95 |
Bass | 4-String | Ibanez SR500 | 525.95 |
Electric Guitar | Hollow Body | Oscar Schmidt OE40 | 225.95 |
Electric Guitar | Left Handed | Schecher C-1 | 450.95 |
Cases | Cases | Les Paul Hardshell Case | 39.95 |
Cables | Instrument Cable | Hosa Dual Instrument Cable | 7.25 |
Imports System.IO Imports System.Xml Imports System.Data Public Class PurchaseOrder Inherits System.Windows.Forms.Form |
Private Sub PurchaseOrder_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load ' Get a reference to the object that holds the DataSet Dim frmData As DataCenter = New DataCenter ' Identify the file that holds the categories Dim strCategories As String = "Categories.xml" ' If that file exists, then open it If File.Exists(strCategories) Then frmData.dsMusicStore.ReadXml(strCategories) ' Just in case, empty the Categories list box Me.lbxCategories.Items.Clear() Dim row As DataRow = Nothing Dim i As Integer ' Scan the whole file to locate each category and retrieve it For i = 0 To frmData.tblCategories.Rows.Count - 1 Step 1 row = frmData.tblCategories.Rows(i) Me.lbxCategories.Items.Add(row("Category")) Next End If End Sub |
Private Sub lbxCategories_SelectedIndexChanged(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles lbxCategories.SelectedIndexChanged ' Get a reference to the object that holds the DataSet Dim frmData As DataCenter = New DataCenter ' Identify the file that holds the items Dim strAvailableItems As String = "Inventory.xml" ' Identify the category that the user selected Dim strSelectedCategory As String = Me.lbxCategories.Text ' If that file exists, then open it If File.Exists(strAvailableItems) Then frmData.dsMusicStore.ReadXml(strAvailableItems) End If ' Empty the Item Types list box Me.lbxItemTypes.Items.Clear() ' Also empty the Available Items list box Me.lbxAvailableItems.Items.Clear() Dim row As DataRow = Nothing Dim i As Integer ' Scan the whole table to locate each record For i = 0 To frmData.tblAvailableItems.Rows.Count - 1 Step 1 ' Get a reference to the current record row = frmData.tblAvailableItems.Rows(i) ' Get the name of the category of the current record Dim strCurrentCategory As String = row("Category") ' If the current category matches the one the user selected... If strCurrentCategory = strSelectedCategory Then ' ... then get the corresponding item type Dim strType As String = row("ItemType") ' Find out if the Item Types list box already contains the item type ' If it doesn't, then put it in the Item Types list box If Not (Me.lbxItemTypes.Items.Contains(strType)) Then Me.lbxItemTypes.Items.Add(strType) End If End If Next End Sub |
Private Sub lbxItemTypes_SelectedIndexChanged(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles lbxItemTypes.SelectedIndexChanged ' Get a reference to the object that holds the DataSet Dim frmData As DataCenter = New DataCenter ' Identify the file that holds the items Dim strAvailableItems As String = "Inventory.xml" ' Identify the category that the user selected Dim strSelectedCategory As String = Me.lbxCategories.Text Dim strSelectedType As String = Me.lbxItemTypes.Text ' If file exists, then open it If File.Exists(strAvailableItems) Then frmData.dsMusicStore.ReadXml(strAvailableItems) End If ' Empty the Available Items list box Me.lbxAvailableItems.Items.Clear() Dim row As DataRow = Nothing Dim i As Integer ' Scan the whole table to locate each record For i = 0 To frmData.tblAvailableItems.Rows.Count - 1 Step 1 ' Get a reference to the current record row = frmData.tblAvailableItems.Rows(i) ' Get the name of the category of the current record Dim strCurrentCategory As String = row("Category") ' Get the item type of the current record Dim strCurrentType As String = row("ItemType") ' If the current category matches the one the user selected ' and the current item type matches the type the user selected ... If (strCurrentCategory = strSelectedCategory) And (strCurrentType = strSelectedType) Then ' ... then get the corresponding item name Me.lbxAvailableItems.Items.Add(row("ItemName")) End If Next End Sub |
Private Sub lbxAvailableItems_DoubleClick(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles lbxAvailableItems.DoubleClick ' Get a reference to the object that holds the DataSet Dim frmData As DataCenter = New DataCenter ' Identify the file that holds the items Dim strAvailableItems As String = "Inventory.xml" ' Identify the item that the user selected Dim strSelectedCategory As String = Me.lbxCategories.Text Dim strSelectedType As String = Me.lbxItemTypes.Text Dim strSelectedName As String = Me.lbxAvailableItems.Text ' If file exists, then open it If File.Exists(strAvailableItems) Then frmData.dsMusicStore.ReadXml(strAvailableItems) Dim row As DataRow = Nothing ' Scan the whole table to locate each record Dim i As Integer For i = 0 To frmData.tblAvailableItems.Rows.Count - 1 Step 1 ' Get a reference to the current record row = frmData.tblAvailableItems.Rows(i) ' Get the name of the category of the current record Dim strCurrentCategory As String = row("Category") ' Get the item type of the current record Dim strCurrentType As String = row("ItemType") ' Get the name of the current item Dim strCurrentName As String = row("ItemName") ' Get the item number of the current item Dim strCurrentNumber As String = row("ItemNumber") ' Get the unit price of the current item Dim strCurrentPrice As String = row("UnitPrice") ' If the current parts match the ones the user selected ... If (strCurrentCategory = strSelectedCategory) And _ (strCurrentType = strSelectedType) And _ (strCurrentName = strSelectedName) Then ' ... then consider the corresponding item If Me.txtItemNumber1.Text = "" Then Me.txtItemNumber1.Text = strCurrentNumber Me.txtItemName1.Text = strCurrentName Me.txtUnitPrice1.Text = strCurrentPrice Me.txtQuantity1.Text = "1" Me.txtSubTotal1.Text = strCurrentPrice ElseIf Me.txtItemNumber2.Text = "" Then Me.txtItemNumber2.Text = strCurrentNumber Me.txtItemName2.Text = strCurrentName Me.txtUnitPrice2.Text = strCurrentPrice Me.txtQuantity2.Text = "1" Me.txtSubTotal2.Text = strCurrentPrice ElseIf Me.txtItemNumber3.Text = "" Then Me.txtItemNumber3.Text = strCurrentNumber Me.txtItemName3.Text = strCurrentName Me.txtUnitPrice3.Text = strCurrentPrice Me.txtQuantity3.Text = "1" Me.txtSubTotal3.Text = strCurrentPrice ElseIf Me.txtItemNumber4.Text = "" Then Me.txtItemNumber4.Text = strCurrentNumber Me.txtItemName4.Text = strCurrentName Me.txtUnitPrice4.Text = strCurrentPrice Me.txtQuantity4.Text = "1" Me.txtSubTotal4.Text = strCurrentPrice ElseIf Me.txtItemNumber5.Text = "" Then Me.txtItemNumber5.Text = strCurrentNumber Me.txtItemName5.Text = strCurrentName Me.txtUnitPrice5.Text = strCurrentPrice Me.txtQuantity5.Text = "1" Me.txtSubTotal5.Text = strCurrentPrice Else ' if me.txtItemNumber6.Text= "" then Me.txtItemNumber6.Text = strCurrentNumber Me.txtItemName6.Text = strCurrentName Me.txtUnitPrice6.Text = strCurrentPrice Me.txtQuantity6.Text = "1" Me.txtSubTotal6.Text = strCurrentPrice End If End If Next End If Me.btnCalculate_Click(sender, e) End Sub |
|
||
Home | Copyright © 2005-2016, FunctionX | |
|