问题描述
是VB.net的新手,并使用visual studio 2017在vb.net中创建项目。我正在开发一个使用sql server 2017作为后端的教堂管理系统。启动表单是登录。我还有一个用于设置sql server的表单。所以我希望sql server表单运行一次,直到创建sqlserver.dat。我使用sqlserver.dat作为我的connectionstring。所以我只需要一次运行sql server设置表单的帮助,这样当创建sqlserver.dat时它不会再次运行但会在我构建项目的任何时候运行登录表单
我尝试了什么:
正如我在vb.net中的新问题中所说的并且不知道如何去做,这就是为什么要问
Am new to VB.net and creating a project in vb.net using visual studio 2017. Am developing a church management system which uses sql server 2017 as the back end. The startup form is the login. I also have a form for setting the sql server. So i want the sql server form to run for one time until sqlserver.dat is created. Am using the sqlserver.dat as my connectionstring. So i want help on running sql server setting form for only one time so that when the sqlserver.dat is created it won't run again but will run the login form anytime i build my project
What I have tried:
As i said in the question am new in vb.net and have no idea how to go about it and thats why am asking
推荐答案
//opening the subkey
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\OurSettings");
bool bShowForm = true;
//if it does exist, retrieve the stored values
if (key != null)
{
if (key.GetValue("ShowSettingsForm") == "0")
bShowForm = false;
key.Close();
}
// now show form and set key to "0"
if (bShowForm )
{
// ....
key.SetValue("ShowSettingsForm", "0");
}
这篇关于我如何第一次运行表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!