将CreateObject转换为C# [英] Convert CreateObject to C#
本文介绍了将CreateObject转换为C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
任何人都可以将bwloe代码转换为C#。
Hi All,
Can anyone convert the bwloe code into C#.
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
推荐答案
您可以使用WebBrowser
控件并导航以链接与 _blank 目标框架的链接。这将打开一个新的浏览器窗口。
就像这样;
You can use theWebBrowser
control and have it navigate to link a link with _blank target frame. This will open a new browser window.
Like this for example;
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(""), "");
}
}
}
在这种情况下,单击表单上的链接时,新的 WebBrowser
创建了控件,但它从未显示过。相反,它仅用于导航
方法,该方法将与目标框架 _blank 一起打开默认浏览器到指定的URL。 br />
希望这会有所帮助,
Fredrik Bornander
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
这篇关于将CreateObject转换为C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文