Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


hide TABS if not specified VB.NET 2003/2010

Posted on 2011-03-11
Medium Priority
Last Modified: 2012-05-11
Hi Experts,
I work from a Winform with TabControl + 10 tabs.

my solution now has random tabs on form_load (thanks to previous solution)

Now i want to only limit/show only 5 of them random TABS at any one time. So randomize 10 tabs but only show 5.

Question by:RobertoFreemano
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 35113417
Try something like:
Public Class Form1

    Private R As New Random
    Private tabs As New ArrayList

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For Each tp As TabPage In TabControl1.TabPages

    End Sub

    Private Sub ShowRandomTabs(ByVal number As Integer)

        Dim temp As New ArrayList
        For Each tp As Object in tabs

        Dim index As Integer
        For i As Integer = 1 to number
            If temp.Count > 0 Then
                index = R.Next(0, temp.Count)
            End If
    End If

End Class

Open in new window


Author Comment

ID: 35114934
Hi Idle_Mind,

I get the following errors:
An unhandled exception of type 'System.NullReferenceException' occurred in mscorlib.dll

Additional information: [Resource lookup failed - infinite recursion detected.  Resource name: Arg_NullReferenceException]

There is no source code available for the current location. > 0000004c  mov         edi,dword ptr [eax+4]

Author Comment

ID: 35114983
Those errors are from 2003, but if I put this code into Visual Basic 2010 Express - it works fine.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 35115019
Hi Idle_Mind,

Do you think I should take a leap of faith in Visual Basic 2010 Express to continue developing in this from now on?
LVL 86

Accepted Solution

Mike Tomlinson earned 440 total points
ID: 35116306
I can make your project target the .Net 2.0 framework which is on most machines.

Not sure what is causing that error in 2003.

Author Closing Comment

ID: 35116355
Thanks Idle_mind ;)

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : All lightning effects with instructions : http://www.mediaf…
Suggested Courses

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question