Wrox Programmer Forums
|
BOOK: Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages ISBN: 978-0-470-12448-2
This is the forum to discuss the Wrox book Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages by Jacob J. Sanford; ISBN: 9780470124482
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages ISBN: 978-0-470-12448-2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 23rd, 2007, 12:26 AM
Authorized User
 
Join Date: Dec 2007
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Antilles128 Send a message via Yahoo to Antilles128
Default Help with Partial classes: C# -> VB.NET

Howdy folks,

I've been going through the book and following the examples, doing my best to convert the C# code in the VB that I'm familiar with. (I'm also working in the Wrox Beginner's ASP.NET 2.0 book.)

At any rate, I'm getting a little stuck on the section where we pass values from the Master Page to the the Child page. This is the code I have in the code file for the Master Page (using VWD Express 2008):
----------------------------------------------------------------------
Partial Class MasterPage
    Inherits System.Web.UI.MasterPage
    Public Class myValue
        Dim myValue("My Master Page String Value") As String
    End Class
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Label1.Text = TextBox1.Text
        TextBox1.Text = ""
    End Sub
End Class
----------------------------------------------------------------------
I think that turns out okay, but I can't seem to figure out how to convert the C# code from page 239 into VB, specifically the method:

----------------------------------------------------------------------
protected void Page_Load(object sender, EventArgs e)
{
     MasterPage mp = (MasterPage)Page.Master
     mpLabel.Text = mp.myValue
}
----------------------------------------------------------------------

I can figure out that we're supposed to create a new instance of our Master Page as the object "mp", but honestly, I'm not sure how to do that in VB.

Any help that can be given would be great, even pointing me towards a reference that could explain it a little better.

Thanks in advance!

-Jordan Burke
 
Old December 23rd, 2007, 12:52 AM
Authorized User
 
Join Date: Dec 2007
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Antilles128 Send a message via Yahoo to Antilles128
Default

Okay, I know it's bad form to reply to my own topic, but I figured out this issue.

Instead of a class, myValue is a property of the class MasterPage (which I should have realized), and chapter 9 of Beginning ASP.NET 2.0 deals with shared methods and properties.

From there, it was just a matter of using the text as a guide.

I apologize if anyone's used any time trying to figure out what I've done wrong!

Thanks again,

Jordan Burke





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Classes in VB.net pwalkins ASP.NET 2.0 Basics 1 October 6th, 2008 01:59 PM
classes for retriving MAC address in VB .NET mistrypremal Pro VB.NET 2002/2003 9 August 10th, 2007 12:12 PM
Converting VB6 classes to VB.NET (2003) jorgefejr VB How-To 2 August 25th, 2006 05:09 PM
VB.Net -> Filename -> DTS Package -> tempdB daniel Pro VB.NET 2002/2003 1 October 7th, 2004 01:46 PM
a problem in book<<beginning asp.net using vb>> luoware ASP.NET 1.0 and 1.1 Basics 3 December 8th, 2003 09:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.