Laden...

Aktualisieren einer Website geht nicht

Erstellt von alexander vor 20 Jahren Letzter Beitrag vor 20 Jahren 3.913 Views
alexander Themenstarter:in
2.217 Beiträge seit 2003
vor 20 Jahren
Aktualisieren einer Website geht nicht

Hi, ich hab den IE eingebunden aber irgendwie klappt das mit dem aktualisieren net, am besten poste ich mal den code.


using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace IT_News_Viewer
{
	/// <summary>
	/// Summary description for WinForm.
	/// </summary>
	public class WinForm : System.Windows.Forms.Form
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
		private System.Windows.Forms.MainMenu mainMenu1;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.MenuItem menuItem2;
		private AxSHDocVw.AxWebBrowser axWebBrowser1;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.Button button3;
		private System.Windows.Forms.Button button4;
		private System.Windows.Forms.Label label1;

		public WinForm()
		{
			//
			// 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()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(WinForm));
			this.mainMenu1 = new System.Windows.Forms.MainMenu();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.menuItem2 = new System.Windows.Forms.MenuItem();
			this.axWebBrowser1 = new AxSHDocVw.AxWebBrowser();
			this.button1 = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.button3 = new System.Windows.Forms.Button();
			this.button4 = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).BeginInit();
			this.SuspendLayout();
			// 
			// mainMenu1
			// 
			this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
						this.menuItem1,
						this.menuItem2});
			// 
			// menuItem1
			// 
			this.menuItem1.Index = 0;
			this.menuItem1.Text = &amp;quot;Datei&amp;quot;;
			// 
			// menuItem2
			// 
			this.menuItem2.Index = 1;
			this.menuItem2.Text = &amp;quot;Hilfe&amp;quot;;
			// 
			// axWebBrowser1
			// 
			this.axWebBrowser1.Enabled = true;
			this.axWebBrowser1.Location = new System.Drawing.Point(8, 32);
			this.axWebBrowser1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject(&amp;quot;axWebBrowser1.OcxState&amp;quot;)));
			this.axWebBrowser1.Size = new System.Drawing.Size(600, 480);
			this.axWebBrowser1.TabIndex = 0;
			this.axWebBrowser1.Enter += new System.EventHandler(this.axWebBrowser1_Enter);
			// 
			// button1
			// 
			this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.button1.Location = new System.Drawing.Point(8, 0);
			this.button1.Name = &amp;quot;button1&amp;quot;;
			this.button1.Size = new System.Drawing.Size(88, 24);
			this.button1.TabIndex = 1;
			this.button1.Text = &amp;quot;aktualisieren&amp;quot;;
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// button2
			// 
			this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.button2.Location = new System.Drawing.Point(120, 0);
			this.button2.Name = &amp;quot;button2&amp;quot;;
			this.button2.TabIndex = 2;
			this.button2.Text = &amp;quot;zurück&amp;quot;;
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// button3
			// 
			this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.button3.Location = new System.Drawing.Point(216, 0);
			this.button3.Name = &amp;quot;button3&amp;quot;;
			this.button3.TabIndex = 3;
			this.button3.Text = &amp;quot;vorwärts&amp;quot;;
			this.button3.Click += new System.EventHandler(this.button3_Click);
			// 
			// button4
			// 
			this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.button4.Location = new System.Drawing.Point(312, 0);
			this.button4.Name = &amp;quot;button4&amp;quot;;
			this.button4.TabIndex = 4;
			this.button4.Text = &amp;quot;abbrechen&amp;quot;;
			this.button4.Click += new System.EventHandler(this.button4_Click);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(472, 0);
			this.label1.Name = &amp;quot;label1&amp;quot;;
			this.label1.Size = new System.Drawing.Size(136, 16);
			this.label1.TabIndex = 5;
			this.label1.Text = &amp;quot;Vorsicht! Beta Version !!!&amp;quot;;
			// 
			// WinForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(616, 514);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.button4);
			this.Controls.Add(this.button3);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.axWebBrowser1);
			this.Menu = this.mainMenu1;
			this.Name = &amp;quot;WinForm&amp;quot;;
			this.Text = &amp;quot;IT News Viewer&amp;quot;;
			((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main()
		{
			Application.Run(new WinForm());
		}
		
		private void axWebBrowser1_Enter(object sender, System.EventArgs e)
		{
			System.Object nullObject = 0;
			string str = &amp;quot;&amp;quot;;
			System.Object nullObjStr = str;
			Cursor.Current = Cursors.WaitCursor;
			axWebBrowser1.Navigate(&amp;quot;[URL]http://192.168.0.1/itnv/&amp;quot[/URL];, ref nullObject, ref nullObjStr, ref nullObjStr, ref nullObjStr); // Index Seite
			Cursor.Current = Cursors.Default;
		}
		
		private void button1_Click(object sender, System.EventArgs e)
		{
				axWebBrowser1.Refresh(); /// Aktuallisieren
		}
		
		private void button2_Click(object sender, System.EventArgs e)
		{
				axWebBrowser1.GoBack(); ///zurück
		}
		
		private void button3_Click(object sender, System.EventArgs e)
		{
			axWebBrowser1.GoForward(); /// vorwärts
		}
		
		private void button4_Click(object sender, System.EventArgs e)
		{
			axWebBrowser1.Stop(); /// abbrechen
		}
	}
}

Viele Grüße
Alexander

V
842 Beiträge seit 2003
vor 20 Jahren

Hi!

Bei mir meckert er wegen dem fett markierten rum:

private [B]AxSHDocVw[/B] .AxWebBrowser axWebBrowser1;

Er kann das nicht finden. Was ist das?

Hier noch ein hinweiß. Hier muss das Semikolon direkt hinter dem 2. >-Zeichen weg, aber das sollte bei dir ja ncht mehr drin sein:

axWebBrowser1.Navigate("http://192.168.0.1/itnv/",
...

Code-Hacker

H
704 Beiträge seit 2003
vor 20 Jahren

axWebBrowser ist eine Komponente , die in der DLL
AxSHDocView.dll definiert ist
bei Vs.net einfach referenzieren

[last.fm](http://www.last.fm/user/hauptmanAlpha/)
V
842 Beiträge seit 2003
vor 20 Jahren

Achso. Ok, danke. Werde ich mir bei Gelegenheit mal angucken.

Code-Hacker

alexander Themenstarter:in
2.217 Beiträge seit 2003
vor 20 Jahren

ist halt zum einbinden des IE nötig.

Viele Grüße
Alexander