Get Tag from TabControl.TabPages VB 2008

Posted on 2009-04-23
Last Modified: 2012-05-06
In code I have set the tag of a tabpage using the following code.
 ft.TabRacing.TabPages(c).Tag = view.Item("SessionTypeID")
This would be similar to form.TabControl.TabPages(Index).Tag = 2

Now I am trying to retrieve this value from the tab and keep getting Object reference not set...
Dim s As String = Me.TabRacing.TabPages(t).Tag.ToString

WHY is this not working??????

Question by:Sheritlw
    LVL 1

    Expert Comment

    can you post your code?

    Author Comment

    The code is included in my question

    ft.TabRacing.TabPages(c).Tag = view.Item("SessionTypeID")
    This would be similar to form.TabControl.TabPages(Index).Tag = 2

    Trying to get tag
    Dim s As String = Me.TabRacing.TabPages(t).Tag.ToString

    Accepted Solution

    Found the solution

    For Each ctrl As TabPage In TabControl1.TabPages
                If ctrl.Text.Length > 0 And ctrl.Text <> "Results" Then
                    fpGrdResults.ActiveSheet.AddRows(c, 1)
                    fpGrdResults.ActiveSheet.SetText(c, 3, ctrl.Text)
                    fpGrdResults.ActiveSheet.SetTag(c, 3, CType(ctrl.Tag, Integer))
                    c = c + 1
                End If

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now