06-11-17, 09:50 PM
اريد كود خاص ProgressBar يعني لما اشغل امر من موجه الاوامر (cmd)
يشتغل ProgressBar تلقائي وعند انتها عمل من موجه الاوامر يصل ProgressBar الى 100
محتاجه الكود بالله عليكم
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.TextBox1.Clear()
Dim bytes As Byte() = New Byte() {100, 200, 220, 230, 240, 250, 110, 11, 15, 200, 220, 230, 10, 200, 220, 210, 230, 110, 111, 112, 113, 114, 13, 15}
Dim Values As Byte() = New Byte(bytes.Length - 1) {}
Dim value As Byte = Nothing
Dim s As String = ""
Dim i As Integer = 0
Me.ProgressBar1.Maximum = bytes.Length
Me.ProgressBar1.Minimum = 1
Me.ProgressBar1.Value = 1
While i < bytes.Length
' Synchronization read data
value = bytes(i)
Values(i) = value
' Synchronization write data
If Values IsNot Nothing Then
s += Values(i).ToString
s += Environment.NewLine
End If
Me.ProgressBar1.PerformStep()
ListBox1.Items.Add(value)
i += 1
End While
End Sub
(11-11-17, 12:05 AM)mohammedvego كتب : [ -> ]يا اخي انا اعمل في برمجة بموجه الاوامر cmd دائما اعتمد عليه
وانا احتاج بروجراس بار لاستخدامه في انتظار عمل cmd
مثلا لدي برنامج ياأخد امر من textbox ويضعها ف cmd
ويبداء الامر يشتغل على cmd مشكلتي لا اعرف امتا ينتهي على حسب الامر الذي عطيته لي cmd
فكرت في Process عندما يتم غلق Process واسمه cmd يخبرني انا تم الانتهاء وهكذا
اذا عندك الكود انا بدي ياه
Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
writeIni(File, Section, Author, HexTextBox1.Text)
writeIni(File, Section, org, HexTextBox2.Text)
Threading.
Tasks.
Task.
Factory.
StartNew(
Sub()
'--------------------------------'
Button1.Invoke(Sub() Button1.Enabled = False)
ProgressBar1.Invoke(Sub()
ProgressBar1.Value = 0
ProgressBar1.Style = ProgressBarStyle.Marquee
End Sub)
Dim fn As String = "Pc_Tl.exe"
Dim proc As New Process() With {.StartInfo = New ProcessStartInfo() With {.FileName = fn}}
'proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden'
proc.Start()
proc.WaitForExit()
ProgressBar1.Invoke(Sub()
ProgressBar1.Value = 100
ProgressBar1.Style = ProgressBarStyle.Continuous
End Sub)
Button1.Invoke(Sub() Button1.Enabled = True)
MsgBox("تم فك تشفير", MsgBoxStyle.Information, "Completed")
'--------------------------------'
End Sub)
End Sub