This documentation is archived and is not being maintained.
Message.FindPartByName Method
.NET Framework 1.1
Searches the MessagePartCollection returned by the Parts property, and returns the named MessagePart.
[Visual Basic] Public Function FindPartByName( _ ByVal partName As String _ ) As MessagePart [C#] public MessagePart FindPartByName( string partName ); [C++] public: MessagePart* FindPartByName( String* partName ); [JScript] public function FindPartByName( partName : String ) : MessagePart;
Parameters
- partName
- A string naming the MessagePart to be returned.
Return Value
A MessagePart.
Exceptions
| Exception Type | Condition |
|---|---|
| ArgumentException | No MessagePart with the specified name exists within the collection. |
Example
[Visual Basic, C#, C++] The following example demonstrates the use of the FindPartByName method.
[Visual Basic] ' Get another message from ServiceDescription. Dim myMessage2 As Message = myServiceDescription.Messages("DivideHttpGetOut") Dim myMessagePart As MessagePart = myMessage2.FindPartByName("Body") Console.WriteLine("Results of FindPartByName operation:") Console.WriteLine("Part Name: " + myMessagePart.Name) Console.WriteLine("Part Element: " + myMessagePart.Element.ToString()) [C#] // Get another message from ServiceDescription. Message myMessage2 = myServiceDescription.Messages["DivideHttpGetOut"]; MessagePart myMessagePart=myMessage2.FindPartByName("Body"); Console.WriteLine("Results of FindPartByName operation:"); Console.WriteLine("Part Name: " +myMessagePart.Name); Console.WriteLine("Part Element: " +myMessagePart.Element); [C++] // Get another message from ServiceDescription. Message* myMessage2 = myServiceDescription->Messages->Item[S"DivideHttpGetOut"]; MessagePart* myMessagePart=myMessage2->FindPartByName(S"Body"); Console::WriteLine(S"Results of FindPartByName operation:"); Console::WriteLine(S"Part Name: {0}", myMessagePart->Name); Console::WriteLine(S"Part Element: {0}", myMessagePart->Element);
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
Message Class | Message Members | System.Web.Services.Description Namespace
Show: