十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
我们提供的服务有:成都做网站、成都网站建设、微信公众号开发、网站优化、网站认证、海原ssl等。为近千家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的海原网站制作公司
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
随机生成2-5阶方阵:
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
你要做一个考试系统??这可不是小程序,不过如果是超精简的话,我倒可以写个思路给你。
在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了,之后要加什么可以自己加上去~