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.
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
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
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.
Re: Custom Tab Page Error
it seems that an empty value is being passed on to one of your constructors
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
Re: Custom Tab Page Error
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.
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
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.
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.