該實例有很多實現(xiàn)方法,下面介紹一種不同的給你:
創(chuàng)新互聯(lián)公司提供高防物理服務(wù)器租用、云服務(wù)器、香港服務(wù)器、四川雅安服務(wù)器托管等
首先要在窗體中載入以下控件:progressbar(進度條),label(用來實時顯示文本提示),兩個timer(分別控制進度條進度的增減),然后用以下代碼就能實現(xiàn):
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
Timer1.Interval = 500
Timer2.Interval = 500
ProgressBar1.Value = 0
ProgressBar1.Maximum = 100
ProgressBar1.Minimum = 0
End Sub
'上述過程是設(shè)置控件的初始值,也可以在屬性面板設(shè)置
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
ProgressBar1.Value += 1
Label1.Text = "當前完成" ProgressBar1.Value "%"
If (ProgressBar1.Value = 100) Then
Timer1.Enabled = False
Timer2.Enabled = True
End If
End Sub
'timer1用來控制進度的增加
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
ProgressBar1.Value -= 1
Label1.Text = "當前完成" ProgressBar1.Value "%"
If (ProgressBar1.Value = 0) Then
Timer1.Enabled = True
Timer2.Enabled = False
End If
End Sub
'time2用來控制進度的減少
End Class
1 生成txt文件。
DimSaveFileDialog1AsNewSaveFileDialog()?'創(chuàng)建一個保存對話框
SaveFileDialog1.Filter?="txt?files?(*.txt)|*.txt"?'設(shè)置擴展名
IfSaveFileDialog1.ShowDialog()?=?System.Windows.Forms.DialogResult.OKThen?'如果確定保存
My.Computer.FileSystem.WriteAllText(SaveFileDialog1.Filename,?Textbox1.Text,False)?'保存文本,False表示不追加文本,直接覆蓋其內(nèi)容
EndIf
原文鏈接:
右上部分的:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim se$, i%, j%
Label1.Text = Space(35) "九九乘法表" vbCrLf
Label1.Text = Space(35) "_________" vbCrLf
For i = 1 To 9
For j = 1 To 9
If j = i Then
se = i "×" j "=" i * j
Label1.Text = se Space(8 - Len(se))
Else
se = ""
Label1.Text = se Space(9 - Len(se))
End If
Next j
Label1.Text = vbCrLf
Next i
End Sub
左下部分的:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim se$, i%, j%
Label1.Text = Space(35) "九九乘法表" vbCrLf
Label1.Text = Space(35) "_________" vbCrLf
For i = 1 To 9
For j = 1 To i
se = i "×" j "=" i * j
Label1.Text = se Space(8 - Len(se))
Next j
Label1.Text = vbCrLf
Next i
End Sub