私は、User Scopeを使用して、アプリケーション設定でホスト、ユーザー、パスワード、およびデフォルトのデータベース名などの基本データベース接続情報を保存するアプリケーションを作成しています。は、.net 3.5のアプリケーション設定を保存できません。
私は、Visual Studio 2008の
で.NET 3.5を使用しています私は、ユーザーコントロールに4つのテキストボックスを入れて、アプリケーションの設定個々のプロパティに自分のtextプロパティを結合しました。
//
// textBox_database
//
this.textBox_database.Location = new System.Drawing.Point(103, 101);
this.textBox_database.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.textBox_database.Name = "textBox_database";
this.textBox_database.Size = new System.Drawing.Size(255, 27);
this.textBox_database.TabIndex = 5;
this.textBox_database.Text = global::PHP_Code_Generator_2.Properties.Settings.Default.mysql_database;
//
// textBox_password
//
this.textBox_password.Location = new System.Drawing.Point(103, 69);
this.textBox_password.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.textBox_password.Name = "textBox_password";
this.textBox_password.Size = new System.Drawing.Size(255, 27);
this.textBox_password.TabIndex = 4;
this.textBox_password.Text = global::PHP_Code_Generator_2.Properties.Settings.Default.mysql_password;
this.textBox_password.UseSystemPasswordChar = true;
//
// textBox_user
//
this.textBox_user.Location = new System.Drawing.Point(103, 37);
this.textBox_user.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.textBox_user.Name = "textBox_user";
this.textBox_user.Size = new System.Drawing.Size(255, 27);
this.textBox_user.TabIndex = 7;
this.textBox_user.Text = global::PHP_Code_Generator_2.Properties.Settings.Default.mysql_user;
//
// textBox_server
//
this.textBox_server.Location = new System.Drawing.Point(103, 5);
this.textBox_server.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.textBox_server.Name = "textBox_server";
this.textBox_server.Size = new System.Drawing.Size(255, 27);
this.textBox_server.TabIndex = 6;
this.textBox_server.Text = global::PHP_Code_Generator_2.Properties.Settings.Default.mysql_server;
これらのテキストボックスは、ユーザーのユーザーデータを取得して独自のデータベース情報を設定します。変更した情報を設定ファイルに保存するボタンがあります。
private void button_save_Click(object sender, EventArgs e)
{
Properties.Settings.Default.Save();
}
デザインは保存されていません。誰でも助けてくれますか?シリルへ
に関して、 Anjan
:はい、私は、プロパティに変更された値を割り当てるためのコードを持っていたが、その後もスコープは、それが読み取り専用前記「ユーザ」に設定しました。私はプロパティの割り当てコードを削除しました。 今私はコードを取り戻し、VSを再起動しました。これは今では完璧に動作します。私は愚かです。私はこの古い手順を試してみるべきです。 シリルありがとうございます。