Definir une url dans axWebBrowser

gfpl Messages postés 172 Date d'inscription samedi 11 août 2012 Statut Membre Dernière intervention 9 avril 2011 - 27 sept. 2005 à 14:56
cs_poppyto Messages postés 540 Date d'inscription dimanche 29 décembre 2002 Statut Modérateur Dernière intervention 13 mai 2011 - 27 sept. 2005 à 21:17
hello



bon voila je sais comment on fait a partir d'une case de selection

mais comment faire pour avoir tjs la meme page que l'utilisateur ne puisse pas tapper



ca serais vachement cool je ny arrive pas des masses :(

j ai essayer pas mal de truc et je sais que c est tout con mais je ne retrouve rien sur le forum



code



using System;

using System.Drawing;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;



namespace Kimo

{

/// <summary>

/// Summary description for Explorer.

/// </summary>

public class Explorer : System.Windows.Forms.Form

{

private System.Windows.Forms.TextBox textBox1;

private System.Windows.Forms.Button button1;

private System.Windows.Forms.GroupBox groupBox1;

private AxSHDocVw.AxWebBrowser axWebBrowser1;

private System.Windows.Forms.Button button2;

private System.Windows.Forms.ToolTip toolTip1;

private System.Drawing.Printing.PrintDocument printDocument1;

private System.Windows.Forms.HelpProvider Kimo;

private System.ComponentModel.IContainer components;



public Explorer()

{

//

// Required for Windows Form Designer support

//

InitializeComponent();



//

// TODO: Add any constructor code after InitializeComponent call

//

}



/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if( disposing )

{

if(components != null)

{

components.Dispose();

}

}

base.Dispose( disposing );

}



#region Windows Form Designer generated code

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

this.components = new System.ComponentModel.Container();


System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(Explorer));


System.Configuration.AppSettingsReader configurationAppSettings = new
System.Configuration.AppSettingsReader();

this.textBox1 = new System.Windows.Forms.TextBox();

this.button1 = new System.Windows.Forms.Button();

this.groupBox1 = new System.Windows.Forms.GroupBox();

this.button2 = new System.Windows.Forms.Button();

this.axWebBrowser1 = new AxSHDocVw.AxWebBrowser();

this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);

this.printDocument1 = new System.Drawing.Printing.PrintDocument();

this.Kimo = new System.Windows.Forms.HelpProvider();

this.groupBox1.SuspendLayout();


((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).BeginInit();

this.SuspendLayout();

//

// textBox1

//


this.textBox1.CharacterCasing =
System.Windows.Forms.CharacterCasing.Upper;

this.Kimo.SetHelpKeyword(this.textBox1, "French");


this.Kimo.SetHelpNavigator(this.textBox1,
System.Windows.Forms.HelpNavigator.TableOfContents);

this.Kimo.SetHelpString(this.textBox1, "");

this.textBox1.Location = new System.Drawing.Point(48, 40);

this.textBox1.MaxLength = 12;

this.textBox1.Name = "textBox1";

this.Kimo.SetShowHelp(this.textBox1, true);

this.textBox1.Size = new System.Drawing.Size(144, 20);

this.textBox1.TabIndex = 0;

this.textBox1.Text = "";


this.toolTip1.SetToolTip(this.textBox1, "Put the IP Adress Of The
serveur Kimo");


this.textBox1.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.textBox1KeyPress);


this.textBox1.TextChanged += new
System.EventHandler(this.textBox1_TextChanged);

//

// button1

//

this.button1.Location = new System.Drawing.Point(200, 32);

this.button1.Name = "button1";

this.button1.Size = new System.Drawing.Size(112, 24);

this.button1.TabIndex = 1;

this.button1.Text = "Connect";

this.toolTip1.SetToolTip(this.button1, "Connect to the serveur");

this.button1.Click += new System.EventHandler(this.button1_Click);

//

// groupBox1

//

this.groupBox1.Controls.Add(this.button2);

this.groupBox1.Controls.Add(this.axWebBrowser1);

this.groupBox1.Controls.Add(this.button1);

this.groupBox1.Location = new System.Drawing.Point(16, 8);

this.groupBox1.Name = "groupBox1";

this.groupBox1.Size = new System.Drawing.Size(816, 456);

this.groupBox1.TabIndex = 2;

this.groupBox1.TabStop = false;

this.groupBox1.Text = "Explorer Kimo";

this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter);

//

// button2

