Using the programming assignments from Module Two ie week II
Using the programming assignments from Module Two i.e. week II - convert the Visual Basic projects to Visual C#. All programs should have basic menu options that allow the user to exit the program and perform tasks you deem necessary for the program to function correctly. After creating the program, be sure to debug and test your code. While you are working on the project, maintain a Word-readable document (.docx, .doc, .rtf, or .txt) that lists the tasks you experience problems with. Are there any tasks that cannot translate directly from one language to another? How did you handle those to accomplish the technique in the other language? Write a brief description of the problems you encounter and how you solved those problems. Is there is any problem you cannot solve? Submit your C# project and code, plus the problem listing document. Submit all components of your assignment to your instructor for grading. Submit a screenshot of the executed program and the code of the program.
Solution
Conversion :
public void Exection(string cName, vsCExecption eOption,
ref object varIn, ref object varOut, ref bool handled)
try
{
handled = false;
if (eOption == vsCExecption.vsCommandExecOptionDoDefault)
{
if (commandName == \"CodeConvert\")
{
handled = true;
string url = \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\";
string parameters = String.Empty;
string remark = String.Empty;
string code = Clipboard.GetData(DataFormats.Text).ToString();
if (_applicationObject.ActiveDocument.Name.EndsWith(\"cs\"))
{
remark = \"//C# converted code, conversion by:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\" +
Environment.NewLine;
parameters = \"Code:\" + System.Web.HttpUtility.UrlEncode(code) +
\"&Language=VB&DestinationLanguage=C#\";
}
else if (_applicationObject.ActiveDocument.Name.EndsWith(\"vb\"))
{
remark = \"\'VB.NET converted code, conversion by:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\" +
Environment.NewLine;
parameters = \"Code: \" + System.Web.HttpUtility.UrlEncode(code) +
\"&Language=C#&DestinationLanguage=VB\";
}
if (remark != String.Empty)
{
string result = HttpWebRequestHttpPost(url, parameters);
((TextSelection)_applicationObject.ActiveDocument.Selection)
.Text = remark + result + Environment.NewLine; ;
}
else
{
MessageBox.Show
(\"converted code can used for .vb or .cs files\");
}
return;
}
}
}
catch (Exception ex)
{
MessageBox.Show(\"Error:\" + ex.Message);
return;
}
}

