Question

This might sound easy for you but I am really struggling with this. I am working on WinForm application with C#(First time). We have a client table in asp.net application. We are pulling data through WCF. I am able to pull data using WCF and place that in object array.

WCF is passing the data in XML format. I confirmed using SOAP Sonar that the value is getting populated.

This object array has all the values from clients table. I just need to Full Name and Client ID from it. However, I have no clue how can I do that. I tried XML Serialization to deserialize XML. After that I need to populate those values in a combobox, I am quite certain I can do that.

Adding some code for more information: Function Calling WCF: '

Client[] PopulateClient(string param1){
  Client[] clientlist;
  var ClientListResponse = GetClientList<ClienListResponse>(returninXMLFormat);
  clientlist = ClientListResponse.Items;
  return clientlist;
}

//Another Class calling above function
Client[] getclient(string param)
{
   Client[] callclient(param)
   return callclient;
}

' Now I need to use callclient to populate my combobox. call client has table with multiple clients and 20 columns. I just need full name and ID.

Any help is greatly appreciated. I am using .net Framework 4.0. Thanks

Was it helpful?

Solution

I suppose you have already had your collection/array, here is the detail for what I commented as suggestion:

public class Item {
   public string FullName {get;set;}
   public string ID {get;set;}
}
//your array of Item
Item[] items = ...
//Bind your array to your combobox
comboBox.DataSource = items;
comboBox.DisplayMember = "FullName";
comboBox.ValueMember = "ID";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top