p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 23rd, 2007, 12:26 AM
Authorized User
 
Join Date: Dec 2007
Location: Braselton, Georgia, USA.
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old December 23rd, 2007, 12:52 AM
Authorized User
 
Join Date: Dec 2007
Location: Braselton, Georgia, USA.
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Classes in VB.net pwalkins ASP.NET 2.0 Basics 1 October 6th, 2008 02:59 PM
classes for retriving MAC address in VB .NET mistrypremal Pro VB.NET 2002/2003 9 August 10th, 2007 01:12 PM
Converting VB6 classes to VB.NET (2003) jorgefejr VB How-To 2 August 25th, 2006 06:09 PM
VB.Net -> Filename -> DTS Package -> tempdB daniel Pro VB.NET 2002/2003 1 October 7th, 2004 02: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



All times are GMT -4. The time now is 11:10 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc