Jump to content

Recommended Posts

Posted
You know what, going through your code, you seem to be making the txtMain & TabNo arrays one bigger than they need to be, thus leaving a 'Null' object at the end, that might explain your error. Try replacing the 'createTabPage' sub with this code to see if it solves it:

 

    ........

 

Still get the same error when trying to set the BackColor on the go...

Posted
[color=blue][font=Courier New]Sub[/font][/color][font=Courier New] [color=black]Form1_Load[/color]([color=blue]ByVal[/color]  [color=black]sender[/color] [color=blue]As[/color]  Object, [color=blue]ByVal[/color] [color=black]e[/color] [color=blue]As[/color] [color=black]EventArgs[/color]) _[/font]
[font=Courier New]  [color=blue]Handles[/color] [color=blue]MyBase[/color].[color=black]Load[/color][/font]
[b][font=Courier New]  [color=blue]Dim[/color] [color=black]control[/color]  [color=blue]As[/color] [color=black]Control[/color][/font][/b]
[b][font=Courier New]  [color=blue]For[/color] [color=blue]Each[/color] [color=black]control[/color] [color=blue]In[/color]  [color=blue]Me[/color].[color=black]Controls[/color][/font][/b]
    If control="TextBox" Then
[b][font=Courier New]    [color=black]MessageBox[/color].[color=black]Show[/color]([color=black]control[/color].[color=black]Name[/color])[/font][/b]
   End If
[b][font=Courier New]  [color=blue]Next[/color][/font][/b]
[color=blue][font=Courier New]End[/font][/color][font=Courier New] [color=blue]Sub[/color][/font]

 

Tried message boxing each control names. I only get three:

 

1) statusStrip

2) mainMenuStrip1

3) <>

 

:confused:

Posted

Sometimes as well, like in this example:

 

       Dim control As TabPage
       For Each control In TabNo
           MessageBox.Show(control.Name)
       Next

 

It will show a message box for each tab page but then after the last one it crashes saying Object reference not.....

Posted

unfortunatley i am still quite a noob at .net and mostly pick up what i can from forums and coding websites.

 

but i will keep my eyes peeled for anything that matches your problem :)

Posted
You know what, going through your code, you seem to be making the txtMain & TabNo arrays one bigger than they need to be

 

Ah man, you were right. But instead of changing all the iNumTabs - 1 to iNumTabs, I had to change all the ReDims of the arrays from iNumTabs to iNumTabs - 1.

 

Problem solved. Thanks for all your help guys.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...