المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : combobox datasource switch



C# Programming
01-25-2010, 09:10 PM
hey guys...i have a combobox in my form and i fill it with one column from my db...everything is fine till here...and i open another form if the user wants to add another data different than the db that are in combobox...and in new form user enter new data to a textbox and i write that data to a txt file...and i want to add that data to combobox also..that is why i wrote that function

public void DosyaOku(object sender, EventArgs e)
{
StreamReader read = new StreamReader("Firmalar.txt");
string kelime = read.ReadLine();
while (kelime != null)
{
cmbFirma.Items.Add(kelime);
kelime = read.ReadLine();
}
read.Close();
}

but whenever i try to call it..the program gives error and says combobox has a datasource already
so how can i add new data to combobox ??
thanks for your help