//

this.button2.Location = new System.Drawing.Point(552, 32);

this.button2.Name = "button2";

this.button2.Size = new System.Drawing.Size(112, 24);

this.button2.TabIndex = 1;

this.button2.Text = "Close";

this.toolTip1.SetToolTip(this.button2, "Close The Explorer Kimo");

this.button2.Click += new System.EventHandler(this.button2_Click);

//

// axWebBrowser1

//

this.axWebBrowser1.ContainingControl = this;

this.axWebBrowser1.Enabled = true;

this.axWebBrowser1.Location = new System.Drawing.Point(8, 64);


this.axWebBrowser1.OcxState =
((System.Windows.Forms.AxHost.State)(resources.GetObject("axWebBrowser1.OcxState")));

this.axWebBrowser1.Size = new System.Drawing.Size(800, 384);

this.axWebBrowser1.TabIndex = 0;

this.toolTip1.SetToolTip(this.axWebBrowser1, "Current Explorer");


this.axWebBrowser1.Enter += new
System.EventHandler(this.axWebBrowser1_Enter);

//

// printDocument1

//


this.printDocument1.PrintPage += new
System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);

//

// Kimo

//


this.Kimo.HelpNamespace =
((string)(configurationAppSettings.GetValue("helpProvider1.HelpNamespace",
typeof(string))));

//

// Explorer

//

this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);

this.ClientSize = new System.Drawing.Size(840, 470);

this.Controls.Add(this.textBox1);

this.Controls.Add(this.groupBox1);

this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));

this.MaximizeBox = false;

this.Name = "Explorer";


this.StartPosition =
System.Windows.Forms.FormStartPosition.CenterScreen;

this.Text = "Explorer";

this.TopMost = true;

this.Load += new System.EventHandler(this.Explorer_Load);

this.groupBox1.ResumeLayout(false);


((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).EndInit();

this.ResumeLayout(false);



}

#endregion



private void button1_Click(object sender, System.EventArgs e)

{

object Zero = 0;

object EmptyString = "";

axWebBrowser1.Navigate(textBox1.Text,


ref Zero, ref EmptyString, ref EmptyString, ref
EmptyString);

}//private void Track_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)

//private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)

//{

//
if(char.IsNumber(e.KeyChar) || (int)(byte)e.KeyChar == (int)Keys.Back)

// base.OnKeyPress(e);

// else

// e.Handled = true;

//}



private void axWebBrowser1_Enter(object sender, System.EventArgs e)

{



}



private void button2_Click(object sender, System.EventArgs e)

{

this.Close();

}



private void
printDocument1_PrintPage(object sender,
System.Drawing.Printing.PrintPageEventArgs e)

{



}



void textBox1KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)

{

// on empêche la saisie d'un caractère autre qu'un chiffre

// ou backspace (code ASCII = 8)

if( (
e.KeyChar < 48 || e.KeyChar > 57) && e.KeyChar != 46 )


e.Handled = true;


}



private void textBox1_TextChanged(object sender, System.EventArgs e)

{



}



private void Explorer_Load(object sender, System.EventArgs e)

{



}



private void groupBox1_Enter(object sender, System.EventArgs e)

{



}

}

}

3 réponses

sebmafate Messages postés 4936 Date d'inscription lundi 17 février 2003 Statut Membre Dernière intervention 14 février 2014 37
27 sept. 2005 à 15:12
c'est illisible ton code... en plus je ne comprends pas ce que tu vuex

Sébastien FERRAND
0
gfpl Messages postés 172 Date d'inscription samedi 11 août 2012 Statut Membre Dernière intervention 9 avril 2011
27 sept. 2005 à 20:36
en fait j ai un navigateur au sein de l application

ce que j ai pour le moment c est une textebox et un bouton send

une foi cliquer sur le bouton send je navigue sur une page avec le composant webbrowser



ce que je veut c est que je lors de l ouverture du browser on
arrive directement a une page et donc me passer de la textebox et du
bouton send
0
cs_poppyto Messages postés 540 Date d'inscription dimanche 29 décembre 2002 Statut Modérateur Dernière intervention 13 mai 2011
27 sept. 2005 à 21:17
Dans : public Explorer(), après InitializeComponent();

------------------------------------
object Zero = 0;
axWebBrowser.Navigate("http://www.google.fr",ref Zero,ref Zero);
------------------------------------
Ni plus, Ni moins...
0
Rejoignez-nous