Results 1 to 12 of 12

Thread: Custom Tab Page Error

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2011
    Posts
    16

    Custom Tab Page Error

    I've written a class for a new TabPage type.
    The only thing I've added is a couple variables which I can assign to the tab page in order for my app to identify which tab page is selected.

    This works fine on my pc, and a few others, but I have one customer who is using my app.
    When they run, and they open a new tab, the
    TABcontrols.tabpages.add(NEWTAB) errors out.

    I'm 100% sure that this is because it doesn't like the fact that newTAB is my custom TAB class.
    When I did some debugging, his pc moved past the error when I just added a default tabpage type.

    When I'm dealing with custom tab pages, is there anything needed to be coded on the tabcontrol to accept custom tabpages ?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Custom Tab Page Error

    TabPages.Add accepts a TabPage as an argument. If you class inherits TabPage then your object is a TabPage, so it should work fine. When something "errors out" it is actually throwing an exception. Exceptions contain lots of information to help you diagnose the issue, including their type, an error message and a call stack.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2011
    Posts
    16

    Re: Custom Tab Page Error

    Ok.
    I've added exception handling, and other checks as well.

    Everything up to the point of the .add command checks that everything is in order.

    Here is the code around it.

    Code:
    Try
          If Not IsNothing(newTab) Then
                If TypeOf newTab Is clsCustomTab Then
                       Dim strDet As String = ""
                       strDet += "Text: " & newTab.Text & vbCrLf
                       strDet += "Name: " & newTab.Name & vbCrLf
                       strDet += "IND: " & newTab.intIndex & vbCrLf
                       strDet += "GAM: " & newTab.intGame & vbCrLf
                       strDet += "ACC: " & newTab.strAccount & vbCrLf
    
                       clsSendMail.SendMailMessage("[email protected]", "[email protected]", "", "", "New DETAILS Created", strDet)
                      .TABCONTROL.TabPages.Add(newTab)
                  End If
           End If
    Catch ex As Exception
          Dim vStackTrace As New StackTrace(True)
          Dim strEx As String = "StackTrace: " & vbCrLf & vStackTrace.ToString & vbCrLf & vbCrLf & vbCrLf & "Exception Message: " & ex.Message.ToString
          clsSendMail.SendMailMessage("[email protected]", "[email protected]", "", "", "New Exception Created", strEx)
         Application.Exit()
    End Try

    Here is the code I'm using to create the customTab Page

    Code:
    Public Class clsCustomTab
        Inherits TabPage
    
        Public intGame As Integer
        Public intIndex As Integer
        Public strAccount As String
        Public strGame As String
    
        Public Sub New()
            MyBase.New()
            intGame = 9999
            intIndex = 9999
            strAccount = ""
            strGame = ""
        End Sub
    
    End Class

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Custom Tab Page Error

    But you still haven't told us what the error is... that's the important thing... besides know where it happens, we need to know WHAT is happening. Wouldn't do us much good to tell you to remove the eels from your hovercraft if you're getting a divide by 0 error, now would it?

    So if you can post WHAt the error message is, that would be great. Otherwise all we can suggest is to remove the eels from your hovercraft and re-compile.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jun 2011
    Posts
    16

    Re: Custom Tab Page Error

    Sorry, I thought I had indicated this.
    It says that "Value cannot be null. Parameter name: value "
    My assumption is that it is referring to the Tab Page parameter in the .add command.

  6. #6
    Lively Member
    Join Date
    Aug 2009
    Posts
    112

    Re: Custom Tab Page Error

    it seems that an empty value is being passed on to one of your constructors

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Jun 2011
    Posts
    16

    Re: Custom Tab Page Error

    I'm surprise it would be empty though.
    The only value passed is newTAB and I check it here, everything looks valid.

    Code:
     Dim strDet As String = ""
                       strDet += "Text: " & newTab.Text & vbCrLf
                       strDet += "Name: " & newTab.Name & vbCrLf
                       strDet += "IND: " & newTab.intIndex & vbCrLf
                       strDet += "GAM: " & newTab.intGame & vbCrLf
                       strDet += "ACC: " & newTab.strAccount & vbCrLf
    Does this as well validate that newTAB is ready ?

    Code:
    If Not IsNothing(newTab) Then
    If TypeOf newTab Is clsCustomTab Then

  8. #8
    Lively Member
    Join Date
    Aug 2009
    Posts
    112

    Re: Custom Tab Page Error

    Honestly I'm baffled :\

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Jun 2011
    Posts
    16

    Re: Custom Tab Page Error

    Same here.
    It works on a bunch of pc's already. The guy just installed on another pc and it works fine.
    It works flawlessly for me on my development pc when debugging, and when I install the app.

    This is why I'm pulling my hair out.
    I wouldn't know what else to check for.

  10. #10
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Custom Tab Page Error

    and the error happens on this line, right?
    .TABCONTROL.TabPages.Add(newTab)
    ... so it isn't the constructor of your custom class (or it shouldn't be, since to get to the .Add it would have had to first create the custom tab).

    That;'s kind of an odd error... try making your public field public properties instead. If you're using VS2010, you can jsut simply change it from Public to Public Property with out changing anything else. Otherwise you'll need to go through the whole process of making backing member variables and all that...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  11. #11

    Thread Starter
    Junior Member
    Join Date
    Jun 2011
    Posts
    16

    Re: Custom Tab Page Error

    So I tried it with properties as well. Same result of an exception thrown.

    Its happening on a ASUS netbook with Win Starter 7 on it.
    my wife has almost the identical netbook and the app runs perfectly on it.

    I'm at a loss.
    Basically throwing in the towel on this error as I can't reproduce it locally to really debug it.

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Jun 2011
    Posts
    16

    Re: Custom Tab Page Error

    Thats the line it happens on
    .TABCONTROL.Tabpages.add(newTAB)

    The error that pops up is this :

    Microsoft Visual C++ Runtime Library
    Runtime Error
    This application has requested the Runtime to terminate it in an unusual way.

Tags for this Thread

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