VB程序设计问题 10
设计一程序,当程序运行后,在窗体的正中间显示“你好!请输入你的姓名”,焦点定在旗下的文本框中。当用户输入姓名并单击窗“确定”按钮后,在窗体中用黑体、三号、红色显示“XXX...
设计一程序,当程序运行后,在窗体的正中间显示“你好!请输入你的姓名”
,
焦点定在旗下的文本框中。当用户输入姓名并单击窗“确定”按钮后,在窗体中
用黑体、三号、红色显示“
XXX
同学,你好!祝你学好
VB
程序设计”
,同时窗
体上出现两个命令按钮“继续”和“结束”
,其中
XXX
是用户输入的姓名。如
果单击继续按钮,则又回到初始运行状态,单击结束按钮即结束程序运行。
Private Sub Command1_Click()
laber1.Visible = False
laber2.Visible = True
Text1.Visible = False
Command1.Visible = False
Command2.Visible = True
Command3.Visible = True
laber2.Caption = Text1.Text & "同学你好,祝你学好VB程序设计!"
laber2.ForeColor = vbRed
laber2.FontName = "黑体"
laber2.FontSize = 16
End Sub
Private Sub Command2_Click()
laber1.cisible = True
laber2.Visible = False
Text1.Visible = True
Command1.Visible = True
Command2.Visible = False
Command3.Visible = False
Text1.Text = ""
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Form_Load()
laber1.Visible = True
laber2.Visible = False
Text1.Visible = True
Command1.Visible = True
我运行错误,求解 展开
,
焦点定在旗下的文本框中。当用户输入姓名并单击窗“确定”按钮后,在窗体中
用黑体、三号、红色显示“
XXX
同学,你好!祝你学好
VB
程序设计”
,同时窗
体上出现两个命令按钮“继续”和“结束”
,其中
XXX
是用户输入的姓名。如
果单击继续按钮,则又回到初始运行状态,单击结束按钮即结束程序运行。
Private Sub Command1_Click()
laber1.Visible = False
laber2.Visible = True
Text1.Visible = False
Command1.Visible = False
Command2.Visible = True
Command3.Visible = True
laber2.Caption = Text1.Text & "同学你好,祝你学好VB程序设计!"
laber2.ForeColor = vbRed
laber2.FontName = "黑体"
laber2.FontSize = 16
End Sub
Private Sub Command2_Click()
laber1.cisible = True
laber2.Visible = False
Text1.Visible = True
Command1.Visible = True
Command2.Visible = False
Command3.Visible = False
Text1.Text = ""
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Form_Load()
laber1.Visible = True
laber2.Visible = False
Text1.Visible = True
Command1.Visible = True
我运行错误,求解 展开
4个回答
展开全部
原程序多处单词拼写错误。现已纠正,并运行通过:
Private Sub Command1_Click()
Label1.Visible = False
Label2.Visible = True
Text1.Visible = False
Command1.Visible = False
Command2.Visible = True
Command3.Visible = True
Label2.Caption = Text1.Text & "同学你好,祝你学好VB程序设计!"
Label2.ForeColor = vbRed
Label2.FontName = "黑体"
Label2.FontSize = 16
End Sub
Private Sub Command2_Click()
Label1.Visible = True
Label2.Visible = False
Text1.Visible = True
Command1.Visible = True
Command2.Visible = False
Command3.Visible = False
Text1.Text = ""
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Form_Load()
Label1.Visible = True
Label2.Visible = False
Text1.Visible = True
Command1.Visible = True
End Sub
Private Sub Command1_Click()
Label1.Visible = False
Label2.Visible = True
Text1.Visible = False
Command1.Visible = False
Command2.Visible = True
Command3.Visible = True
Label2.Caption = Text1.Text & "同学你好,祝你学好VB程序设计!"
Label2.ForeColor = vbRed
Label2.FontName = "黑体"
Label2.FontSize = 16
End Sub
Private Sub Command2_Click()
Label1.Visible = True
Label2.Visible = False
Text1.Visible = True
Command1.Visible = True
Command2.Visible = False
Command3.Visible = False
Text1.Text = ""
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Form_Load()
Label1.Visible = True
Label2.Visible = False
Text1.Visible = True
Command1.Visible = True
End Sub
展开全部
窗体的load事件是在窗体驻入内存的时候产生的,这个时侯窗体还没有显示,所以你的输出当然看不到了。
可以把代码放到按钮事件或Resize事件(Resize事件有可能被多次执行)中。如果非要在load事件中,可以把窗体的AutoRedraw属性设置为true。
可以把代码放到按钮事件或Resize事件(Resize事件有可能被多次执行)中。如果非要在load事件中,可以把窗体的AutoRedraw属性设置为true。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我知道你错误在那里了
你输入的字符在ASC()函数中是分大小写的,例如大写A的ASCII码是65,小写a则是97如过你需要输入的是小写,你应该在INPUT()函数后加上以下代码:
Select
Case
strs1
case
"A"
to
"Z"
strs1
=
asc(strs1
-
32)
case
"a"
to
"z"
strs1
=
strs1
End
Select
如果你要的是大写则加入:
Select
Case
strs1
case
"a"
to
"z"
strs1
=
asc(strs1
-
32)
case
"A"
to
"Z"
strs1
=
strs1
End
Select
应该可以了
你输入的字符在ASC()函数中是分大小写的,例如大写A的ASCII码是65,小写a则是97如过你需要输入的是小写,你应该在INPUT()函数后加上以下代码:
Select
Case
strs1
case
"A"
to
"Z"
strs1
=
asc(strs1
-
32)
case
"a"
to
"z"
strs1
=
strs1
End
Select
如果你要的是大写则加入:
Select
Case
strs1
case
"a"
to
"z"
strs1
=
asc(strs1
-
32)
case
"A"
to
"Z"
strs1
=
strs1
End
Select
应该可以了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
一般标签都是label,你怎么用的是laber
Private Sub Command2_Click()
laber1.cisible = True 应为label1.visible=true
Private Sub Command2_Click()
laber1.cisible = True 应为label1.visible=true
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询