VB高手请赐教
请帮忙做下这两题:1.采用selectcase语句改写下列程序段:Ifx<=30Andx>0ThenIfx<15ThenIfx<10Theny=0Elsey=1ElseI...
请帮忙做下这两题:
1.采用select case 语句改写下列程序段:
Ifx<=30 Andx>0Then
Ifx<15Then
Ifx<10 Then y=0 Else y=1
Else
Ifx<20 Then y=2 Else
End If
Else
y=4
End If
2.以下时间过程判断文本框Text1中的数据,如果该数据满足条件,大于100且能被5整除,则清除文本框Text2中的内容,否则将焦点定位在文本框Text1中,选中其中的文本并将这些文本显示Text2中。
Private. Sub command_Click()
x=Val (Text1.Text)
If_____(1)_____then
Text2. Text =" "
Else
Text1.SetFocus
Text2.Selstart=_______(2)______
Text1.Sellength=______(3)______
Text2Text=_______(4)_______
End If
End Sub 展开
1.采用select case 语句改写下列程序段:
Ifx<=30 Andx>0Then
Ifx<15Then
Ifx<10 Then y=0 Else y=1
Else
Ifx<20 Then y=2 Else
End If
Else
y=4
End If
2.以下时间过程判断文本框Text1中的数据,如果该数据满足条件,大于100且能被5整除,则清除文本框Text2中的内容,否则将焦点定位在文本框Text1中,选中其中的文本并将这些文本显示Text2中。
Private. Sub command_Click()
x=Val (Text1.Text)
If_____(1)_____then
Text2. Text =" "
Else
Text1.SetFocus
Text2.Selstart=_______(2)______
Text1.Sellength=______(3)______
Text2Text=_______(4)_______
End If
End Sub 展开
展开全部
问题1
Select Case x
Case Is > 30 Or x <= 0: y = 4
Case Is < 10: y = 0
Case Is < 15: y = 1
Case Is < 20: y = 2
Case Else: y = 3
End Select
'另外,If x < 20 Then y = 2 Else 是否应为:
'If x < 20 Then y = 2 Else y = 3
问题2
Private Sub Command1_Click()
x = Val(Text1.Text)
If x > 100 And (x Mod 5 = 0) Then
Text2.Text = ""
Else
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Text2.Text = Text1.Text
End If
End Sub
'另外,Text2.Selstart 是否应为:Text1.Selstart
Select Case x
Case Is > 30 Or x <= 0: y = 4
Case Is < 10: y = 0
Case Is < 15: y = 1
Case Is < 20: y = 2
Case Else: y = 3
End Select
'另外,If x < 20 Then y = 2 Else 是否应为:
'If x < 20 Then y = 2 Else y = 3
问题2
Private Sub Command1_Click()
x = Val(Text1.Text)
If x > 100 And (x Mod 5 = 0) Then
Text2.Text = ""
Else
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Text2.Text = Text1.Text
End If
End Sub
'另外,Text2.Selstart 是否应为:Text1.Selstart
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询