vb显示代码怎么写

1.VB作保存,显示和分别显示的代码怎么写|'答案e799bee5baa6e78988e69d8331333234333233一
Private Sub Command1_Click()
Dim a As String, b As String
b = Text1.Text + "|" + Text2.Text + "|" + Text3.Text
d = "d:/test.txt"
Open d For Append As #1
Print #1, b
Close #1
End Sub
'答案二
Private Sub Text_Show()
Dim a As String, b As String, c As String
b = "d:/test.txt"
Open b For Input As #1
While Not EOF(1)
Line Input #1, b
List1.AddItem b
Wend
Close #1
End Sub
Private Sub Command2_Click()
Text_Show
End Sub
'答案三
Private Sub List1_Click()
x = InStr(List1.List(List1.ListIndex), "|")
y = InStr(x + 1, List1.List(List1.ListIndex), "|")
Text4 = Left(List1.List(List1.ListIndex), x - 1)
Text5 = Mid(List1.List(List1.ListIndex), x + 1, (y - 1) - (x))
Text6 = Right(List1.List(List1.ListIndex), Len(List1.List(List1.ListIndex)) - y)
End Sub
2.怎么看VB代码、又怎么编写代码要看VB代码,首先得知道这些代码是什么意思,所以要先学习和了解VB函数及使用及操作方法 。
建议先看几本VB编程的书,如:Visual Basic 程序设计 康丽军 吴红萍主编 北京大学出版社 这本书讲的很基础,感觉比较适合初学者 。
学习了基本的函数后,就可以对照书中的实例,编写自己的程序了 。比如,一个简单的例子 。
点击按钮,显示对话框:
1,打开VB,新建程序,然后在窗体中添加一个Command1控件 。
2,点击Command1,添加代码:Msgbox "你好!"
3,点击即可 。
4,代码编写完毕 。
*VB6.0全称为VisualBasic 6.0,是微软公司推出的可视化编程工具之一,是目前世界上使用最广泛的程序开发工具 。
3.VB这些代码怎么写先假定的窗口1名称是form1,窗口2名称是form2 。如果不是自己改之
1:点击一个按钮弹出窗口2(弹出后关闭窗口1)
点击后的代码:
Form2.Show '显示窗口2
Unload Me '关闭窗口1
2:点击一个按键后进度条慢慢的满,同时,标签的内容启动切换(一共分10个内容,周期是1秒) 。当进度条满时,自动跳到窗口3 。
先添加进度条ProgressBar1和定时器Trimer1,标签Label1
代码:
Private Sub Form_Load()
Timer1.Interval = 1000
ProgressBar1.Max = 100
ProgressBar1.Value = http://www.xuexi88.com/zhishi/0
End Sub
Private Sub Timer1_Timer()
If ProgressBar1.Value = http://www.xuexi88.com/zhishi/100 Then
Form3.Show '显示窗口3
Timer1.Enabled = False
Else
ProgressBar1.Value = http://www.xuexi88.com/zhishi/ProgressBar1.Value + 1
Select Case (ProgressBar1.Value Mod 10) '显示不同的标签10种
Case 0
Label1.Caption = "0"
Case 1
Label1.Caption = "1"
Case 2
Label1.Caption = "2"
Case 3
Label1.Caption = "3"
Case 4
Label1.Caption = "4"
Case 5
Label1.Caption = "5"
Case 6
Label1.Caption = "6"
Case 7
Label1.Caption = "7"
Case 8
Label1.Caption = "8"
Case 9
Label1.Caption = "9"
End Select
End If
End Sub
3:窗口4上有一个标签,每2秒更换1个内容,共5个内容,当内容更换完后,自动跳到其他的窗口 。
这些代码怎么写?悬赏80.
先添加定时器Trimer1,标签Label1,窗口变量T
Dim t As Long
Private Sub Form_Load()
t = 0
Timer1.Interval = 1000
Label1.Caption = "0"
End Sub
Private Sub Timer1_Timer()
t = t + 1
Select Case (t Mod 5)
Case 0
Label1.Caption = "0"
Case 1
Label1.Caption = "1"
Case 2
Label1.Caption = "2"
Case 3
Label1.Caption = "3"