I have created a windows application which retrieve data from .dat file and convert it into datagridview(as per my requirement, it splits data into columns).Now column named "Grouptype" is there. I want to create a dropdownbox in that particular column. and it should be filled with the existing data of that column.
E.g. if there are 5 different values for Grouptype column then the dropdownbox should be filled by those values. and if i add any new row and grouptype column has any new value then it should be allowed to enter.
``public static SortableBindingList<User> LoadUserListFromBkpFile(string path)
{
var users = new SortableBindingList<User>();
char[] delimiterChars = { '|' };
foreach (var linedata in File.ReadAllLines(path))
{
string[] words = linedata.Split(delimiterChars);
if (words.Count() < 10)
{
return users;
}
if (words[0].Trim() != "")
{
users.Add(new User
{
LineNumber = int.Parse(words[0]),
GroupType = words[1],
CountyCode = words[2],
County = words[3],
Payee = words[4],
Address1 = words[5],
Address2 = words[6],
City = words[7],
State = words[8],
ZipCode = words[9]
});
}
}
return users;
}
I don't know how to add dropdownbox with this. and fill it with existing data at run time.