تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[تم الحل] ارجو ان تترجمو لي هدا الكود إلى vb.net
#1
الكود ب c#
اريد تحوله الي VB.NET

public partial class Form1 : Form
{
bool Success = false;
string IconPath;
string AssembleyOutputPath;
string ******sFormSourceCode;
string ConsoleSourceCode;

public Form1()
{
InitializeComponent();
}

/// <summary>
/// Function To Compile Any Source Code In txt Files
/// </summary>
/// <param name="SourceCode">Source Code Path</param>
/// <param name="IconPath">Icon Path</param>
/// <param name="OutputPath">Generated Executable File Path</param>
/// <param name="IsConsoleApplication">Is Source File Is A Conole Application Source Code Or Not</param>
/// <returns>True Or False</returns>
public bool Compiler(string SourceCode, string IconPath, string OutputPath, bool IsConsoleApplication)
{
try
{
CSharpCodeProvider codeProvider = new CSharpCodeProvider();
CompilerParameters compilerparams = new CompilerParameters();
compilerparams.GenerateExecutable = true;
compilerparams.OutputAssembly = OutputPath;
if (IsConsoleApplication == true)
{
compilerparams.CompilerOptions = string.Format("/win32icon:\"{0}\"", IconPath);
}
else
{
compilerparams.CompilerOptions = string.Format("/target:winexe /win32icon:\"{0}\"", IconPath);
}
compilerparams.ReferencedAssemblies.Add("System.dll");
compilerparams.ReferencedAssemblies.Add("mscorlib.dll");
compilerparams.ReferencedAssemblies.Add("System.Drawing.dll");
compilerparams.ReferencedAssemblies.Add("System.Core.dll");
compilerparams.ReferencedAssemblies.Add("System.Management.dll");
compilerparams.ReferencedAssemblies.Add("System.******s.Forms.dll");
CompilerResults compilerResults = codeProvider.CompileAssemblyFromSource(compilerparams, SourceCode);
if (compilerResults.Errors.HasErrors)
{
Success = false;
}
else
{
Success = true;
}
return Success;
}
catch (Exception X)
{
throw X;
}
}

private void button1_Click(object sender, EventArgs e)
{
// اختار مسار الايقونة التي تريدها للملف التنفيذي الناتج
OpenFileDialog ChooseIcon = new OpenFileDialog();
ChooseIcon.Title = "Please Choose An Icon :";
ChooseIcon.Filter = "Icon Files Only | *.ico";
DialogResult Result = ChooseIcon.ShowDialog();
if (Result == DialogResult.Cancel)
{
return;
}
IconPath = ChooseIcon.FileName;
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
//اخيار مكان حفظ الملف التنفيذي الناتج
SaveFileDialog Output = new SaveFileDialog();
Output.Title = "Save Generated Exe To :";
Output.Filter = "Executable Files | *.exe";
DialogResult Result2 = Output.ShowDialog();
if (Result2 == DialogResult.Cancel)
{
return;
}
AssembleyOutputPath = Output.FileName;
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
try
{
// عمل كومبايل لبرنامج الويندوز فورم ابليكشن
if (Compiler(******sFormSourceCode, IconPath, AssembleyOutputPath, false) == true)
{
MessageBox.Show("******s Form Application Generated Successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("There Is An Eror In Source Code", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
catch (Exception X)
{
MessageBox.Show(X.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

private void button2_Click(object sender, EventArgs e)
{
// اختار مسار الايقونة التي تريدها للملف التنفيذي الناتج
OpenFileDialog ChooseIcon = new OpenFileDialog();
ChooseIcon.Title = "Please Choose Icon :";
ChooseIcon.Filter = "Icon Files Only | *.ico";
DialogResult Result = ChooseIcon.ShowDialog();
if (Result == DialogResult.Cancel)
{
return;
}
IconPath = ChooseIcon.FileName;
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
//اخيار مكان حفظ الملف التنفيذي الناتج
SaveFileDialog Output = new SaveFileDialog();
Output.Title = "Save Generated Exe To :";
Output.Filter = "Executable Files | *.exe";
DialogResult Result2 = Output.ShowDialog();
if (Result2 == DialogResult.Cancel)
{
return;
}
AssembleyOutputPath = Output.FileName;
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
try
{
// عمل كومبايل لبرنامج الكونسول ابليكشن
if (Compiler(ConsoleSourceCode, IconPath, AssembleyOutputPath, true) == true)
{
MessageBox.Show("Console Application Generated Successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("There Is An Eror In Source Code", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
catch (Exception X)
{
MessageBox.Show(X.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

private void Form1_Load(object sender, EventArgs e)
{
******sFormSourceCode = Properties.Resources.******sForm.ToString();
ConsoleSourceCode = Properties.Resources.Console.ToString();
}
}
}





public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
Application.Exit();
}
}

partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
****.Dispose(disposing);
}

#region ******s Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the *******s of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.******s.Forms.Label();
this.label2 = new System.******s.Forms.Label();
this.button1 = new System.******s.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.******** = new System.Drawing.Point(127, 29);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(267, 19);
this.label1.TabIndex = 0;
this.label1.Text = "This Application Generated By :";
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.Transparent;
this.label2.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.ForeColor = System.Drawing.Color.Red;
this.label2.******** = new System.Drawing.Point(199, 63);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(123, 19);
this.label2.TabIndex = 1;
this.label2.Text = "BD2 Codedom";
//
// button1
//
this.button1.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button1.ForeColor = System.Drawing.Color.Black;
this.button1.******** = new System.Drawing.Point(183, 106);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(154, 26);
this.button1.TabIndex = 2;
this.button1.Text = "Exit";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.******s.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(520, 161);
this.Controls.Add(this.button1);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.ForeColor = System.Drawing.Color.White;
this.Name = "Form1";
this.Text = "Testfile";
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.******s.Forms.Label label1;
private System.******s.Forms.Label label2;
private System.******s.Forms.Button button1;
}
}
}}}
تم الشكر بواسطة:
#2
استخدم هذا الموقع في تحويل الاكواد من والا VB.NET
http://www.developerfusion.com/tools/con...arp-to-vb/
}}}
تم الشكر بواسطة:
#3
اخى ها هى الكلمه الى معمل عليه **** ؟
}}}
تم الشكر بواسطة:
#4
™ like VB ™ كتب :اخى ها هى الكلمه الى معمل عليه **** ؟

