关于Windows应用程序 [英] Regarding windows Application

查看:80
本文介绍了关于Windows应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有

嗨!我使用C#和SQL Server 2005开发了一个基于Windows的应用程序。在我的应用程序中,我创建了许多子窗体来插入和修改数据。在这些表格中,我创建了一个表格公司详细信息,以便向数据库插入公司名称,公司所有者,地址,电子邮件ID等数据。当用户第一次安装并运行此应用程序时,应首先加载公司详细信息表单,在插入所需数据后,应删除公司详细信息表单,直到重新安装。我无法做到这一点。请有人帮忙。

Dear All
Hi! I have developed a Windows Based Application by using C# and SQL Server 2005. In my application I created many child form to insert and modify data. Amongst those forms I created a form "Company Details" to insert data like "Company''s Name, Company Owner, Address , Email Id" etc. to the database. When the user will install and run this application for first time, ''Company Details'' form should be loaded first, after inserting required data the ''Company Details'' form should be deleted until reinstallation. I am unable to do this. Please someone help.

推荐答案

所以添加一个配置文件条目:FirstRun并将其默认为true。

请在申请时检查开始,如果是,则处理您的初始设置。然后将其设置为false。



这很容易做到:

在解决方案资源管理器中打开项目属性,然后双击在Settings.settings上



使用以下属性创建一个新设置:

So add a configuration file entry: "FirstRun" and defaulkt it to true.
Check it when your application starts, and if true, deal with your initial setup stuff. Then set it to false.

It''s easy to do:
Open your project Properties in the Solution Explorer, and double click on "Settings.settings"

Create a new setting with the following properties:
Name  FirstRun
Type  bool
Scope User
Value



这会将值保留在应用程序设置文件中。



将以下内容添加到主Form构造函数或Shown Event处理程序:


This will persist the value to the application settings file.

Add the following to your main Form constructor or Shown Event handler:

if (Properties.Settings.Default.FirstRun)
    {
    // do your config
    Properties.Settings.Default.FirstRun = false;
    Properties.Settings.Default.Save();
    }


如果包含''Company Details''的表为空,则执行''初始化程序'' - 如果不,你的申请开始正常。



问候

Espen Harlinn
If the tables caontaining the ''Company Details'' are empty execute the ''initialization procedure'' - if not, you have a ''normal'' start of your application.

Regards
Espen Harlinn


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

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