We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Loading URL when WinForm Renders...

Thread ID:

Created:

Updated:

Platform:

Replies:

27514 Apr 13,2005 05:57 PM UTC Apr 14,2005 07:05 PM UTC WinForms 2
loading
Tags: HTMLUIControl
Anne Thorne
Asked On April 13, 2005 05:57 PM UTC

Hi, I am using Syncfusion.Windows.Forms.HTMLUI.HTMLUIControl() to open a specific url in an html browser. The documentation gives me an example that does work; however, I want to modify it so that the url is automatically displayed when the winform is rendered. Here is what works (NOTE: The ... indicates code that I have not shown here, for brevity''s sake): ... #region Windows Form Designer generated code ... private void InitializeComponent() { ... this.textBox1.Text = "http://www.google.com"; ... } ... [STAThread] static void Main() { Application.Run(new Form1()); } private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if( ( ( int )e.KeyChar ) == 13 ) { LoadDocument( textBox1.Text ); } } private void LoadDocument( string path ) { if( path == null ) throw new ArgumentNullException( "path" ); if( path.Length == 0 ) throw new ArgumentException( "path - string can not be empty" ); try { Uri uri = new Uri( path ); htmluiControl1.LoadHTML( uri ); } catch( Exception ) { ShowError(); } } ... Again, what I want, is to have the url automatically loaded when the winform is rendered and eliminate the textbox and the need for the user to press the enter key. Thank you in advance for any help you can give me. Anne

Davis Jebaraj [Syncfusion]
Replied On April 13, 2005 07:22 PM UTC

Hi Anne, You can handle the Load event of the Form and load the URL. This is how it would look for the sample after adding a handler for the Load event: private void Form1_Load(object sender, System.EventArgs e) { LoadDocument("http://www.google.com"); } Please let us know if you have any further questions. Thanks, Davis

Anne Thorne
Replied On April 14, 2005 07:05 PM UTC

Thanks! >Hi Anne, > >You can handle the Load event of the Form and load the URL. This is how it would look for the sample after adding a handler for the Load event: > >private void Form1_Load(object sender, System.EventArgs e) > { > LoadDocument("http://www.google.com"); > } > >Please let us know if you have any further questions. > >Thanks, > >Davis

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;