Click here to Skip to main content
15,888,461 members
Home / Discussions / C#
   

C#

 
QuestionHow Can I Add Membership To My Program Pin
istemihan8-Sep-17 11:59
istemihan8-Sep-17 11:59 
AnswerRe: How Can I Add Membership To My Program Pin
Richard MacCutchan8-Sep-17 19:21
mveRichard MacCutchan8-Sep-17 19:21 
Answerjoin and sum in linqu Pin
Member 109061148-Sep-17 5:28
Member 109061148-Sep-17 5:28 
QuestionC# and XAML bindings - Need Help with events and dependent Drop Down Lists Pin
Member 133487177-Sep-17 4:45
Member 133487177-Sep-17 4:45 
AnswerRe: C# and XAML bindings - Need Help with events and dependent Drop Down Lists Pin
Mycroft Holmes7-Sep-17 13:20
professionalMycroft Holmes7-Sep-17 13:20 
Questionget more than one string in the checkedlistbox using an array C # Pin
Member 133640086-Sep-17 6:56
Member 133640086-Sep-17 6:56 
SuggestionRe: pegar mais de uma string no checkedlistbox usando um arrayList C# Pin
Richard Deeming6-Sep-17 7:07
mveRichard Deeming6-Sep-17 7:07 
QuestionError on xml.Response Pin
Bootzilla335-Sep-17 21:10
Bootzilla335-Sep-17 21:10 
I get an 'object reference not set to an instance of an object' error on the ' if (xmlResponse.SelectSingleNode("/Response/Code").InnerText != "")' line. I know that is a vague error and If someone can see what the problem based off the code. I would also like to know where I can go to or how to get a more specific error message if possible. And also I know there is an xmlResolver that can be set to null that can be used but not sure how to use it in this code.

using System;

namespace Shipment_WS_Test_App
{
	
	class Class1
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{
			try
			{
                string flg = string.Empty;
                while (flg != "q")
                {

                    System.Text.StringBuilder request = new System.Text.StringBuilder();
                    saia.shipment.Shipment shipment = new saia.shipment.Shipment();
                    shipment.Timeout = 120000;
                    request.Append("<GetByProNumber>");
                    request.Append("<UserID>userid</UserID>");
                    request.Append("<Password>password</Password>");
                    request.Append("<TestMode>N</TestMode>");
                    request.Append("<ProNumber>983579110</ProNumber>");
                    request.Append("</GetByProNumber>");


                    string xmlreq = "<AmazonTrackingRequest xmlns:xsi=\"www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"AmazonTrackingRequest.xsd\"><Validation><UserID>AMZN</UserID><Password>12345</Password></Validation><APIVersion>4.0</APIVersion><TrackingNumber>123456789</TrackingNumber></AmazonTrackingRequest> ";
                 

                    //string response = shipment.ProcessXML(request.ToString());

                    string response = shipment.ProcessXML(xmlreq);
                    System.Xml.XmlDocument xmlResponse = new System.Xml.XmlDocument();
                    
                    xmlResponse.LoadXml(response);

                    // Note: These examples use SelectSingleNode() which accepts a string 
                    // containing a XPath expression. This is a common way to retrieve a node 
                    // from a small XML Document. 

                    if (xmlResponse.SelectSingleNode("/Response/Code").InnerText != "")
                    {
                        // Add error handling code in case Saia responds 
                        // with an Error Code

                        System.Console.WriteLine(xmlResponse.SelectSingleNode("/Response/Code").InnerText);
                        System.Console.WriteLine(xmlResponse.SelectSingleNode("/Response/Element").InnerText);
                        System.Console.WriteLine(xmlResponse.SelectSingleNode("/Response/Fault").InnerText);
                        System.Console.WriteLine(xmlResponse.SelectSingleNode("/Response/Message").InnerText);
                    }
                    else
                    {
                        
                        System.Console.WriteLine(xmlResponse.SelectSingleNode("/Response/Consignee/AccountNumber").InnerText);
                        System.Console.WriteLine(xmlResponse.SelectSingleNode("/Response/Consignee/Address1").InnerText);
                        System.Console.WriteLine(xmlResponse.SelectSingleNode("/Response/Consignee/Address2").InnerText);
                        System.Console.WriteLine(xmlResponse.SelectSingleNode("/Response/Consignee/City").InnerText);
                        System.Console.WriteLine(xmlResponse.SelectSingleNode("/Response/Consignee/State").InnerText);
                        System.Console.WriteLine(xmlResponse.SelectSingleNode("/Response/Consignee/Zipcode").InnerText);
                        );

                    }
                    shipment.Dispose();
                    request = null;
                }
			}
			catch (System.Exception ex)
			{
                Console.WriteLine(ex.ToString());
                Console.ReadLine();
			}
		}
	}
}

AnswerRe: Error on xml.Response Pin
OriginalGriff5-Sep-17 21:19
mveOriginalGriff5-Sep-17 21:19 
AnswerRe: Error on xml.Response Pin
Pete O'Hanlon6-Sep-17 0:30
mvePete O'Hanlon6-Sep-17 0:30 
SuggestionRe: Error on xml.Response Pin
Richard Deeming6-Sep-17 6:00
mveRichard Deeming6-Sep-17 6:00 
Questionhow to enable the USB COM Port..? Pin
Member 133808373-Sep-17 21:35
Member 133808373-Sep-17 21:35 
QuestionRe: how to enable the USB COM Port..? Pin
Jochen Arndt3-Sep-17 21:44
professionalJochen Arndt3-Sep-17 21:44 
AnswerRe: how to enable the USB COM Port..? Pin
OriginalGriff3-Sep-17 23:18
mveOriginalGriff3-Sep-17 23:18 
GeneralRe: how to enable the USB COM Port..? Pin
Jochen Arndt3-Sep-17 23:39
professionalJochen Arndt3-Sep-17 23:39 
AnswerRe: how to enable the USB COM Port..? Pin
Jochen Arndt3-Sep-17 23:49
professionalJochen Arndt3-Sep-17 23:49 
Questionbinding datagridview with entity framework Pin
Member 132649363-Sep-17 7:17
Member 132649363-Sep-17 7:17 
AnswerRe: binding datagridview with entity framework Pin
Mycroft Holmes3-Sep-17 22:49
professionalMycroft Holmes3-Sep-17 22:49 
QuestionUpdate listbox items when button is clicked Pin
Mario Lukačić3-Sep-17 2:19
Mario Lukačić3-Sep-17 2:19 
AnswerRe: Update listbox items when button is clicked Pin
Richard MacCutchan3-Sep-17 21:14
mveRichard MacCutchan3-Sep-17 21:14 
GeneralRe: Update listbox items when button is clicked Pin
Mario Lukačić4-Sep-17 2:31
Mario Lukačić4-Sep-17 2:31 
GeneralRe: Update listbox items when button is clicked Pin
Jochen Arndt4-Sep-17 3:49
professionalJochen Arndt4-Sep-17 3:49 
GeneralRe: Update listbox items when button is clicked Pin
Mario Lukačić4-Sep-17 4:01
Mario Lukačić4-Sep-17 4:01 
GeneralRe: Update listbox items when button is clicked Pin
Jochen Arndt4-Sep-17 4:39
professionalJochen Arndt4-Sep-17 4:39 
GeneralRe: Update listbox items when button is clicked Pin
Mario Lukačić4-Sep-17 5:50
Mario Lukačić4-Sep-17 5:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.