Reputation: 1474
I have added the following setting in application settings:
Name: Type: Scope: Value:
ComboBoxItems String User I didn't insert any value here
I declared as following:
public partial class postLoginWindow : Window
{
private readonly string dbConnectionString = Properties.Settings.Default.dbConnectionString;
private readonly string currentAdminEmail;
private string ComboBoxItemsString = Properties.Settings.Default.ComboBoxItems;
public postLoginWindow(string receivedAdminEmail)
{
InitializeComponent();
LoadComboBoxValues();
if (ComboBoxSelectedProfile.Items.IsEmpty)
{
ComboBoxSelectedProfile.IsEnabled = false;
ButtonRenameProfile.IsEnabled = false;
ButtonChangePermissions.IsEnabled = false;
ButtonAddNewUser.IsEnabled = false;
ButtonRemoveUser.IsEnabled = false;
ButtonDeleteProfile.IsEnabled = false;
}
...
}
}
This is the method i used to load the string values into the comboBox:
private void LoadComboBoxValues()
{
string[] ComboBoxRows = ComboBoxItemsString.Split('|');
foreach (string Row in ComboBoxRows)
{
if (Row != "") ComboBoxSelectedProfile.Items.Add(Row);
}
}
and this is how i add values when i want to save them in the setting string:
private void ComboBoxAddItem(string item)
{
string[] ComboBoxRows = Properties.Settings.Default.ComboBoxItems.Split('|');
bool ItemAlreadyExists = false;
foreach (string Row in ComboBoxRows)
{
if (Row == item) ItemAlreadyExists = true;
}
if (!ItemAlreadyExists)
{
parent.ComboBoxSelectedProfile.Items.Add(item);
string ComboBoxSavedProfileAsString = TxtProfileName.Text + "|";
Properties.Settings.Default.ComboBoxItems = Properties.Settings.Default.ComboBoxItems +
ComboBoxSavedProfileAsString;
Properties.Settings.Default.Save();
}
}
Which is done from another window in which i add users.
The problem is: everytime i go into DebugMode for debugging my application it rises up as if the settings string is empty even if i did add some string to it. So i can't debug my application.
i' appreciate your help very much!
Upvotes: 0
Views: 286
Reputation: 1474
BIG Thanks to @Wendy - MSFT, thanks to him/her/it i found the true solution to this problem (which is basically the opposite of what she/he/apache helicopter suggested):
Please note: Unchecked = Debugger WILL INCLUDE your user-settings that you added to debugging time.
Checked = Debugger WILL IGNORE your user-settings that you added to debugging time.
Upvotes: 0
Reputation: 3766
Please checked "Enable the Visual Studio hosting process" option in Project Properties window. When this option is disabled, the settings string that added before will be empty. But after I enable this option, the settings string value will show.
Upvotes: 1