8 Replies - 633 Views - Last Post: 28 August 2009 - 12:40 PM Rate Topic: -----

#1 nick1200  Icon User is offline

  • Php Coder
  • member icon

Reputation: -18
  • View blog
  • Posts: 922
  • Joined: 21-March 09

web brower Error 1 ')' expected

Post icon  Posted 28 August 2009 - 09:56 AM

there is no vb 2008 on here just vb6 so thought id post in here
i am getting this error

Error 1 ')' expected. I:\Documents and Settings\nick\Local Settings\Application Data\Temporary Projects\web brower\Form1.vb 27 112 web brower


error is on this line

 Private Sub browse_done(ByVal Sender As Object, ByVal e As Windows.Forms.WebBrowserDocumentCompletedEventArgs



i have close it so its like
 Private Sub browse_done(ByVal Sender As Object, ByVal e As Windows.Forms.WebBrowserDocumentCompletedEventArgs)



but then it says the code under it is wrong here it all my code


Public Class Form1
	Dim i As Integer = 0
	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		Dim Browse As New WebBrowser
		Browse.Name = "b1"
		Browse.Dock = DockStyle.Fill
		AddHandler Browse.DocumentCompleted, AddressOf browse_done

		TabControl1.TabPages.Add(i, "page" & i + 1)
		TabControl1.SelectTab(i)
		TabControl1.SelectedTab.Controls.Add(Browse)
		i = 1 + 1
	End Sub

	Private Sub NewTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewTabToolStripMenuItem.Click
		Dim Browse As New WebBrowser
		Browse.Name = "b1"
		Browse.Dock = DockStyle.Fill
		AddHandler Browse.DocumentCompleted, AddressOf browse_done

		TabControl1.TabPages.Add(i, "page" & i + 1)
		TabControl1.SelectTab(i)
		TabControl1.SelectedTab.Controls.Add(Browse)
		i = 1 + 1

	End Sub
	Private Sub browse_done(ByVal Sender As Object, ByVal e As Windows.Forms.WebBrowserDocumentCompletedEventArgs
		TabControl1.SelectedTab.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle

	Private Sub CloseTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseTabToolStripMenuItem.Click
		TabControl1.Tabpages.RemoveAt(TabControl1.selectedIndex)
		i = 1 - 1

	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), WebBrowser).Navigate(ToolStripTextBox2.Text)
	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), WebBrowser).GoBack()
	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), WebBrowser).GoForward()
	End Sub
End Class


This post has been edited by nick1200: 28 August 2009 - 10:32 AM


Is This A Good Question/Topic? 0
  • +

Replies To: web brower Error 1 ')' expected

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1633
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: web brower Error 1 ')' expected

Posted 28 August 2009 - 10:00 AM

VB 2008 is VB.NET. Moved to VB.NET :)
Was This Post Helpful? 0
  • +
  • -

#3 nick1200  Icon User is offline

  • Php Coder
  • member icon

Reputation: -18
  • View blog
  • Posts: 922
  • Joined: 21-March 09

Re: web brower Error 1 ')' expected

Posted 28 August 2009 - 10:01 AM

View PostPsychoCoder, on 28 Aug, 2009 - 09:00 AM, said:

VB 2008 is VB.NET. Moved to VB.NET :)



never new that Thanks :)
Was This Post Helpful? 0
  • +
  • -

#4 piman314  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 32
  • View blog
  • Posts: 169
  • Joined: 07-August 09

Re: web brower Error 1 ')' expected

Posted 28 August 2009 - 11:36 AM

You don't have an End Sub for browse_done.

	Private Sub browse_done(ByVal Sender As Object, ByVal e As Windows.Forms.WebBrowserDocumentCompletedEventArgs
		TabControl1.SelectedTab.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle
	End Sub


Was This Post Helpful? 0
  • +
  • -

#5 sonic907  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 28-August 09

Re: web brower Error 1 ')' expected

Posted 28 August 2009 - 11:43 AM

Public Class Form1
	Dim i As Integer = 0
	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		Dim Browse As New WebBrowser
		Browse.Name = "b1"
		Browse.Dock = DockStyle.Fill
		AddHandler Browse.DocumentCompleted, AddressOf browse_done

		TabControl1.TabPages.Add(i, "page" & i + 1)
		TabControl1.SelectTab(i)
		TabControl1.SelectedTab.Controls.Add(Browse)
		i = 1 + 1
	End Sub

	Private Sub NewTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewTabToolStripMenuItem.Click)
		Dim Browse As New WebBrowser
		Browse.Name = "b1"
		Browse.Dock = DockStyle.Fill
		AddHandler Browse.DocumentCompleted, AddressOf browse_done

		TabControl1.TabPages.Add(i, "page" & i + 1)
		TabControl1.SelectTab(i)
		TabControl1.SelectedTab.Controls.Add(Browse)
		i = 1 + 1

	End Sub
	Private Sub browse_done(ByVal Sender As Object, ByVal e As Windows.Forms.WebBrowserDocumentCompletedEventArgs)
		TabControl1.SelectedTab.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle

	Private Sub CloseTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseTabToolStripMenuItem.Click)
		TabControl1.Tabpages.RemoveAt(TabControl1.selectedIndex)
		i = 1 - 1

	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), WebBrowser).Navigate(ToolStripTextBox2.Text)
	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), WebBrowser).GoBack()
	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), WebBrowser).GoForward()
	End Sub
