Download presentation
Presentation is loading. Please wait.
Published byNicholas Logan Modified over 9 years ago
1
南台科技大學 機械工程系 奈米一乙 學號 :4A214088 老師 : 謝慶存 計算機程式及實習 期末報告 ppt 製作 泡麵品牌票選 題目 : 泡麵品牌票選
2
泡麵品牌票選 : 題目說明 : 主題說明 與背景 使用了 GroudBox 把 rdb 控制項封裝起來 利用了 GroupBox1.Enabled = fale 把 rdb 控制項影隱藏起來 使用 if 選擇結構 使用 listBox 儲存資料並可讀取
3
Label1 ltbName GroupBox1 rdbM rdbE rdbW rdbT rdbQ txtName lblButton Label2 txtTotal GroupBox2 txtM txtE txtW txtT txtQ
4
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
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
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
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
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 程式設計 作者: 陳會安
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.