網路城邦
上一篇 回創作列表 下一篇  字體:
快餐店結帳系統
2009/06/02 09:05:20瀏覽1871|回應52|推薦0

現在我們將以一個實際運用的範例來做為Visual Basic程式語言的學習階段驗收!

When you completed the work ! please build it to execute file and upload it to school network storage site and show me the link so i can check it! thanks!

表單設計如所附上的圖!請好好的看一下所運用到的物件!當然!程式碼我還是先附上給各位參考!但希望你現在應該具有基本的"閱讀"程式碼的功力了!可別還是停留在"文抄公"的階段!因為你應該具有閱讀別人程式碼的能力,才能夠進行修改程式碼,來符合功能要求!這樣才能由利用"範例"來撰寫一般標準的"視窗應用程式"的能力!

Program code list(程式碼列表)

Public Class Form1

    Dim total, accTotal As Integer

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Label6.Text = "$" & total & ""

        Label7.Text = "累計:$" & accTotal & ""

        Label6.Font = New Font("新細明體", 24)

        Label6.ForeColor = Color.Red

        total = 0

        accTotal = 0

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        total = Val(TBoxPrice1.Text) * Val(TBoxQty1.Text) + Val(TBoxPrice2.Text) * Val(TBoxQty2.Text) + Val(TBoxPrice3.Text) * Val(TBoxQty3.Text)

        If total > 2000 Then RadioButton3.Checked = True

        If RadioButton1.Checked = True Then total = total * 0.9

        If RadioButton2.Checked = True Then total = total * 0.8

        If RadioButton3.Checked = True Then total = total * 0.75

        Label6.Text = "$" & total & ""

        accTotal = accTotal + total

        Label7.Text = "累計:$" & accTotal & ""

        ListBox1.Items.Add(total & "-->" & "豬肉" & TBoxPrice1.Text & "*" & TBoxQty1.Text & "雞肉" & TBoxPrice2.Text & "*" & TBoxQty2.Text & "牛肉" & TBoxPrice3.Text & "*" & TBoxQty3.Text)

    End Sub

  

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        TBoxQty1.Text = 0

        TBoxQty2.Text = 0

        TBoxQty3.Text = 0

        total = 0

        Label6.Text = "$" & total & ""

    End Sub

    Private Sub ListBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseUp

        accTotal = accTotal - (Val(ListBox1.SelectedItem))

        ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)

        Label7.Text = "累計:$" & accTotal & ""

    End Sub

End Class

 

 

 

 

 

( 知識學習其他 )
回應 推薦文章 列印 加入我的文摘
上一篇 回創作列表 下一篇

引用
引用網址:https://classic-blog.udn.com/article/trackback.jsp?uid=yangfu&aid=3003791

 回應文章 頁/共 6 頁  回應文章第一頁 回應文章上一頁 回應文章下一頁 回應文章最後一頁

林文心
功課
2009/06/02 10:06

40206

710047

林文心

檔名:easy.exe

ps.在homework的資料夾裡

夫子(yangfu) 於 2009-06-02 11:43 回覆:
沒價格? 沒有出現"總計",而"合計"也消失了?????

詹欣蓓
作業
2009/06/02 09:44

402-31 詹欣蓓

710070

h710070.exe

夫子(yangfu) 於 2009-06-02 09:55 回覆:
Sorry! I use this link to check your file (http://wwws.sysh.tc.edu.tw/~h710070/h710070.exe) and the reply is error code 404 file not found! so .....can you told me what is go wrong? did you put the file on it? or just the error filename or ..... etc please informated me ASAP! thank you very much!
頁/共 6 頁  回應文章第一頁 回應文章上一頁 回應文章下一頁 回應文章最後一頁