Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 244,306 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 785 people online right now. Registration is fast and FREE... Join Now!




Web Browser Help

 
Reply to this topicStart new topic

Web Browser Help

dimre01
13 Jan, 2009 - 06:27 PM
Post #1

New D.I.C Head
*

Joined: 13 Jan, 2009
Posts: 6



Thanked: 1 times
My Contributions
Hey guys,

Im kinda new here, so go easy on me tongue.gif

anyways, im encountering building errors on my web browser. (Its a tabbed browser btw)

ok, so what im trying to do with the code is display the name of the webpage on the current tab/form title

First part of code:

CODE

   Private Sub WebBrowser1_Navigating(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles WebBrowser1.Navigating
        ButtonX3.Visible = False

        Me.Text = CType(TabCtrlWebWizard.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle & " - WebBrowser's Name"
        TabControl1.SelectedTab.Text = CType(TabControl2.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle
    End Sub


For this one, it's saying that "Name TabCtrlWizard is not declared"



Second bit of code:
CODE

Private Sub WebBrowser1_DocumentCompleted_1(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        cbxurl.Text = e.Url.ToString
        Me.Text = CType(TabControl2.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle & " NetCab"
        TabControl1.SelectedTab.Text = CType(TabControl2.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle

    End Sub



On this bit, VB is complaining that "Name CbxUrl is not declared"

Any fix for this/alternative code?

Thanks

User is offlineProfile CardPM
+Quote Post


Martyr2
RE: Web Browser Help
13 Jan, 2009 - 06:48 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 6,656



Thanked: 613 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
It appears that either you have not created the variables TabCtrlWebWizard or cbxurl or these functions cannot see them. Were these two variables declared and where were they declared? They should be declared in the class level as class instance variables and not declared in another function.

Remember that if you are going to use variables in a function/sub procedure that the variables must be defined in the function/sub (local scope), as part of the overall class (class scope) or in a global scope (which is bad design).

So can you show us where you have defined these two variables? If you don't know what we mean by defined, you have to say to the compiler "hey I want to use a variable of type ______ and here is its name"

Before you can us cbxurl you have to either have added a control called cbxurl on the form or created a variable with either "Dim cbxurl as String" (local scope) or "Private cbxurl as String" (class scope).

If these are controls, are they named exactly the same? And are these controls part of the form where you are trying to declare these functions?

Thanks. smile.gif

This post has been edited by Martyr2: 13 Jan, 2009 - 06:49 PM
User is offlineProfile CardPM
+Quote Post

dimre01
RE: Web Browser Help
13 Jan, 2009 - 07:19 PM
Post #3

New D.I.C Head
*

Joined: 13 Jan, 2009
Posts: 6



Thanked: 1 times
My Contributions
QUOTE(Martyr2 @ 13 Jan, 2009 - 06:48 PM) *

It appears that either you have not created the variables TabCtrlWebWizard or cbxurl or these functions cannot see them. Were these two variables declared and where were they declared? They should be declared in the class level as class instance variables and not declared in another function.

Remember that if you are going to use variables in a function/sub procedure that the variables must be defined in the function/sub (local scope), as part of the overall class (class scope) or in a global scope (which is bad design).

So can you show us where you have defined these two variables? If you don't know what we mean by defined, you have to say to the compiler "hey I want to use a variable of type ______ and here is its name"

Before you can us cbxurl you have to either have added a control called cbxurl on the form or created a variable with either "Dim cbxurl as String" (local scope) or "Private cbxurl as String" (class scope).

If these are controls, are they named exactly the same? And are these controls part of the form where you are trying to declare these functions?

Thanks. smile.gif



hey,

sorry, im an uber noob at VB. i understood some of your post, so i will try to answer you to the best of my ability.

im pretty sure i have not defined those variables, how would i do that?

and i know that they are not controls

sorry if i completely misunderstood your post, as i said before, i am new to VB coding
thanks for taking the time to reply smile.gif


dimre01
User is offlineProfile CardPM
+Quote Post

Martyr2
RE: Web Browser Help
13 Jan, 2009 - 09:07 PM
Post #4

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 6,656



Thanked: 613 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
I guess a better question would be "Is cbxurl a textbox or a button or something on your form? When you set its text, are you expecting it to show something on the form?"


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 06:33PM

Live VB.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month