隨機生成2-5階方陣:
創(chuàng)新互聯(lián)科技有限公司專業(yè)互聯(lián)網基礎服務商,為您提供成都移動服務器托管,高防主機,成都IDC機房托管,成都主機托管等互聯(lián)網服務。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim d(,) As Integer
Dim n As Integer
Dim i As Integer
Dim j As Integer
Randomize()
n = Int(4 * Rnd() + 2)
ReDim d(n, n)
Label1.Text = ""
For i = 1 To n
For j = 1 To n
d(i, j) = Int(Rnd() + 0.5)
Label1.Text = Label1.Text d(i, j) " "
Next
Label1.Text = Label1.Text vbCrLf
Next
End Sub
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()
'在窗體上添加一個DataGridView控件,在這個位置加一句代碼
DataGridView1.DataSource = oledbDataAdapter.Tables("gy_bingrenxx")
End Sub
你要做一個考試系統(tǒng)??這可不是小程序,不過如果是超精簡的話,我倒可以寫個思路給你。
在form添加一個label 和四個command1(組成一個控件組修改index屬性,按順序設置為ABCD)和一個command2(可要可不要,這個是作為跳過用的)
定義全局變量 questions() as string,questionid as integer,answers() as string
在form_load中,將問題和答案讀入questions()和answers()中,然后將第一個問題顯示在label中,設置questionid=1
之后在command1_click(index as integer)中用select語句根據questionid將答案和回答比較,然后顯示下一題,同時更改questionid。。。大概就這樣
command2_Click()就直接顯示下一題和更改questionid
問題結束后就OK了,之后要加什么可以自己加上去~