منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : [تم الحل] ارجو ان تترجمو لي هدا الكود إلى vb.net
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
الكود ب 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;
}
}
استخدم هذا الموقع في تحويل الاكواد من والا VB.NET
http://www.developerfusion.com/tools/con...arp-to-vb/
اخى ها هى الكلمه الى معمل عليه **** ؟
™ like VB ™ كتب :اخى ها هى الكلمه الى معمل عليه **** ؟

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