codeproject webServices
-
Hi. I'm new to C# and WS in general and i'm trying to write a simple windows application that get's the latest article briefs from codeproject's webService, but i keep getting an exception. maybe you can help me out here ? com.codeproject.www.LatestBrief ws = new com.codeproject.www.LatestBrief(); int maxNum = ws.GetMaxArticleListLength(); com.codeproject.www.ArticleBrief[] ar = ws.GetLatestArticleBrief(maxNum); foreach (com.codeproject.www.LatestBrief lb in ar ) { articles.Items.Add(lb.ToString()); } Thanks.
-
Hi. I'm new to C# and WS in general and i'm trying to write a simple windows application that get's the latest article briefs from codeproject's webService, but i keep getting an exception. maybe you can help me out here ? com.codeproject.www.LatestBrief ws = new com.codeproject.www.LatestBrief(); int maxNum = ws.GetMaxArticleListLength(); com.codeproject.www.ArticleBrief[] ar = ws.GetLatestArticleBrief(maxNum); foreach (com.codeproject.www.LatestBrief lb in ar ) { articles.Items.Add(lb.ToString()); } Thanks.
Why don't you tell us what the exception is? It's hard to help you with a problem when we don't know what the problem is. Besides,
lb.ToString
(defined byLatestBrief.ToString
) probably won't give you want you want. By default,ToString
returns the type (so "com.codeproject.www.LatestBrief"). You have to output the data yourself, or ifarticles
is anArrayList
or something just addlb
, since you can't reconstitute aLatestBrief
just from the type name.Microsoft MVP, Visual C# My Articles
-
Why don't you tell us what the exception is? It's hard to help you with a problem when we don't know what the problem is. Besides,
lb.ToString
(defined byLatestBrief.ToString
) probably won't give you want you want. By default,ToString
returns the type (so "com.codeproject.www.LatestBrief"). You have to output the data yourself, or ifarticles
is anArrayList
or something just addlb
, since you can't reconstitute aLatestBrief
just from the type name.Microsoft MVP, Visual C# My Articles
Thanks for the reply. The exception information is: An unhandled exception of type 'System.NullReferenceException' occurred in codeProjectWs.exe Additional information: Object reference not set to an instance of an object. When i use the same code to the the messageBoards brief, it works just fine. it seems as if the web service isn't functioning properly. as for the .ToString, i get you. Thanks again.