Gå til innhold

Web browser program - feilmelding "Statement is not valid in a namespace"


Anbefalte innlegg

Hei! Jeg er en gutt på snart 14 år, som er relativt ny med programmering. Jeg har visual basic 2010 proffesional, og har laget en ganske avansert browser, med flere tabs ++. Men problemet er at jeg en gang skulle fixe litt på kodinga, og prøve og adde bookmarks. Men nå har jeg fått en error. " 'Class statement must end with a matching "end class" " og når jeg fikser det, så forsvinner den erroren, men det kommer 14 nye som sier : "Statement is not valid in a namespace" Håper noen som er litt mer "pro" enn meg kan hjelpe meg med dette.

 

-Martin

 

Slenger også med en nedlastning til browseren :) så dere får se, hva dere synes.

Frogzter.rar

Lenke til kommentar
Videoannonse
Annonse

Public Class Form1

 

 

Dim i As Integer = 1

 

Denne er det feil med. Jeg skal ha end class, men når jeg tar det får jeg flere errorer

 

________________________________________

 

 

Private Sub Loading(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs)

ProgressBar1.Maximum = e.MaximumProgress

If Not e.CurrentProgress = -1 And Not e.CurrentProgress > e.MaximumProgress Then

ProgressBar1.Value = e.CurrentProgress

End If

Label1.Visible = True

End Sub

 

Private Sub Done(ByVal sender As Object, ByVal e As Windows.Forms.WebBrowserDocumentCompletedEventArgs)

TabControl1.SelectedTab.Text = CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).DocumentTitle

ToolStripTextBox1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).Url.ToString

Me.Text = CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).DocumentTitle & "" 'put whatever you want in the parentheses

End Sub

 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim Browser As New Windows.Forms.WebBrowser

TabControl1.TabPages.Add("New Tab")

Browser.Name = "Febzter"

Browser.Dock = DockStyle.Fill

TabControl1.SelectedTab.Controls.Add(Browser)

AddHandler Browser.ProgressChanged, AddressOf Loading

AddHandler Browser.DocumentCompleted, AddressOf Done

CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).GoHome()

CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).ScriptErrorsSuppressed = True

End Sub

 

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

Label1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).StatusText

End Sub

 

Private Sub AddTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddTabToolStripMenuItem.Click

Dim Browser As New Windows.Forms.WebBrowser

TabControl1.TabPages.Add("New Tab")

TabControl1.SelectTab(i)

Browser.Name = "Febzter"

Browser.Dock = DockStyle.Fill

TabControl1.SelectedTab.Controls.Add(Browser)

AddHandler Browser.ProgressChanged, AddressOf Loading

AddHandler Browser.DocumentCompleted, AddressOf Done

i = i + 1

CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).GoHome()

CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).ScriptErrorsSuppressed = True

End Sub

 

 

Private Sub RemoveTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RemoveTabToolStripMenuItem.Click

If Not TabControl1.TabPages.Count = 1 Then

TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex)

TabControl1.SelectTab(TabControl1.TabPages.Count - 1)

i = i - 1

End If

End Sub

 

Private Sub PrintToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintToolStripMenuItem.Click

CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).ShowPrintDialog()

End Sub

 

Private Sub PrintPreviewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintPreviewToolStripMenuItem.Click

CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).ShowPrintPreviewDialog()

End Sub

 

Private Sub PageSetupToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PageSetupToolStripMenuItem.Click

CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).ShowPageSetupDialog()

End Sub

 

Private Sub PropertiesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PropertiesToolStripMenuItem.Click

CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).ShowPropertiesDialog()

End Sub

 

Private Sub CloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseToolStripMenuItem.Click

End

End Sub

 

Private Sub HideToolbarsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HideToolbarsToolStripMenuItem.Click

If MenuStrip1.Visible = True And ToolStrip1.Visible = True Then

MenuStrip1.Visible = False

ToolStrip1.Visible = False

Else

MenuStrip1.Visible = True

ToolStrip1.Visible = True

End If

End Sub

 

Private Sub TabControl1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabControl1.Click

'This keeps it so that when you click on a different tab, the TextBox displays the URL of that tab.

ToolStripTextBox1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).Url.ToString

Me.Text = CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).DocumentTitle

End Sub

 

Private Sub ToolStripButton5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton5.Click

CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).Navigate(ToolStripTextBox1.Text)

End Sub

 

Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click

CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).GoBack()

End Sub

 

Private Sub ToolStripButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton4.Click

CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).GoForward()

End Sub

 

Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton3.Click

CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).Stop()

End Sub

 

Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click

CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).Refresh()

End Sub

 

Private Sub ToolStripButton6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton6.Click

CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).Navigate("http://www.google.com/search?hl=en&q=" & ToolStripTextBox2.Text & "&btnG=Google+Search")

End Sub

 

Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs)

Process.Start("http://gamer-news.pcriot.com/")

End Sub

 

Private Sub ToolStripButton7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton7.Click

CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).Navigate("www.gamer-news.pcriot.com")

End Sub

 

 

 

 

her er koden

Lenke til kommentar

Feilmeldingen er at det står noe annet enn Class, Struct, Enum, Interface ller Namespace innenfor en namespace blokk, så jeg vet ikke helt om du har tatt med all koden.

Husk end class på slutten av koden.

 

Jeg kan tenke meg at du har skrevet en class et eller annet sted som gjør at en funksjon ligger utenfor klassen, men jeg kan ikke se det.

Lenke til kommentar

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
  • Hvem er aktive   0 medlemmer

    • Ingen innloggede medlemmer aktive
×
×
  • Opprett ny...