1 / 12

南台科技大學 機械工程系 奈米一乙 學號 : 4A214088 老師 : 謝慶存

計算機程式及實習 期末報告 ppt 製作 題目 : 泡麵 品牌票選. 南台科技大學 機械工程系 奈米一乙 學號 : 4A214088 老師 : 謝慶存. 泡麵 品牌 票選 : 題目說明 : 主題說明與背景. 使用了 GroudBox 把 rdb 控制項封裝起來 利用 了 GroupBox1.Enabled = fale 把 rdb 控制項影隱藏起來 使用 if 選擇結構 使用 listBox 儲存資料並可讀取. 表單 (form) 設計 : 解題分析. txtName. Label1 ltbName GroupBox1 rdbM rdbE

lok
Download Presentation

南台科技大學 機械工程系 奈米一乙 學號 : 4A214088 老師 : 謝慶存

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 計算機程式及實習 期末報告ppt製作 題目:泡麵品牌票選 南台科技大學 機械工程系 奈米一乙 學號:4A214088 老師:謝慶存

  2. 泡麵品牌票選:題目說明:主題說明與背景 使用了GroudBox把rdb控制項封裝起來 利用了GroupBox1.Enabled = fale把rdb控制項影隱藏起來 使用if 選擇結構 使用listBox儲存資料並可讀取

  3. 表單(form)設計:解題分析 txtName Label1 ltbName GroupBox1 rdbM rdbE rdbW rdbT rdbQ lblButton Label2 txtTotal GroupBox2 txtM txtE txtW txtT txtQ

  4. 程式碼撰寫:宣告,lblButton_Click Public Class 泡麵品牌票選 Dim intM As Integer = 0 : Dim intE As Integer = 0 : Dim intW As Integer = 0 : Dim intT As Integer = 0 : Dim intQ As Integer = 0 : Dim total As Integer = 0 Private Sub lblButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblButton.Click If ltbName.Items.IndexOf(txtName.Text) = -1 Then ltbName.Items.Add(txtName.Text) : total += 1 : txtTotal.Text = total : GroupBox1.Enabled = True : lblButton.Enabled = False : rdbM.Checked = False : rdbE.Checked = False : rdbW.Checked = False : rdbT.Checked = False : rdbQ.Checked = False Else MsgBox("使用者姓名已經存在!") End If End Sub

  5. Form1_Load事件rdbM_CheckedChanged事件 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load GroupBox1.Enabled = False End Sub Private Sub rdbM_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdbM.CheckedChanged If rdbM.Checked = True Then intM += 1 : txtM.Text = intM : ltbChoice.Items.Add("M") : GroupBox1.Enabled = False : lblButton.Enabled = True End If End Sub

  6. rdbE_CheckedChanged事件rdbW_CheckedChanged事件 • Private Sub rdbE_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdbE.CheckedChanged • If rdbE.Checked = True Then • intE += 1 : txtE.Text = intE : ltbChoice.Items.Add("E") : GroupBox1.Enabled = False : lblButton.Enabled = True • End If • End Sub • Private Sub rdbW_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdbW.CheckedChanged • If rdbW.Checked = True Then • intW += 1 : txtW.Text = intW : ltbChoice.Items.Add("W") : GroupBox1.Enabled = False : lblButton.Enabled = True • End If • End Sub

  7. rdbT_CheckedChanged事件rdbQ_CheckedChanged事件 • Private Sub rdbT_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdbT.CheckedChanged • If rdbT.Checked = True Then • intT += 1 : txtT.Text = intT : ltbChoice.Items.Add("T") : GroupBox1.Enabled = False : lblButton.Enabled = True • End If • End Sub • Private Sub rdbQ_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdbQ.CheckedChanged • If rdbQ.Checked = True Then • intQ += 1 : txtQ.Text = intQ : ltbChoice.Items.Add("Q") : GroupBox1.Enabled = False : lblButton.Enabled = True • End If • End Sub

  8. ltbName_SelectedIndexChanged • Private Sub ltbName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ltbName.SelectedIndexChanged • Dim index As Integer • index = ltbName.SelectedIndex • MsgBox(ltbName.Text & "選擇" & ltbChoice.Items(index) & "牌") • End Sub • End Class

  9. 程式說明-起始畫面 先輸入姓名再按參與投票

  10. 程式說明-開始投票 點選一度讚的rdb控制項時,便會直接計票,並再次將GroupBox1.Enabled = False

  11. 心得感言 雖然重以前就聽過程式語言,但這是第一次操作這所謂的VB語言,其實也就是幾個簡單的單字組成,再搭配書寫的公是寫出來的,看似簡單,但又有一定的難度。 因為我以前是機械科的,所以這學期的VB真的讓我受益良多!

  12. 參考文獻 Visual Basic 2010 程式設計 作者: 陳會安

More Related