加载下拉列表

发布于 2024-11-29 12:33:55 字数 238 浏览 0 评论 0原文

从桌面应用程序的参考/查找表加载下拉列表的最佳方法是什么?

该应用程序分为 3 层。我已经建立了我的实体。

前端有一个带有 6 个标签的表格。和一个大节省(另一个讨论:)

我应该在最初加载表单时加载它们吗?有没有我可以使用的缓存机制?

它是网络驱动器上的 vb.net 应用程序,可供多个用户访问。

还值得注意的是,一些参考表可能会更新。通过另一种形式。

谢谢 时间

what is the best way to load dropdown lists from reference/lookup tables for a desktop application?

the application is layed out into 3 tiers. I've built up my entities.

the front end has a form with 6 tabs. and one big save (another discussion :)

Should I load them all when the form is initially loaded? Are there any caching mechanisms I could use?

it is vb.net app on a network drive that is accessed by several users.

it's also worth noting that some reference tables may be updated. Via another form.

thanks
T

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你是年少的欢喜 2024-12-06 12:33:55

很多因素。您需要在构造函数中填充,以便数据可以填充视觉元素。请注意,选项卡不可见并不意味着应用程序启动时不会加载它。

对于静态字符串列表,

    public class Library : INotifyPropertyChanged
    {
        private List<string>  dropDown1;

        public List<string> DropDown1 { get { return dropDown1; } } 

        public Library()
        {
            // use data reader to populate dropDown1
        }
    }

我知道这会得到可以使用比列表更轻的东西的注释,但列表有很多不错的功能,简单的语法,并且易于填充。下一步,您可以构建客户端服务器并使用一些静态数据,以便列表填充一次,然后由所有人共享。如果您有更多属性,则用类替换字符串。对于动态列表,然后在获取中按需从表中获取当前数据。在您的获取中,您可以保留最后一个列表,如果下一个请求在 X 秒内,则返回过时的数据。这取决于陈旧数据是否可以接受。

还有许多其他方法,我并不假装这是最好的。只是提供一个相对简单的示例来帮助您入门。

当涉及到层次结构时,事情就会变得更加复杂。在那里,您可以使用 ADO.NET 表来存储静态相关数据,然后在视图上应用过滤器。

Lots of factors. One you need to populate in constructor so the data is there to populate the visual elements. Beware that just because a tab is not visible does not mean it is not loaded when you app starts.

For a static list of strings

    public class Library : INotifyPropertyChanged
    {
        private List<string>  dropDown1;

        public List<string> DropDown1 { get { return dropDown1; } } 

        public Library()
        {
            // use data reader to populate dropDown1
        }
    }

I know this will get comments that can use something lighter than a List but List has a lot of nice features, easy syntax, and easy to populate. As a next step you could structure as a client server and use some static so the list is populated once and then shared by all. If you have more properties then substitute string with a class. For a dynamic list then in the get you grab the current data from the table on demand. In your get you could hold on to the last list and if the next request is within X seconds then return stale data. It depends on if stale data is acceptable.

There are many other approaches and I do not pretend this is the best. Just putting out a relatively simple example to get you started.

When it gets to hierarchical then things get a little more complex. There you can use ADO.NET table to store the static dependent data and then apply a filter on a view.

多孤肩上扛 2024-12-06 12:33:55

如果它是网页,则不必在页面加载时加载所有选项卡。
桌面我认为它会更容易,而且应该是这样的。

仅当用户单击选项卡时显示页面并隐藏所有页面
与其他选项卡关联。

我希望所有选项卡页面值都将在会话中,以便用户可以最后返回到任何选项卡和您的大保存。

我在这里找到了与您的问题相关的有用信息

http://www.syncfusion.com/FAQ/ windowsforms/faq_c93c.aspx

还有一个

If its a web page you don't have to load all tabs on page load.
Desktop i think it will be more easy and it should be like that.

Only when the user click on the tab show the page and hide all the pages
associated for other tabs.

i hope all tab pages values will be on session so that user can go and come back to any tab and your Big Save at last.

Something useful related to your question i found here

http://www.syncfusion.com/FAQ/windowsforms/faq_c93c.aspx

and one more

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文