十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
创建完相应的用户名,密码控件之后,输入以下代码:
创新互联建站-专业网站定制、快速模板网站建设、高性价比沁水网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式沁水网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖沁水地区。费用合理售后完善,10余年实体公司更值得信赖。
Imports System.Data.OleDb
Public Class Form1
Private Sub cmdok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdok.Click
Dim m_username As String
Dim m_userpwd As String
Dim cmd_result As MsgBoxResult
Dim m_da As New OleDbDataAdapter
Dim m_ds As New DataSet
Dim m_command As New OleDbCommand
Dim strsql As String
m_username = txtusername.Text
m_userpwd = txtuserpwd.Text
strsql = " select * from user_info where username='" m_username "' and userpwd='" m_userpwd "'"
OleDbConnection1.Open()
m_command.CommandType = CommandType.Text
m_command.CommandText = strsql
m_command.Connection = OleDbConnection1
m_da.SelectCommand = m_command
m_da.Fill(m_ds, "user_info")
If m_ds.Tables("user_info").Rows.Count 0 Then
cmd_result = MsgBox("欢迎登录", MsgBoxStyle.OKOnly, "提示")
Else
MsgBox("登录失败,请确认用户名和密码")
End If
End Sub
End Class
第一题:
不需要任何控件,代码如下:
Private Sub Form_Click()
Dim A() As Integer, N As Integer
Dim St As String, I As Integer, J As Integer
Randomize
Do
St = InputBox("数字的个数", "输入", Int(Rnd * 100))
If St = "" Then
MsgBox "请输入数字!"
Else
N = Int(Val(St))
If N 1 Then
MsgBox "请输入大于0的数字!"
Else
Exit Do
End If
End If
Loop
ReDim A(N)
For I = 1 To N
Do
St = InputBox("第" + Str(I) + "个数字", "输入", Int(Rnd * 100))
If St = "" Then
MsgBox "请输入数字!"
Else
A(I) = Int(Val(St))
Exit Do
End If
Loop
Next
For I = 1 To N - 1
For J = I + 1 To N
If A(I) A(J) Then
A(0) = A(I)
A(I) = A(J)
A(J) = A(0)
End If
Next
Next
For I = 1 To N
Open App.Path "\" Trim(Str(I)) ".txt" For Output As #1
Print #1, A(I)
Close #1
Next
Print "已经把"; N; "个数写入到"; App.Path; "\1.txt 到 "; N; ".txt中.请查看."
End Sub
'已经运行过.
第二题:
DIM 是变量声明语句,它的格式为:
dim 变量名[as 格式] [,变量名[as 格式][,变量名[as 格式]......]
其中:
变量名:以字母或汉字开始的字串,代表一个变量
格式有以下几种:
属于数字的有五种:
(1)字节型:byte可取值0-255
(2)整形:integer可取值-32768至32767
(3)长整形:long(可取值范围很大的正负整数)
(4)单精度型:single(可取值小数)
(5)双精度型:double(可取值范围更大,小数位数更多的小数)
字符串型:string(可代表由字母\数字或汉字组成的字符集合)
布尔型:boolean(取值为ture\false)
日期型:date(可表示形如2009-5-26 02:36这样的组合)
如果要用姓名\住址\单位名称...等用字符串型(string)
eg:dim name as string(用name变量表示名字时,声明成字符串变量)
如果是用数字需要做计算,如工资\合计\人数....等要用数字型,但有一个原则,优先选用范围小的(按照字节型(byte)\整形(integer)\长整形(long)\单精度型(single)\双精度型(double)的顺序选择),够用就可以了,这样可以占用内存少,运算速度快.
eg:dim count as integer(用integer表示员工人数时,可声明成整形变量)
eg:dim sum as single(用sum表示工资时,可声明成单精度型变量)
不知是否说得清楚了.
If DateTime.Now.Hour 6 And DateTime.Now.Hour 12 Then Me.Text = "上午好"
If DateTime.Now.Hour 12 And DateTime.Now.Hour 18 Then Me.Text = "下午好"
If DateTime.Now.Hour 18 And DateTime.Now.Hour 20 Then Me.Text = "晚上好"
新建窗口,添加picture控件
利用line()方法画线
line(开始x坐标,开始y坐标)-(结束x坐标,结束y坐标),线的颜色,画线的方式(默认为线,B为矩形无填充,BF为填充的矩形)
For i = 1 To 16
Picture1.Line (0, Picture1.Height / 2)-(i * (Picture1.Width / 16), 0), RGB(255, 0, 0)
Picture1.Line (0, Picture1.Height / 2)-(i * (Picture1.Width / 16), Picture1.Height), RGB(255, 0, 0)
Picture1.Line (Picture1.Width, Picture1.Height / 2)-(i * (Picture1.Width / 16), 0), RGB(0, 255, 0)
Picture1.Line (Picture1.Width, Picture1.Height / 2)-(i * (Picture1.Width / 16), Picture1.Height), RGB(0, 255, 0)
Next i
如果要在窗口上画也可以调用窗口的line方法即form.line()