开发者

Saving combo box on exit

开发者 https://www.devze.com 2023-02-20 04:26 出处:网络
I am adding item to a combo box programatically via Items.Add() method of the combo box. The item is added to the combo box, but it is not there after the user exits the application.I followed the adv

I am adding item to a combo box programatically via Items.Add() method of the combo box. The item is added to the combo box, but it is not there after the user exits the application. I followed the advice given here:

http://social.msdn.microsoft.com/Forums/en/Vsexpressvcs/thread/760fc26d-dc45-4827-aab6-21ee开发者_如何学编程bff07333

But ran into the same issue as the OP, namely, there was no defintion for "Items" Foreach (string Item in ComboItems.Items)

Any help would be appreciated.


It is not possible to save The Combox items if the user exits your application if you use that Comboboc.Items.Add in Runtime.

The only way is that you may need to have Storage(Database) and store those items in it. After that bind it to your combobox.

E.G:

private void SaveItemtoCombobox()
{

  //save method stuff

}


private void LoadDatatoCombobox()
{


   cmbBox1.DataSource = source;
   cmbBox1.DisplayMember = "MyTableName";

}

Regards

0

精彩评论

暂无评论...
验证码 换一张
取 消