تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
تحويل كود C# الى VB.net
#1
Question 
السلام عليكم
لن أطيل عليكم : أريد تحويل هذا الكود


كود :
 var p = new Process
                {
                    StartInfo =
                    {
                        FileName = _scriptEditor,
                        Arguments = String.Format("\"{0}\"", scriptPath)
                    }
                };
 وشكراً
الرد }}}
تم الشكر بواسطة:
#2
كود :
        Dim _scriptEditor As String = ""
        Dim scriptPath As String = ""
        Dim myProcess = New Process()
        myProcess.StartInfo.FileName = _scriptEditor
        myProcess.StartInfo.Arguments = String.Format("""{0}""", scriptPath)

عليك إعطاء قيمة للممتغيران ف بداية الكود من الأفضل أن تستخدم الكود بالشكل التالي لأنه ربما يحدث خطأ ما أثناء التنفيذ

كود :
       Dim _scriptEditor As String = ""
        Dim scriptPath As String = ""
        Dim myProcess = New Process()
        Try
            myProcess.StartInfo.FileName = _scriptEditor
            myProcess.StartInfo.Arguments = String.Format("""{0}""", scriptPath)

        Catch ex As Exception
        Finally
            ' do something
        End Try
الرد }}}
تم الشكر بواسطة:
#3
.....

إذا أردت التحويل كما هو
كود :
Dim p As New Process() With {.StartInfo = New ProcessStartInfo() With {.FileName = _scriptEditor, .Arguments = """" & scriptPath & """"}}
.....
الرد }}}
تم الشكر بواسطة:
#4
جزاكم الله خيراً
الرد }}}
تم الشكر بواسطة:



التنقل السريع :


يقوم بقرائة الموضوع: