qui l'esempio di pBar. per via della velocità, ora cerco metodi migliori...
fai un progetto e scrivi questo codice:
ora cerco un metodo più veloce per aprire il txt...codice:Public Class Form1 Inherits System.Windows.Forms.Form #Region " Codice generato da Progettazione Windows Form " Public Sub New() MyBase.New() 'Chiamata richiesta da Progettazione Windows Form. InitializeComponent() 'Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent() End Sub 'Form esegue l'override del metodo Dispose per pulire l'elenco dei componenti. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Richiesto da Progettazione Windows Form Private components As System.ComponentModel.IContainer 'NOTA: la procedura che segue è richiesta da Progettazione Windows Form. 'Può essere modificata in Progettazione Windows Form. 'Non modificarla nell'editor del codice. Friend WithEvents NumericUpDown1 As System.Windows.Forms.NumericUpDown Friend WithEvents NumericUpDown2 As System.Windows.Forms.NumericUpDown Friend WithEvents ProgressBar1 As System.Windows.Forms.ProgressBar Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Button1 As System.Windows.Forms.Button <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.NumericUpDown1 = New System.Windows.Forms.NumericUpDown() Me.NumericUpDown2 = New System.Windows.Forms.NumericUpDown() Me.ProgressBar1 = New System.Windows.Forms.ProgressBar() Me.Label1 = New System.Windows.Forms.Label() Me.Label2 = New System.Windows.Forms.Label() Me.Button1 = New System.Windows.Forms.Button() CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.NumericUpDown2, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'NumericUpDown1 ' Me.NumericUpDown1.Name = "NumericUpDown1" Me.NumericUpDown1.TabIndex = 0 ' 'NumericUpDown2 ' Me.NumericUpDown2.Location = New System.Drawing.Point(0, 32) Me.NumericUpDown2.Maximum = New Decimal(New Integer() {1000, 0, 0, 0}) Me.NumericUpDown2.Name = "NumericUpDown2" Me.NumericUpDown2.TabIndex = 1 Me.NumericUpDown2.Value = New Decimal(New Integer() {100, 0, 0, 0}) ' 'ProgressBar1 ' Me.ProgressBar1.Location = New System.Drawing.Point(8, 80) Me.ProgressBar1.Name = "ProgressBar1" Me.ProgressBar1.Size = New System.Drawing.Size(248, 24) Me.ProgressBar1.Step = 1 Me.ProgressBar1.TabIndex = 2 ' 'Label1 ' Me.Label1.Location = New System.Drawing.Point(128, 0) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(96, 16) Me.Label1.TabIndex = 3 Me.Label1.Text = "MIN" ' 'Label2 ' Me.Label2.Location = New System.Drawing.Point(120, 32) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(112, 24) Me.Label2.TabIndex = 4 Me.Label2.Text = "MAX" ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(24, 112) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(72, 32) Me.Button1.TabIndex = 5 Me.Button1.Text = "AVANZA" ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(292, 266) Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1, Me.Label2, Me.Label1, Me.ProgressBar1, Me.NumericUpDown2, Me.NumericUpDown1}) Me.Name = "Form1" Me.Text = "Form1" CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.NumericUpDown2, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub #End Region Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ProgressBar1.Minimum = NumericUpDown1.Value ProgressBar1.Maximum = NumericUpDown2.Value End Sub Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown1.ValueChanged ProgressBar1.Minimum = NumericUpDown1.Value ProgressBar1.Maximum = NumericUpDown2.Value End Sub Private Sub NumericUpDown2_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown2.ValueChanged ProgressBar1.Minimum = NumericUpDown1.Value ProgressBar1.Maximum = NumericUpDown2.Value End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ProgressBar1.PerformStep() End Sub End Class

Rispondi quotando