views:

1016

answers:

1

Hello! I have a method that returns a list of type string. I want to bind each item in the list to the textbox so essentially it looks like a listbox, except it will be editable since its actually a textbox!

any ideas on how to go about doing this!?

CODE:

public List<string> GetAgentsDetails(string writeDir)
    {
        List<string> agentInfoList = new List<string>();

        XElement doc = XElement.Load(writeDir);

        var getDetails =
            (from n in doc.Elements("Agent")
             select n.Element("Name").Value + "," + n.Element("EmailAddress").Value);
        foreach (var info in getDetails)
        {
            agentInfoList.Add(info);
        }
        return agentInfoList;

    }
+1  A: 

From the top of my head:

MyTextBox.Lines = GetAgentsDetails(writeDir).ToArray();

Ofcourse your TextBox should be multiline.

Sani Huttunen
Thankyou, i was using tostring instead of toarray.......yesterday was a long day, it seems!
Goober