If you have an existing page that uses code inline and want to associate a code file with it, do the following:
1. Assuming that name of the page is Foo.aspx, create a new code file named Foo.aspx.vb in the same directory.
2. Change page directive to
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Foo.aspx.vb" Inherits="Foo" %>
3. Close and reopen the solution or Web site.
The code file should now correctly show up in the Solution Explorer as a subnode of the page file.