你要做一個(gè)考試系統(tǒng)??這可不是小程序,不過(guò)如果是超精簡(jiǎn)的話,我倒可以寫個(gè)思路給你。
創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比奉節(jié)網(wǎng)站開(kāi)發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫(kù),直接使用。一站式奉節(jié)網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋奉節(jié)地區(qū)。費(fèi)用合理售后完善,10余年實(shí)體公司更值得信賴。
在form添加一個(gè)label 和四個(gè)command1(組成一個(gè)控件組修改index屬性,按順序設(shè)置為ABCD)和一個(gè)command2(可要可不要,這個(gè)是作為跳過(guò)用的)
定義全局變量 questions() as string,questionid as integer,answers() as string
在form_load中,將問(wèn)題和答案讀入questions()和answers()中,然后將第一個(gè)問(wèn)題顯示在label中,設(shè)置questionid=1
之后在command1_click(index as integer)中用select語(yǔ)句根據(jù)questionid將答案和回答比較,然后顯示下一題,同時(shí)更改questionid。。。大概就這樣
command2_Click()就直接顯示下一題和更改questionid
問(wèn)題結(jié)束后就OK了,之后要加什么可以自己加上去~
Public C護(hù)激篙刻蕻灸戈熏恭抹lass Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim c As Char
c = Trim(TextBox3.Text)
Select Case c
Case "+"
TextBox4.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
Case "-"
TextBox4.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
Case "*"
TextBox4.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
Case "\"
If Val(TextBox2.Text) = 0 Then
MsgBox("分母為0")
Else
TextBox4.Text = Val(TextBox1.Text) \ Val(TextBox2.Text)
End If
Case "/"
If Val(TextBox2.Text) = 0 Then
MsgBox("分母為0")
Else
TextBox4.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
End If
End Select
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub
End Class
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim oleDbConnection1 As OleDb.OleDbConnection
Dim oledbDataAdapter As OleDb.OleDbDataAdapter
Dim oledbData As DataSet = New DataSet
Dim strConnect As String = "Provider= OraOLEDB.Oracle;Data Source=888;User ID=888;Password=888;"
oleDbConnection1 = New System.Data.OleDb.OleDbConnection(strConnect)
Dim strSql As String
strSql = "select *" " from xx"
Dim oledbCommand As OleDb.OleDbCommand
oledbCommand.CommandText = strSql
oledbCommand.CommandType = CommandType.Text
oledbCommand.Connection = oleDbConnection1
oledbDataAdapter.SelectCommand = oledbCommand
oleDbConnection1.Open()
oledbDataAdapter.Fill(oledbData, "gy_bingrenxx")
oleDbConnection1.Close()
'在窗體上添加一個(gè)DataGridView控件,在這個(gè)位置加一句代碼
DataGridView1.DataSource = oledbDataAdapter.Tables("gy_bingrenxx")
End Sub
添加一個(gè)按鈕和一個(gè)文本框,X不要太大,會(huì)溢出的!
Try
Dim i, j As Integer
Dim sum As Long
i = 1
sum = 0
For j = 1 To TextBox1.Text
sum += i
i = i * 2
Next
MessageBox.Show("結(jié)果:" sum.ToString())
Catch ex As Exception
MessageBox.Show(ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End Try