Web浏览器C#URL问题 [英] Web Browser C# URL Problem
本文介绍了Web浏览器C#URL问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,我是新来的。
我需要一些帮助,我用c#制作了网页浏览器。我有用于url打字的组合框,我无法解决在组合框中显示网址的问题,这里是代码:
private void comboBox1_SelectedIndexChanged( object sender,EventArgs e)
{
// comboBox1.SelectedItem =((WebBrowser)tabControl1.SelectedTab.Controls [0 ])。Text.ToString();
// comboBox1.Text =((WebBrowser )tabControl1.SelectedTab.Controls [0])。ToString();
}
我试过这个,但它不起作用,ps我知道这是评论// ..
谢谢!
改进问题:
好的,抱歉,但我是新来的..我需要在组合框中显示页面网址,所以,我需要将组合框转换为字符串,我尝试了这些代码并且它不起作用,你知道吗?如何将组合框转换为字符串?
解决方案
我想你想在组合框中显示Web浏览器URI?
如果你需要,那么使用这个
((WebBrowser)tabControl1.SelectedTab.Controls [0])。Url.AbsoluteUri
comboBox1.Text =((WebBrowser)tabControl1.SelectedTab.Controls [tabControl1.SelectedIndex])。Url.AbsoluteUri;
Hi, all, i am new here.
I need some help, i made web browser in c#. I have combobox for url typing,and I can''t solve problem showing url in combobox, here is code:
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
//comboBox1.SelectedItem = ((WebBrowser)tabControl1.SelectedTab.Controls[0]).Text.ToString();
//comboBox1.Text = ((WebBrowser)tabControl1.SelectedTab.Controls[0]).ToString();
}
I tryed this, but it''s not working, p.s. i know this is comment //..
Thanks!
IMPROVE QuESTION:
Okay, sorry, but i am new here..I need to show page url in combobox, so, i need to convert combobox to string, and i tried this codes and it''s not working, do you know how to convert combobox to string?
解决方案
I think you want to show the Webbrowser URI in the combobox?
If this you need then use this
((WebBrowser)tabControl1.SelectedTab.Controls[0]).Url.AbsoluteUri
comboBox1.Text = ((WebBrowser)tabControl1.SelectedTab.Controls[tabControl1.SelectedIndex]).Url.AbsoluteUri;
这篇关于Web浏览器C#URL问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文