Redim Preserve Arr(10,n)
成都创新互联是一家专注于成都网站设计、成都网站制作与策划设计,嘉祥网站建设哪家好?成都创新互联做网站,专注于网站建设十年,网设计领域的专业建站公司;建站业务涵盖:嘉祥等地区。嘉祥做网站价格咨询:18982081108
通过Preserve关键字定义的动态数组,可以更改数组arr最末维的大小,且保留数组arr原来各个元素的值。
所以答案为:C
例如:
Dim arr()
Redim arr(1 to 1,1 to 2)
arr(1,2) = "你好"
Redim Preserve arr(1 to 1, 1 to 3)
msgbox arr(1,2) '这个时候依然可以得到arr(1,2)的值为“你好”。
而且从答案来看,Redim只可能与Preserve联合使用。其他都无法编译!
上网收费:'Option Explicit
Dim t As Integer, f As Single, x As String
Private Sub Form_Load()
Text1.Text = ""
Label2 = ""
End Sub
Private Sub Command1_Click()
If Text1.Text = "" Then
Text1.SetFocus
MsgBox "请输入上网时间"
Exit Sub
End If
t = Val(Text1.Text)
If t 120 Then
f = 0.06 * t + 2
Else
f = 0.06 * t * 0.85
End If
x = Str$(f) + "元"
Label2.Caption = x
Text1.SetFocus
End Sub
三角函数:Private Sub Form_Load()
Text1.Text = ""
Label7.Caption = ""
End Sub
Private Sub Command1_Click()
Dim a, b As Double
Dim c As String
' Form2.Cls
If Text1.Text = "" Then
Text1.SetFocus
MsgBox "请输入计算数据"
Exit Sub
End If
If Option4.Value = True Then
b = Val(Text1.Text) * 3.14 / 180
ElseIf Option5.Value = True Then
b = Val(Text1.Text)
End If
If Option1.Value = True Then
a = Sin(b)
c = "sin(" Text1.Text ")="
ElseIf Option2.Value = True Then
a = Cos(b)
c = "Cos(" Text1.Text ")="
ElseIf Option3.Value = True Then
a = Tan(b)
c = "Tan(" Text1.Text ")="
End If
a = Round(a, 6)
a = Format(a, "0.##########")
'If Left(a, 1) = "." Then
' a = "0" a
'ElseIf Left(a, 2) = "-." Then
' a = "-0" Right(a, Len(a) - 1)
'End If
Label7.Caption = c a
End Sub
打印几何图形:Private Sub Form_Load()
Picture1.FontSize = 16
End Sub
Private Sub Image1_Click()
Picture1.CurrentX = 0
Picture1.CurrentY = 0
For i = 0 To 5
Picture1.Print Tab(8 - i);
For j = 1 To 2 * i + 1
Picture1.Print "*";
Next j
Next i
End Sub
Private Sub Image2_Click()
Picture1.CurrentX = 0
Picture1.CurrentY = 0
For i = 0 To 5
Picture1.Print Tab(12 + i);
For j = 1 To 6
Picture1.Print "*";
Next j
Next i
End Sub
计算矩形周长面积:
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Label3.Caption = ""
End Sub
Private Sub Command1_Click()
If Text1.Text = "" Then
Text1.SetFocus
MsgBox "请输入矩形的长"
Exit Sub
End If
If Text2.Text = "" Then
Text2.SetFocus
MsgBox "请输入矩形的宽"
Exit Sub
End If
If Option1.Value = False And Option2.Value = False Then
MsgBox "请选择计算类型"
Exit Sub
End If
s = Val(Text1.Text) * Val(Text2.Text)
l = 2 * (Val(Text1.Text) + Val(Text2.Text))
If Option1 = True Then
Label3.Caption = Str(s)
ElseIf Option2 = True Then
Label3.Caption = Str(l)
End If
End Sub
Private Sub Command2_Click()
Label3.Caption = ""
End Sub
Private Sub Command3_Click()
End
End Sub
计算器:Dim jsff
Dim f_num As Single
Private Sub Form_Load()
f_num = 0
jsff = ""
Text1.Text = ""
End Sub
Private Sub js()
Select Case jsff
Case "+"
f_num = f_num + Val(Text1.Text)
Case "-"
f_num = f_num - Text1.Text
Case "*"
f_num = f_num * Text1.Text
Case "/"
f_num = f_num / Text1.Text
Case "/"
f_num = f_num / Text1.Text
End Select
End Sub
Sub Command1_Click() '+
If Text1.Text = "" Then
Text1.SetFocus
Exit Sub
End If
If jsff = "" Then
f_num = Val(Text1.Text)
Else
js
End If
jsff = "+"
Text1.Text = ""
Text1.SetFocus
End Sub
Private Sub Command2_Click()
If Text1.Text = "" Then
Text1.SetFocus
Exit Sub
End If
If jsff = "" Then
f_num = Val(Text1.Text)
Else
js
End If
jsff = "-"
Text1.Text = ""
Text1.SetFocus
End Sub
Private Sub Command3_Click()
If Text1.Text = "" Then
Exit Sub
End If
If jsff = "" Then
f_num = Val(Text1.Text)
Else
js
End If
jsff = "*"
Text1.Text = ""
Text1.SetFocus
End Sub
Private Sub Command4_Click()
If Text1.Text = "" Then
Exit Sub
End If
If jsff = "" Then
f_num = Val(Text1.Text)
Else
js
End If
jsff = "/"
Text1.Text = ""
Text1.SetFocus
End Sub
Private Sub Command6_Click()
If Text1.Text = "" Then
Text1.SetFocus
Exit Sub
End If
x = Round(Sin(Val(Text1.Text)), 4)
If Left(x, 2) = "-." Then
x = "-0" Right(x, Len(x) - 1)
ElseIf Left(x, 1) = "." Then
x = "0" x
End If
Text1.Text = x
End Sub
Private Sub Command7_Click()
If Text1.Text = "" Then
Text1.SetFocus
Exit Sub
End If
x = Format(Round(Cos(Val(Text1.Text)), 4), "0.##########")
Text1.Text = x
End Sub
Private Sub Command8_Click()
If Val(Text1.Text) 0 Then
MsgBox "请不要对负数做开方运算"
Text1.SetFocus
Exit Sub
End If
x = Sqr(Val(Text1.Text))
If Left(x, 1) = "." Then x = "0" x
Text1.Text = x
End Sub
Private Sub Command9_Click()
If Text1.Text = 0 Then
MsgBox "请不要对0做倒数运算"
Text1.SetFocus
Exit Sub
End If
x = Val(1 / Text1.Text)
If Left(x, 2) = "-." Then
x = "-0" Right(x, Len(x) - 1)
ElseIf Left(x, 1) = "." Then
x = "0" x
End If
Text1.Text = x
End Sub
Private Sub Command5_Click()
If Text1.Text = "" And jsff = "" Then
Text1.SetFocus
Exit Sub
End If
If Text1.Text = "" And jsff = "+" Then
MsgBox "请输入加数"
Text1.SetFocus
Exit Sub
ElseIf Text1.Text = "" And jsff = "-" Then
MsgBox "请输入减数"
Text1.SetFocus
Exit Sub
ElseIf Text1.Text = "" And jsff = "*" Then
MsgBox "请输入乘数"
Text1.SetFocus
Exit Sub
ElseIf Text1.Text = "" And jsff = "/" Then
MsgBox "请输入除数"
Text1.SetFocus
Exit Sub
ElseIf Text1.Text = 0 And jsff = "/" Then
MsgBox "请不要用0做除数"
Text1.SetFocus
Exit Sub
End If
js
x = f_num
If Left(x, 2) = "-." Then
x = "-0" Right(x, Len(x) - 1)
ElseIf Left(x, 1) = "." Then
x = "0" x
End If
Text1.Text = x
jsff = ""
f_num = 0
End Sub
Private Sub Command10_Click()
Text1.Text = ""
f_num = 0
jsff = ""
Text1.SetFocus
End Sub
Private Sub Text1_Change()
End Sub
检查体重:
'Option Explicit
Dim bz
Private Sub Form_Load()
bz = 0
End Sub
Private Sub Command1_Click()
If Text1.Text = "" Then
Text1.SetFocus
MsgBox "请输入身高"
Exit Sub
End If
If Text2.Text = "" Then
Text2.SetFocus
MsgBox "请输入体重"
Exit Sub
End If
If Option1.Value = False And Option2.Value = False Then
MsgBox "请选择被检测者性别"
Exit Sub
End If
If Option1 = True Then
x = Val(Text1.Text) - 100
ElseIf Option2 = True Then
x = Val(Text1.Text) - 105
End If
If Val(Text2.Text) x Then
Label3.Caption = "体重超标"
Timer1.Enabled = True
Else
Label3.Caption = "体重正常"
Image2.Picture = Image1.Picture
End If
End Sub
Private Sub Timer1_Timer()
If bz = 1 Then
Image2.Picture = Image1.Picture
bz = 0
ElseIf bz = 0 Then
Image2.Picture = Image3.Picture
bz = 1
End If
End Sub
Private Sub Command2_Click()
Label3.Caption = ""
Timer1.Enabled = False
Image2.Picture = Image3.Picture
End Sub
Private Sub Command3_Click()
End
End Sub
小广告:Dim bz
Private Sub Form_Load()
bz = 0
End Sub
Private Sub Command1_Click()
Label1.Visible = True
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
If Label1.Left 0 Then
Label1.Left = 6000
Else
Label1.Left = Label1.Left - 150
End If
If bz = 1 Then
Image3.Picture = Image1.Picture
bz = 0
ElseIf bz = 0 Then
Image3.Picture = Image2.Picture
bz = 1
End If
End Sub
诊断处方:Private Sub Form_Load()
Combo1.AddItem "轻微红肿"
Combo1.AddItem "肿痛"
Combo1.AddItem "化脓"
Combo1.Text = Combo1.List(0) '设置combo1的默认选择
Combo2.AddItem "轻度"
Combo2.AddItem "中度"
Combo2.AddItem "重度"
Combo2.AddItem "剧烈"
Combo2.AddItem "尖锐"
Combo2.Text = Combo2.List(0) '设置combo2的默认选择
Combo3.AddItem "36度"
Combo3.AddItem "37度"
Combo3.AddItem "38度"
Combo3.AddItem "39度"
Combo3.AddItem "40度"
Combo3.Text = Combo3.List(0) '设置combo3的默认选择
Combo4.AddItem "干咳"
Combo4.AddItem "有痰"
Combo4.AddItem "早起咳"
Combo4.Text = Combo4.List(0) '设置combo4的默认选择
List1.AddItem "咽炎方" '设置列表框的可选项目
List1.AddItem "阿司匹林"
List1.AddItem "青霉素针剂"
List1.AddItem "感冒通"
List1.AddItem "维生素B"
List1.AddItem "维生素C"
List1.AddItem "喉片"
List1.Text = List1.List(0)
End Sub
Private Sub List1_DblClick()
List2.AddItem List1.Text
End Sub
Private Sub List2_DblClick()
List2.RemoveItem List2.ListIndex
End Sub
Private Sub Command1_Click()
Var$ = Combo1.Text + Combo2.Text + Combo3.Text + Combo4.Text
Select Case Var$
Case Is = "肿痛轻度38度干咳"
Text1.Text = "咽炎"
Case Is = "化脓中度39度早起咳"
Text1.Text = "扁桃体发炎"
Case Is = "化脓重度40度有痰"
Text1.Text = "肺炎"
Case Else
Text1.Text = "重选"
End Select
End Sub
Private Sub Command3_Click()
For i = 0 To List2.ListCount - 1
If i = List2.ListCount Then
Exit Sub
ElseIf List2.Selected(i) Then
List2.RemoveItem i
i = -1
End If
Next i
End Sub
Private Sub Command2_Click()
End
End Sub
VB的运算顺序是:先乘除、后加减,有括号的先算括号内,有负号的先算负号。
请你比较一下这个运算中x和y的值:
Dim n As Single = 4
Dim x As Single
Dim y As Single
x = n + 1
x = x / n
x = x - 1
x = Math.Sqrt(x)
y = Math.Sqrt((n + 1) / n - 1)
这样就会发现,你的代码中括号的位置错了。
正确的应该是: Math.Sqrt((n + 1) / n - 1)
1.在安全模式下用户可以轻松地修复系统的一些错误,起到事半功倍的效果。启动计算机,必须在系统显示windows启动画面前,按f8键,就可以进入计算机的安全模式。
2.bois是一个用于修改cmos ram参数程序。启动计算机时,按del键可以进入bios程序菜单,修改cmos参数。
3.windows XP操作系统是用于运行和管理整个计算机的软硬资源的系统软件,属于多用户多任务的操作系统。
4.决定微机整体性能的物理部件有主板、内存、显卡、处理器,除了这些部件以外,主板芯片组部件决定着整个机器的稳定性。
5.目前,计算机上配置的显卡分为集成显卡和独立显卡,其中独立显卡性能更好。
6.说出5种使用USB接口的微机常用设备键盘、鼠标、打印机、扫描仪、u盘
7.预防病毒的主要措施有:--。--。--。--。--
8.目前,计算机上的内存类型是sdram、ddr ram和rddam一般来说,内存越大,数据处理能力越强。
9.复制当前窗口,必须先按住alt键,然后按住print键。复制整个屏幕需要按住print键
10.正常情况下,启动计算机都是从c盘启动的,需要从光盘启动的计算机必须要进行bios设置