A known VB.Net bug? Cast is not valid

  • Thread starter Thread starter T. J. Fan
  • Start date Start date
T

T. J. Fan

I've posted the following problem in this group but got no
answers. It seems to me that no one knows (or cares) why
this is happening. Is this a known VB.Net bug? Help please.

I was trying to call from a web page a routine defined in
another page (to reload that page). More specifically, I
need to be able to reload the first page after user did
something on the second page. Both pages are in frames so
both are visible. I followed the VS samples (Web forms,
pass information between pages) but got an
InvalidCastException. Here is a snapshot of my code:

First Page:
menu.aspx:
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="menu.aspx.vb"
Inherits="MyProgram.MyProgram.vb.menu.menu"%>

menu.aspx.vb:
.....
Public Class menu
.....
Public Sub Reload()
'Reload the page here, e.g., reset the menu
....
End Sub
.....
End Class

Second Page:
login.aspx:
<%@ Page ... %>
<%@ Reference Page="menu.aspx" %>

login.aspx.vb:
.....
Public fp as menu.menu
.....
Private Sub Page_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
fp = CType(context.Handler, menu.menu)
End If
End Sub

The exception occurs on the fp = ... statement.

Any help is appreciated.

p.s. I don't understand why VS automatically generates
inherits statements like
this "MyProgram.MyProgam.vb.menu.menu" instead of
just "MyProgram.vb.menu".
..
 
T. J.
You may want to post this in microsoft.public.dotnet.framework.aspnet. As it
appears to be more directly related to ASP.NET rather then a general VB.NET
question.

For what little ASP.NET I do, your inherits line looks totally wrong, I
would expect "MyProgram.menu". What does the root namespace in your Project
Properties look like. As I said though, ask in
microsoft.public.dotnet.framework.aspnet for more complete help.

Also with all the problems the msnews.microsoft.com newservers have had
recently someone may very well have responded to your question, however it
'got lost in the chaos'.

Hope this helps
Jay
 
Back
Top