Results 1 to 4 of 4

Thread: Array Problems

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2004
    Posts
    4

    Array Problems

    I have 2 buttons, 1 TabControl.

    1 of the buttons makes a Tab in the TabControl and a webbrowser in the tabpage but when i hit the other button which is to make the Webrowser control goto your ome page it doesn't work.

    Here is my code

    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Dim A As New TabPage
    3.         Dim WB As New AxSHDocVw.AxWebBrowser
    4.         Tabs.TabPages.Add(A)
    5.         A.Controls.Add(WB)
    6.     End Sub
    7.  
    8.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    9.         Dim A As New TabPage
    10.         Dim axwebbrowser1 As AxSHDocVw.AxWebBrowser
    11.         axwebbrowser1.GoHome()
    12.     End Sub

    But it doesn't work.

    I am new to creating the array list like this any suggestions on how to make it better/work is great

    drgnstrmace

  2. #2
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618
    You didn't New it in the second one, so there is no instance. Where is there an Array in this
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2004
    Posts
    4
    Cause in the first Sets of Code when I click the 1st button mutible Times it makes mutible Tabs and WebBrowser Controls but it isn't allowing me to take and set the instance of 1 WebBrowser Control so that it will navigate and the others won't..

  4. #4
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618
    In the first one, you are adding tabpages to the tabpage collection. While similiar, this is different from an array. I don't understand what you want the second one to do? You are creating a Tab Page, but not doing anything with it. And you are creating a reference to a webbrowser, but you are not instantiating it or assigning it to an existing webbrowser. Then you are tryingto make a call from a reference that doesn't point to anything, so I would guess at that point it tosses you an error.
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width