Combobox节省 [英] Combobox saving

查看:66
本文介绍了Combobox节省的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我看过一些教程,并用这样的代码对此进行响应,以便在C#程序中保存Listbox项目:

So I've seen some tutorials and responds on this with a code like this to save Listbox items in a C# program:

            Properties.Settings.Default.Themes.Clear();



            foreach(cbxTheme.Items中的对象项)



            {

                Properties.Settings.Default.Themes.Add(item);

            }¥b $ b            Properties.Settings.Default.Save();

            Properties.Settings.Default.Themes.Clear();

            foreach (object item in cbxTheme.Items)

            {
                Properties.Settings.Default.Themes.Add(item);
            }
            Properties.Settings.Default.Save();

只有问题在于以某种方式在单词"item"中给出错误。它位于{}的行之间。

only the problem is that is somehow gives an error at the word "item" wich is at the line between the {}'s.

我想存储和恢复组合框的项目,但单词项目不起作用。我把它改成了一个字符串,然后工作但不知何故,组合框不再工作了。你能帮我解决1个字的问题吗?

I want to store and restore items of a combobox but the word item isn't working. I changed it to a string once and that worked but somehow the combobox didn't work anymore. Can you help me with how I am supposed to fix the problem of 1 word?

推荐答案

Btw ,我忘了告诉,但错误是它无法将对象转换为字符串。
Btw, I forgot to tell but the error is that it can't convert an object to string.


这篇关于Combobox节省的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