Click here to Skip to main content
15,907,395 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I convert this VB code to C# code?

VB.NET
abc = wb.Document;
abc.forms(0).all("login").value = "prtk@yahoo.com"
Posted
Updated 23-Dec-09 9:05am
v2

:laugh: :laugh: ... This is already a C# code. VB dont need semicolon for each line end.

But I think there is error in this C# code as well, It should be :

abc = wb.Document;
abc.forms[0].all("login").value= "prtk@yahoo.com";

In case of C# indexer should be placed inside square braces.


If you need VB equivalent to this ... it will be :
abc = wb.Document
abc.forms(0).all("login").value= "prtk@yahoo.com"



Thats it..
 
Share this answer
 
v2
... This is already a C# code. VB dont need semicolon for each line end.

But I think there is error in this C# code as well, It should be :


abc = wb.Document;abc.forms[0].all("login").value= "prtk@yahoo.com";
In case of C# indexer should be placed inside square braces.


If you need VB equivalent to this ... it will be :

abc = wb.Documentabc.forms(0).all("login").value= "prtk@yahoo.com"






sir thanks for the reply but its not working..actually what i want to do is that i am making the project as coding in c# and designing in silverlight3..I am making web application...As everyone has his username and password in lot of website..

I wants that when a user enter his username and password of any of his website in my project then his home page should be open directly,means I wants to give user a facility to directly login from my project..how can it possible please tell me..


I am doing with this code

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using SHDocVw;
using mshtml;






public partial class Default3 : System.Web.UI.Page
{


protected void Page_Load(object sender, EventArgs e)
{



}
protected void Button1_Click(object sender, EventArgs e)
{
// mshtml.HTMLDocument abc;
//htmldocument abc;

HTMLDocument myDoc = new HTMLDocumentClass();
myDoc.getElementsByName("form");

myDoc.getElementsByName("login");
myDoc.getElementsByName("passwd");
SHDocVw.InternetExplorer ie = new SHDocVw.InternetExplorerClass();
IWebBrowserApp wb = (IWebBrowserApp)ie;
wb.Visible = true;
object o = null;
wb.Navigate("yahoomail.com", ref o, ref o, ref o, ref o);
myDoc = wb.Document;
myDoc.forms[0].all("login").value = "prtk@yahoo.com";


}
}




but its not working..give me some code idea

thanks sir
 
Share this answer
 
v2
I think you may want to take a look at this: http://www.elegancetech.com/CSVB/CSVB.aspx[^]

the trial version will convert 1000 lines of code.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900