|
-
Mar 12th, 2012, 08:48 PM
#1
Thread Starter
Junior Member
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 ?
-
Mar 12th, 2012, 09:30 PM
#2
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.
-
Mar 13th, 2012, 09:21 AM
#3
Thread Starter
Junior Member
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
-
Mar 13th, 2012, 09:30 AM
#4
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
-
Mar 13th, 2012, 09:32 AM
#5
Thread Starter
Junior Member
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.
-
Mar 13th, 2012, 09:38 AM
#6
Lively Member
Re: Custom Tab Page Error
it seems that an empty value is being passed on to one of your constructors
-
Mar 13th, 2012, 09:40 AM
#7
Thread Starter
Junior Member
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
-
Mar 13th, 2012, 09:46 AM
#8
Lively Member
Re: Custom Tab Page Error
-
Mar 13th, 2012, 09:48 AM
#9
Thread Starter
Junior Member
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.
-
Mar 13th, 2012, 10:21 AM
#10
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
-
Mar 13th, 2012, 11:41 AM
#11
Thread Starter
Junior Member
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.
-
Mar 13th, 2012, 12:04 PM
#12
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|