in the below code i have displayed items in COMBOBOX on formload , the same i need to do for hos_keys , i just need to get the values in an array with out displaying them any where in the form, how i can do it by using .
here in below code i have read hid values and displayed in combobox.
void MainFormLoad(object sender, EventArgs e)
{
try
{
if(true)
{
WebClient wc = new WebClient();
wc.Headers["Content-type"] = "application/x-www-form-urlencoded";
NameValueCollection collection = new NameValueCollection();
collection.Add("hid",key.ToString());
collection.Add("sno", "4");
byte[] bret = wc.UploadValues(URLAuth, collection);
string sret = "";
sret = System.Text.Encoding.ASCII.GetString(bret);
int count=0;
string[,] husers ;
if (sret != "")
{
XmlDocument readDoc = new XmlDocument();
readDoc.LoadXml(sret);
count = readDoc.SelectNodes("hospitalusers/huids").Count;
husers = new string[count, 2];
// alternately, _doc.Load( _strFilename); to read from a file.
XmlNodeList xhuid = readDoc.GetElementsByTagName("huid");
XmlNodeList xuser_name = readDoc.GetElementsByTagName("user_name");
for (int i= 0; i < count; i++)
{
husers[i,0] = xhuid[i].InnerText;
husers[i, 1] = xuser_name[i].InnerText;
}
cmbhusers.DisplayMember="text";
cmbhusers.ValueMember="key";
for (int i = 0; i < husers.GetLength(0); i++)
{
cmbhusers.Items.Add(new { text = husers[i, 1], key=Convert.ToInt16(husers[i,0])});
}
}