End Class

U can try it like that ...
Was This Post Helpful? 0
  • +
  • -

#6 nick1200  Icon User is offline

  • Php Coder
  • member icon

Reputation: -18
  • View blog
  • Posts: 922
  • Joined: 21-March 09

Re: web brower Error 1 ')' expected

Posted 28 August 2009 - 11:46 AM

View Postpiman314, on 28 Aug, 2009 - 10:36 AM, said:

You don't have an End Sub for browse_done.

	Private Sub browse_done(ByVal Sender As Object, ByVal e As Windows.Forms.WebBrowserDocumentCompletedEventArgs
		TabControl1.SelectedTab.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle
	End Sub




thats fixed that error now im getting a error with

	   TabControl1.SelectTab(i)



says InvalidArgument=Value of '2' is not valid for 'index'. Parameter name: index


when i open the program and click new tab that comes up


my new code

Public Class Form1
	Dim i As Integer = 0
	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		Dim Browse As New WebBrowser
		Browse.Name = "b1"
		Browse.Dock = DockStyle.Fill
		AddHandler Browse.DocumentCompleted, AddressOf browse_done

		TabControl1.TabPages.Add(i, "page" & i + 1)
		TabControl1.SelectTab(i)
		TabControl1.SelectedTab.Controls.Add(Browse)
		i = 1 + 1
	End Sub

	Private Sub NewTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewTabToolStripMenuItem.Click
		Dim Browse As New WebBrowser
		Browse.Name = "b1"
		Browse.Dock = DockStyle.Fill
		AddHandler Browse.DocumentCompleted, AddressOf browse_done

		TabControl1.TabPages.Add(i, "page" & i + 1)
		TabControl1.SelectTab(i)
		TabControl1.SelectedTab.Controls.Add(Browse)
		i = 1 + 1

	End Sub
	Private Sub browse_done(ByVal Sender As Object, ByVal e As Windows.Forms.WebBrowserDocumentCompletedEventArgs)
		TabControl1.SelectedTab.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle

	End Sub

	Private Sub CloseTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseTabToolStripMenuItem.Click
		TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex)
		i = 1 - 1

	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), WebBrowser).Navigate(ToolStripTextBox2.Text)
	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), WebBrowser).GoBack()
	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), WebBrowser).GoForward()
	End Sub
End Class


This post has been edited by nick1200: 28 August 2009 - 11:48 AM

Was This Post Helpful? 0
  • +
  • -

#7 piman314  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 32
  • View blog
  • Posts: 169
  • Joined: 07-August 09

Re: web brower Error 1 ')' expected

Posted 28 August 2009 - 11:55 AM

instead of
i = i + 1

you have
i = 1 + 1
so i always equals 2
Was This Post Helpful? 0
  • +
  • -

#8 nick1200  Icon User is offline

  • Php Coder
  • member icon

Reputation: -18
  • View blog
  • Posts: 922
  • Joined: 21-March 09

Re: web brower Error 1 ')' expected

Posted 28 August 2009 - 12:03 PM

now i click new tab it makes it but doesn't show it

all my code

Public Class Form1
	Dim i As Integer = 0
	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		Dim Browse As New WebBrowser
		Browse.Name = "b1"
		Browse.Dock = DockStyle.Fill
		AddHandler Browse.DocumentCompleted, AddressOf browse_done

		TabControl1.TabPages.Add(i, "page" & i + 1)
		TabControl1.SelectTab(i)
		TabControl1.SelectedTab.Controls.Add(Browse)
		i = i + 1
	End Sub

	Private Sub NewTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewTabToolStripMenuItem.Click
		Dim Browse As New WebBrowser
		Browse.Name = "b1"
		Browse.Dock = DockStyle.Fill
		AddHandler Browse.DocumentCompleted, AddressOf browse_done

		TabControl1.TabPages.Add(i, "page" & i + 1)
		TabControl1.SelectTab(i)
		TabControl1.SelectedTab.Controls.Add(Browse)
		i = i + 1

	End Sub
	Private Sub browse_done(ByVal Sender As Object, ByVal e As Windows.Forms.WebBrowserDocumentCompletedEventArgs)
		TabControl1.SelectedTab.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle

	End Sub

	Private Sub CloseTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseTabToolStripMenuItem.Click
		TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex)
		i = 1 - 1

	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), WebBrowser).Navigate(ToolStripTextBox2.Text)
	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), WebBrowser).GoBack()
	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), WebBrowser).GoForward()
	End Sub
End Class



Was This Post Helpful? 0
  • +
  • -

#9 piman314  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 32
  • View blog
  • Posts: 169
  • Joined: 07-August 09

Re: web brower Error 1 ')' expected

Posted 28 August 2009 - 12:40 PM

this happens after you close a tab and try to make a new one because in your closetab code you have
i = 1 - 1
so i = 0 after you close a tab.
try using
i = i - 1
instead
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1