網路城邦
上一篇 回創作列表 下一篇  字體:
快餐店結帳系統
2009/06/02 09:05:20瀏覽1882|回應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/06 23:48

姓名:曾郁凱

學號:710104

檔名:store


洪培馨
作業
2009/06/06 23:31

40210洪培馨

學號:710051

檔名:22223610.exe


710133
710133
2009/06/03 19:26

高一4班13號

林宜慶

學號:710133

檔名:boss.exe

這次超簡單的啦!!!!!!上一個做超久的~~~~~

夫子(yangfu) 於 2009-06-05 14:21 回覆:
不好意思!太簡單了!有點看不起人的為道哦!下個作業我會改進!^_^

123
456
2009/06/02 20:03

40331 廖秦利

學號:710110

檔名:WindowsApplication1.exe

話說回來 ...

右上角的框框 我不知道是用什麼做的

所以我做另一個東西 .. 但是很不順眼

希望老師指點指點 …… (希望老師能完成我這個小小的心願)

夫子(yangfu) 於 2009-06-03 09:34 回覆:
I did mention it when i explain the form design! that object is group_box just like an container you can put some other object into it and those object will be completely be inside object and will not be able to move out the group_box! you can take a look of the program code explain ! if you still have problem with it! I shall explain it more clearly at next week!

林佳潔
作業
2009/06/02 18:58

林佳潔

402  07   710048

檔名:happy710048.exe

夫子(yangfu) 於 2009-06-05 14:19 回覆:
Which folder did you put it please let me know the folder name , so i can access to it! thanks!

40440
作業
2009/06/02 12:01

高一四班40號賴柏志

檔名:710160fastfood

學號:710160

夫子(yangfu) 於 2009-06-05 14:22 回覆:
Your File had been checked!

鄧佑任
作業
2009/06/02 11:57

高一四班39號鄧佑任

檔名40439d.exe

學號710159

夫子(yangfu) 於 2009-06-05 14:24 回覆:
Since you had put webpage file inside of the folder , so please make a sub_folder to put your homework !

710161
作業
2009/06/02 11:46

班級404

學號710161

檔名1.EXE

夫子(yangfu) 於 2009-06-02 11:50 回覆:
Very Good! your function are correct! and program execute normal!

h710101
飲料店
2009/06/02 11:01

學號:h710101

檔名:drinkstore.exe

夫子(yangfu) 於 2009-06-02 11:48 回覆:
第一次執行時,你的合計沒動作,到第二個交易時才出現第一次的交易金額....!請更正錯誤後再上傳一次! (It so hard to keyin chinese! so please rechecked your file before you upload it! please!)

710065
飲料店
2009/06/02 10:06

黃筱葳

710065

飲料店.exe

高一二班

夫子(yangfu) 於 2009-06-02 11:45 回覆:
Did you test it before you upload it? cause I found error on total function! please check it and correct it! thank you!
頁/共 6 頁  回應文章第一頁 回應文章上一頁 回應文章下一頁 回應文章最後一頁