成都网站建设设计

将想法与焦点和您一起共享

vb.net实验小程序的简单介绍

vb.net的小程序

你要做一个考试系统??这可不是小程序,不过如果是超精简的话,我倒可以写个思路给你。

创新互联-专业网站定制、快速模板网站建设、高性价比奉节网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式奉节网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖奉节地区。费用合理售后完善,10余年实体公司更值得信赖。

在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了,之后要加什么可以自己加上去~

VB.NET怎么编模拟袖珍计算器的完整程序?

Public C护激篙刻蕻灸戈熏恭抹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

VB.net做一个小程序 求教

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

vb.net 有关循环的小程序

添加一个按钮和一个文本框,X不要太大,会溢出的!

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("结果:" sum.ToString())

Catch ex As Exception

MessageBox.Show(ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning)

End Try


当前标题:vb.net实验小程序的简单介绍
本文路径:http://chengdu.cdxwcx.cn/article/hpisdi.html