Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
4.20/5 (2 votes)
See more:
Hi All,

Can anyone convert the bwloe code into C#.
VB
Function getgmail()
    Dim count
    Dim ie
    Set ie = CreateObject("InternetExplorer.Application")
    ie.Navigate "http://www.gmail.com"
    Do While ie.Busy Or (ie.READYSTATE <> 4)
        count = count+1
    Loop
    ie.Visible=True
    ie.document.all.username.value = "youruserID"
    ie.document.all.pwd.value = "yourpassword"
    ie.document.all.signIn.click
END Function

Thanks
Posted
Updated 5-May-14 22:02pm
v2
Comments
Tanuj Rastogi 6-May-14 3:59am    
Why don't you try yourself and then let us know if you get any errors or stuck anywhere.
Don't expect others to write code for you.
er.munishyadav 6-May-14 4:20am    
Hi Tanuj ,

I have tried to convert the file in c# , but facing issue while converting CreateOject() to C#.can you please tell me how i convert this.
lukeer 6-May-14 4:04am    
Enclose code in tags like these:<pre lang="vb">YourCodeHere</pre>
(FTFY)
José Amílcar Casimiro 6-May-14 4:28am    
In C# the project requires a reference to the Microsoft Internet Controls (SHDocVw) type library.

1 solution

You can use the WebBrowser control and have it navigate to link a link with _blank target frame. This will open a new browser window.

Like this for example;
C#
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication4 {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }

        private void linkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
            var browser = new WebBrowser();
            browser.Navigate("http://www.google.com/", "_blank", Encoding.Default.GetBytes(""), "");
        }
    }
}

In this case when the link on the Form is clicked a new WebBrowser control is created, but it's never displayed. Instead it's used only for the Navigate method that will, in conjunction with the target frame _blank, to open the default browser to the specified URL.

Hope this helps,
Fredrik Bornander
 
Share this answer
 

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