الكلمات هي: tex t و windo w
}}}
تم الشكر بواسطة:
#5
اعتقد أن كلمة: locatio n أيضا بقائمة الحضر
}}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  ممكن حل المشكلة فى الكود التالي - من مشاركة استاذنا القدير / عبدالله الدوسري new_programer 4 150 02-03-24, 07:36 PM
آخر رد: new_programer
  ماهو حل هذا الخطأ في الكود melad2002 7 240 25-02-24, 12:25 AM
آخر رد: justforit
  كيفية انشاء سكريبت لقاعدة بيانات من خلال الكود heem1986 1 173 20-02-24, 12:00 AM
آخر رد: Kamil
  [VB.NET] أرغب فى استخدام هذا الكود بالتحديد على الإصدار 10 AmeenRashed 3 201 19-01-24, 12:42 PM
آخر رد: Taha Okla
  ارجو الافادة للضرورة mohamed sabry 1 110 13-01-24, 03:37 AM
آخر رد: Taha Okla
  ارجو المساعدة فى شاشة طباعة الباركود new_programer 10 561 09-01-24, 08:41 PM
آخر رد: new_programer
  [VB.NET] ما الخطأ فى هذا الكود - كود البحث المتعدد Ashraf Elafify 7 457 27-12-23, 10:50 PM
آخر رد: Ashraf Elafify
  [VB.NET] اريد تعديل في الكود عند طباعة DGV abu_hisham7 1 420 03-12-23, 02:40 AM
آخر رد: abu_hisham7
  رجاء التعديل على الكود المرفق - كلاس لعرض كود المورد new_programer 4 357 13-10-23, 01:47 AM
آخر رد: new_programer
  كيفية التحكم فى حجم الفورم من خلال الكود Ahmed.vb 4 508 11-10-23, 07:17 PM
آخر رد: bidaya

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


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم