Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 29th, 2013, 05:49 PM
Authorized User
Points: 91, Level: 1
Points: 91, Level: 1 Points: 91, Level: 1 Points: 91, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2011
Location: Timperley Cheshire england
Posts: 19
Thanks: 11
Thanked 0 Times in 0 Posts
Question Where am I going wrong

Hi I have just restarted practising vb express 13 after a long illness all seemed to be working until I started the containers exercise agail all seemed to be going well until I did the wizard about you
favourite Language and result. the code : Result.Text &= "<br />Your favourite Language is " & Favoritelanguage.selectedValue does not work and I get an error notice that it is not part of the wizzard steps ?
Reply With Quote
  #2 (permalink)  
Old November 29th, 2013, 06:06 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Hope you're feeling better!

Can you post the code of the ASPX file and its code behind?

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old November 29th, 2013, 06:38 PM
Authorized User
Points: 91, Level: 1
Points: 91, Level: 1 Points: 91, Level: 1 Points: 91, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2011
Location: Timperley Cheshire england
Posts: 19
Thanks: 11
Thanked 0 Times in 0 Posts
Default

Protected Sub Wizard1_FinishButtonClick(sender As Object, e As WizardNavigationEventArgs) Handles FavoriteLanguage.FinishButtonClick
Result.Text = "Your name is " & yourname.Text
Result.Text &= "<br />Your Favorite language is " & FavoriteLanguage.SelectedValue
Protected Sub Wizard1_FinishButtonClick(sender As Object, e As WizardNavigationEventArgs) Handles FavoriteLanguage.FinishButtonClick
Result.Text = "Your name is " & yourname.Text
Result.Text &= "<br />Your Favorite language is " & FavoriteLanguage.SelectedValue
Reply With Quote
  #4 (permalink)  
Old November 29th, 2013, 06:40 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

This is just the code behind and not the markup so there may also be other issue but one thing that stands out is this:

Code:
Result.Text = "Your name is " & yourname.Text
This resets the Text property, effectively overwriting the text from the previous lines of code. The following should fix it:

Code:
Result.Text &= "Your name is " & yourname.Text
Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
tommykehoe (December 1st, 2013)
  #5 (permalink)  
Old December 1st, 2013, 08:27 AM
Authorized User
Points: 91, Level: 1
Points: 91, Level: 1 Points: 91, Level: 1 Points: 91, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2011
Location: Timperley Cheshire england
Posts: 19
Thanks: 11
Thanked 0 Times in 0 Posts
Default where Have I gone wrong

Hi Imar I still have not solved this problem
<form id="form1" runat="server">
<div>

<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" Text="Show Panel" OnCheckedChanged="CheckBox1_CheckedChanged" />
<asp:Panel ID="Panel1" runat="server" Visible="False">
<asp:Wizard ID="FavoriteLanguage" runat="server" ActiveStepIndex="0" Width="500px">
<WizardSteps>
<asp:WizardStep runat="server" title="About you">
<asp:Label ID="Label1" runat="server" Text="Type your name"></asp:Label>
<asp:TextBox ID="yourname" runat="server"></asp:TextBox>
</asp:WizardStep>
<asp:WizardStep runat="server" title="Favorite Language" StepType="Finish">

<asp:DropDownList ID="favouriteLanguage" runat="server">
<asp:ListItem>C#</asp:ListItem>
<asp:ListItem>Visual Basic</asp:ListItem>
<asp:ListItem>Css</asp:ListItem>
</asp:DropDownList>

</asp:WizardStep>
Protected Sub Wizard1_FinishButtonClick(sender As Object, e As WizardNavigationEventArgs) Handles FavoriteLanguage.FinishButtonClick
Result.Text = "Your name is " & yourname.Text
Result.Text &= "<br />Your Favorite language is " & FavoriteLanguage.SelectedValue

End Sub
Sorry for being a nusience But I am determined to do this and will carry on with the rest of the exercises. Thank you
Reply With Quote
  #6 (permalink)  
Old December 1st, 2013, 11:42 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

I think you confused yourself a bit with the control names. You named the wizard FavoriteLanguage and the drop down favouriteLanguage. The ID of the wizard doesn't matter (and isn't used in code), but the drop down's ID is important as you access it in code to get its selected value. However, your code tries to access the wizard instead. SO this:

Code:
Result.Text = "Your name is " & yourname.Text
Result.Text &= "<br />Your Favorite language is " & FavoriteLanguage.SelectedValue
should be this:
Code:
Result.Text = "Your name is " & yourname.Text
Result.Text &= "<br />Your Favorite language is " & favouriteLanguage.SelectedValue
When you post code here, can you paste it in Notepad first to get rid of the color coding and then use the Code button on the toolbar (#) to format your code? That makes it a lot easier to read.

Thanks,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #7 (permalink)  
Old December 1st, 2013, 04:38 PM
Authorized User
Points: 91, Level: 1
Points: 91, Level: 1 Points: 91, Level: 1 Points: 91, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2011
Location: Timperley Cheshire england
Posts: 19
Thanks: 11
Thanked 0 Times in 0 Posts
Default where did I go wrong

Thank you Imar I will retry to do it again
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is this worded wrong or am I reading wrong? notig BOOK: Beginning Visual C# 2010 1 September 25th, 2010 01:51 PM
Am I doing something wrong? devTed BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 2 February 1st, 2009 10:17 AM
what am I doing wrong? dabbler PHP Databases 6 August 13th, 2008 09:27 AM
Where did I go wrong??? ahc2inc VB.NET 2002/2003 Basics 3 September 28th, 2004 08:19 PM



All times are GMT -4. The time now is 08:09 AM.


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