الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مثال على استخدام Command Prompt مع VB 2010

بدأه evry1falls في 15 يناير 2014 · 0 رد · 956 مشاهدة · في Microsoft Visual Basic.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1

هذا الكود يقوم بتنفيذ Command Line من Visual Basic 2010

التصميم

vb+2010+compare+two+windows+applications

 

خصائص :

Form
Name : form1
Caption : Compare two exe files
TextBox
'Contains the command Line FC
Name : TextBox1
MultiLine : True
Text :
@Echo Off
FC C:\comp\CS.exe C:\comp\Cexe.exe /B
TextBox
'Will contain the Comparison result of the two EXE application files.
Name : TextBox2
MultiLine : True
Text :Comparison Result will display here ...
Button
'Executes the Command Line FC in the TextBox1
Name : Button1
Text : Go

 

الكود :

' --------------------------------------- '
' Visual Basic Online Course ------------ '
' By / evry1.net ------------------------ '
' on Jan, 2014 -------------------------- '
' Facebook : fb.com/Visual.Basic.Language '
' --------------------------------------- '
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim cmdInput As String = TextBox1.Text.Trim & "&"
Dim proc As New Process
proc.StartInfo.CreateNoWindow = True
proc.StartInfo.UseShellExecute = False
proc.StartInfo.FileName = "C:\Windows\System32\cmd.exe"
proc.StartInfo.Arguments = cmdInput
proc.StartInfo.RedirectStandardOutput = True
proc.StartInfo.RedirectStandardError = True
proc.StartInfo.RedirectStandardInput = True
proc.Start()
proc.StandardInput.WriteLine(cmdInput)
proc.StandardInput.Close()
Dim line As String = Nothing
Dim lines As Integer = 0
While (proc.StandardOutput.EndOfStream = False)
line = proc.StandardOutput.ReadLine()
TextBox2.AppendText(line & vbNewLine)
lines = lines + 1
End While
proc.Close()
proc.Dispose()
End Sub
End Class

اذا كنت مهتما بالشرح

Visit Me personally
Visit My Facebook VB Page

فى انتظار تعليقاتكم و اسئلتكم على
Evry1falls (Visual Basic) Plus+

 

 

مواضيع مشابهة