Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 4.0 aka C# 2010 > BOOK: Beginning Visual C# 2010
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Visual C# 2010
This is the forum to discuss the Wrox book Beginning Visual C# 2010 by Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, ; ISBN: 9780470502266
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual C# 2010 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
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 22nd, 2011, 02:45 PM
Registered User
 
Join Date: May 2011
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default ch 19 adding windows Form to

in chapter 19 try out("Creating a Client Windows Application),

I can not add a windows form application to the WebServiceSample

project, because it doesn't show in the adding new item list.

anyone knows why...?
  #2 (permalink)  
Old July 7th, 2011, 05:41 PM
Wrox Author
Points: 1,163, Level: 13
Points: 1,163, Level: 13 Points: 1,163, Level: 13 Points: 1,163, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2010
Location: Austria
Posts: 175
Thanks: 3
Thanked 53 Times in 53 Posts
Default

You need to do a "add new project" while selecting the solution inside the solution explorer instead of "add new item" while selecting the project

Hope this helps.
__________________
Christian
CN innovation
Visit my blog at: csharp.christiannagel.com
Follow me on twitter: @christiannagel
The Following User Says Thank You to ChristianNagel For This Useful Post:
redleopard81 (July 12th, 2011)
  #3 (permalink)  
Old December 8th, 2011, 11:33 AM
Authorized User
Points: 98, Level: 1
Points: 98, Level: 1 Points: 98, Level: 1 Points: 98, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 23
Thanks: 3
Thanked 0 Times in 0 Posts
Default VCE

Quote:
Originally Posted by ChristianNagel View Post
You need to do a "add new project" while selecting the solution inside the solution explorer instead of "add new item" while selecting the project

Hope this helps.
In VCE all I get is "Class" - no option to create a Form. Am I doing this right? Can this be done in VCE?
  #4 (permalink)  
Old December 8th, 2011, 12:03 PM
Authorized User
Points: 98, Level: 1
Points: 98, Level: 1 Points: 98, Level: 1 Points: 98, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 23
Thanks: 3
Thanked 0 Times in 0 Posts
Default

I wound up deploying the webservice on my local drive and referencing the local host address in the webform. In so doing I discovered that on page 66 number 4 it should read

void client_ReverseStringCompleted(object sender, WebServicesSample.ReverseStringCompletedEventArgs e)

The WebServicesSample is missing in the text.
  #5 (permalink)  
Old December 9th, 2011, 11:13 AM
Authorized User
Points: 149, Level: 2
Points: 149, Level: 2 Points: 149, Level: 2 Points: 149, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Location: Belgrade,Serbia
Posts: 34
Thanks: 14
Thanked 0 Times in 0 Posts
Default

I have problem with that try out:

Code compiles, in windows forms,text2.text gives reversed string,as expected,but then throws exception:

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
var client = new ServiceReference1.sampleserviceSoapClient();
textBox2.Text = client.reversestring(textBox1.Text);
client.reversestringCompleted += client_ReverseStringCompleted;
client.reversestringAsync(textBox1.Text);
}
void client_ReverseStringCompleted(object sender, reversestringCompletedEventArgs e)

{
if (e.Error != null)
{
textBox2.Text = e.Result;
}
else
{
MessageBox.Show(e.Error.Message);
}


}
}
}

System.NullReferenceException was unhandled by user code
Message=Object reference not set to an instance of an object.
Source=WindowsFormsApplication1
StackTrace:
at WindowsFormsApplication1.Form1.client_ReverseStrin gCompleted(Object sender, reversestringCompletedEventArgs e) in C:\Users\administrator\AppData\Local\Temporary Projects\WindowsFormsApplication1\Form1.cs:line 36
at WindowsFormsApplication1.ServiceReference1.samples erviceSoapClient.OnreversestringCompleted(Object state) in C:\Users\administrator\AppData\Local\Temporary Projects\WindowsFormsApplication1\Service References\ServiceReference1\Reference.cs:line 201
InnerException:

This only happens when i call Service Asynchronously,try it out on page 651 works fine.


@Frodo,i am using VCE,when you create service,you must launch Microsoft Visual c# Express 2010,create new windows form and add service reference,of course Microsoft Visual Web Developer 2010 Express must remain open.I hope this helps.

Last edited by dampyr; December 9th, 2011 at 11:19 AM.. Reason: adding
  #6 (permalink)  
Old December 13th, 2011, 06:41 PM
Wrox Author
Points: 1,163, Level: 13
Points: 1,163, Level: 13 Points: 1,163, Level: 13 Points: 1,163, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2010
Location: Austria
Posts: 175
Thanks: 3
Thanked 53 Times in 53 Posts
Default

@dampyr,

you need to change the if statement in the event handler. If there's not an error the textBox2.Text result should be filled, otherwise the error message should be shown. In the original case the else part was only accessed when e.Error was null, and of course if there the Message property is accessed a null reference exception is thrown.

Code:
if (e.Error == null)
{
  textBox2.Text = e.Result;
}
else
{
  MessageBox.Show(e.Error.Message);
}
__________________
Christian
CN innovation
Visit my blog at: csharp.christiannagel.com
Follow me on twitter: @christiannagel
The Following User Says Thank You to ChristianNagel For This Useful Post:
dampyr (December 14th, 2011)
 


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
Error ch 19, opening form, adp-file vitmoss2 BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3 0 October 4th, 2008 05:09 AM
Ch.14 Creating Windows Form User Controls problem SAIFI BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 1 September 29th, 2008 05:51 AM
Ch 19 not working either... resolutions BOOK: Beginning JavaServer Pages 6 May 17th, 2007 04:36 AM
Page 975; Ch 19 Nick Y BOOK: Ivor Horton's Beginning Visual C++ 2005 0 July 31st, 2006 12:25 AM
Page 973; Ch 19 Nick Y BOOK: Ivor Horton's Beginning Visual C++ 2005 0 July 31st, 2006 12:17 AM



All times are GMT -4. The time now is 06:04 AM.


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