How do i load Combobox.SelectedItem from a IniFile? [closed]Reading/writing an INI fileHow do I enumerate an enum in C#?Cross-thread operation not valid: Control accessed from a thread other than the thread it was created onHow do I get a consistent byte representation of strings in C# without manually specifying an encoding?Get int value from enum in C#How do I remedy the “The breakpoint will not currently be hit. No symbols have been loaded for this document.” warning?How do I generate a random int number?IEnumerable vs List - What to Use? How do they work?how to create inifile in Delphi Prism for .net that will work on window and Linux(Mono)?Section-inheritance with Config::IniFilesWhy not inherit from List<T>?
Why didn't Thanos use the Time Stone to stop the Avengers' plan?
Where have Brexit voters gone?
Why did Theresa May offer a vote on a second Brexit referendum?
Have 1.5% of all nuclear reactors ever built melted down?
When the Torah was almost lost and one (or several) Rabbis saved it?
How to ignore kerning of underbrace in math mode
Is it possible to remotely hack the GPS system and disable GPS service worldwide?
How to politely tell someone they did not hit "reply to all" in an email?
I know that there is a preselected candidate for a position to be filled at my department. What should I do?
First Match - awk
Make 24 using exactly three 3s
Why does Mjolnir fall down in Age of Ultron but not in Endgame?
Is it legal to have an abortion in another state or abroad?
Pirate democracy at its finest
Construct a word ladder
Can a British citizen living in France vote in both France and Britain in the European Elections?
A steel cutting sword?
Is it rude to call a professor by their last name with no prefix in a non-academic setting?
USPS Back Room - Trespassing?
Is it legal to meet with potential future employers in the UK, whilst visiting from the USA
Is Jon Snow the last of his House?
How can I tell if I'm being too picky as a referee?
Did 20% of US soldiers in Vietnam use heroin, 95% of whom quit afterwards?
What was the idiom for something that we take without a doubt?
How do i load Combobox.SelectedItem from a IniFile? [closed]
Reading/writing an INI fileHow do I enumerate an enum in C#?Cross-thread operation not valid: Control accessed from a thread other than the thread it was created onHow do I get a consistent byte representation of strings in C# without manually specifying an encoding?Get int value from enum in C#How do I remedy the “The breakpoint will not currently be hit. No symbols have been loaded for this document.” warning?How do I generate a random int number?IEnumerable vs List - What to Use? How do they work?how to create inifile in Delphi Prism for .net that will work on window and Linux(Mono)?Section-inheritance with Config::IniFilesWhy not inherit from List<T>?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Im working on a Program right now whe i want to save some Values to a Ini File when Closinng and Load then UP again when you open the Program.
The Saving works good and looks like this
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
INIFile ini = new INIFile("C:\GodToolSettings.ini");
ini.Write("SalvageKeySave", "Value", SalvageComboBox.SelectedItem.ToString());
ini.Write("InvDropSave", "Value", invdropcombo.SelectedItem.ToString());
ini.Write("GambleSave", "Value", gamblecombo.SelectedItem.ToString());
ini.Write("LClickspamSave", "Value", lclickspamcombo.SelectedItem.ToString());
ini.Write("GemUpsSave", "Value", GemUpsCombo.SelectedItem.ToString());
ini.Write("OpenGRSave", "Value", OpenGRcombo.SelectedItem.ToString());
ini.Write("PauseSave", "Value", PauseCombo.SelectedItem.ToString());
Now i want to load then up again when i start the Program how do i do that ?
c# ini
closed as too broad by MickyD, Jimi, Ashkan Mobayen Khiabani, rene, Nic3500 Mar 24 at 14:43
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
Im working on a Program right now whe i want to save some Values to a Ini File when Closinng and Load then UP again when you open the Program.
The Saving works good and looks like this
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
INIFile ini = new INIFile("C:\GodToolSettings.ini");
ini.Write("SalvageKeySave", "Value", SalvageComboBox.SelectedItem.ToString());
ini.Write("InvDropSave", "Value", invdropcombo.SelectedItem.ToString());
ini.Write("GambleSave", "Value", gamblecombo.SelectedItem.ToString());
ini.Write("LClickspamSave", "Value", lclickspamcombo.SelectedItem.ToString());
ini.Write("GemUpsSave", "Value", GemUpsCombo.SelectedItem.ToString());
ini.Write("OpenGRSave", "Value", OpenGRcombo.SelectedItem.ToString());
ini.Write("PauseSave", "Value", PauseCombo.SelectedItem.ToString());
Now i want to load then up again when i start the Program how do i do that ?
c# ini
closed as too broad by MickyD, Jimi, Ashkan Mobayen Khiabani, rene, Nic3500 Mar 24 at 14:43
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Well, since yourINIFile
class has aWrite()
method, it probably also has aRead()
method. Read the values back, then it could be, for example:SalvageComboBox.SelectedIndex = SalvageComboBox.FindString(ini.Read("SalvageKeySave", "Value"));
.
– Jimi
Mar 24 at 2:32
Welcome. Your question is kinda borderline too broad. How to Ask. Good luck!
– MickyD
Mar 24 at 2:34
Are you using the class found in this answer?. Anyway, I think you could dump theini
format and serialize/deserialize a JSON, using a class structure. Much more flexible. Or use the Project settings.
– Jimi
Mar 24 at 2:39
I was usingini
for all my other Stuff before im open for new things tho. How does JSON work ? never heard about it.
– Godly
Mar 24 at 2:45
and yes im using the Class in the Answer you posted.
– Godly
Mar 24 at 2:50
add a comment |
Im working on a Program right now whe i want to save some Values to a Ini File when Closinng and Load then UP again when you open the Program.
The Saving works good and looks like this
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
INIFile ini = new INIFile("C:\GodToolSettings.ini");
ini.Write("SalvageKeySave", "Value", SalvageComboBox.SelectedItem.ToString());
ini.Write("InvDropSave", "Value", invdropcombo.SelectedItem.ToString());
ini.Write("GambleSave", "Value", gamblecombo.SelectedItem.ToString());
ini.Write("LClickspamSave", "Value", lclickspamcombo.SelectedItem.ToString());
ini.Write("GemUpsSave", "Value", GemUpsCombo.SelectedItem.ToString());
ini.Write("OpenGRSave", "Value", OpenGRcombo.SelectedItem.ToString());
ini.Write("PauseSave", "Value", PauseCombo.SelectedItem.ToString());
Now i want to load then up again when i start the Program how do i do that ?
c# ini
Im working on a Program right now whe i want to save some Values to a Ini File when Closinng and Load then UP again when you open the Program.
The Saving works good and looks like this
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
INIFile ini = new INIFile("C:\GodToolSettings.ini");
ini.Write("SalvageKeySave", "Value", SalvageComboBox.SelectedItem.ToString());
ini.Write("InvDropSave", "Value", invdropcombo.SelectedItem.ToString());
ini.Write("GambleSave", "Value", gamblecombo.SelectedItem.ToString());
ini.Write("LClickspamSave", "Value", lclickspamcombo.SelectedItem.ToString());
ini.Write("GemUpsSave", "Value", GemUpsCombo.SelectedItem.ToString());
ini.Write("OpenGRSave", "Value", OpenGRcombo.SelectedItem.ToString());
ini.Write("PauseSave", "Value", PauseCombo.SelectedItem.ToString());
Now i want to load then up again when i start the Program how do i do that ?
c# ini
c# ini
asked Mar 24 at 2:25
GodlyGodly
95
95
closed as too broad by MickyD, Jimi, Ashkan Mobayen Khiabani, rene, Nic3500 Mar 24 at 14:43
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
closed as too broad by MickyD, Jimi, Ashkan Mobayen Khiabani, rene, Nic3500 Mar 24 at 14:43
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Well, since yourINIFile
class has aWrite()
method, it probably also has aRead()
method. Read the values back, then it could be, for example:SalvageComboBox.SelectedIndex = SalvageComboBox.FindString(ini.Read("SalvageKeySave", "Value"));
.
– Jimi
Mar 24 at 2:32
Welcome. Your question is kinda borderline too broad. How to Ask. Good luck!
– MickyD
Mar 24 at 2:34
Are you using the class found in this answer?. Anyway, I think you could dump theini
format and serialize/deserialize a JSON, using a class structure. Much more flexible. Or use the Project settings.
– Jimi
Mar 24 at 2:39
I was usingini
for all my other Stuff before im open for new things tho. How does JSON work ? never heard about it.
– Godly
Mar 24 at 2:45
and yes im using the Class in the Answer you posted.
– Godly
Mar 24 at 2:50
add a comment |
Well, since yourINIFile
class has aWrite()
method, it probably also has aRead()
method. Read the values back, then it could be, for example:SalvageComboBox.SelectedIndex = SalvageComboBox.FindString(ini.Read("SalvageKeySave", "Value"));
.
– Jimi
Mar 24 at 2:32
Welcome. Your question is kinda borderline too broad. How to Ask. Good luck!
– MickyD
Mar 24 at 2:34
Are you using the class found in this answer?. Anyway, I think you could dump theini
format and serialize/deserialize a JSON, using a class structure. Much more flexible. Or use the Project settings.
– Jimi
Mar 24 at 2:39
I was usingini
for all my other Stuff before im open for new things tho. How does JSON work ? never heard about it.
– Godly
Mar 24 at 2:45
and yes im using the Class in the Answer you posted.
– Godly
Mar 24 at 2:50
Well, since your
INIFile
class has a Write()
method, it probably also has a Read()
method. Read the values back, then it could be, for example: SalvageComboBox.SelectedIndex = SalvageComboBox.FindString(ini.Read("SalvageKeySave", "Value"));
.– Jimi
Mar 24 at 2:32
Well, since your
INIFile
class has a Write()
method, it probably also has a Read()
method. Read the values back, then it could be, for example: SalvageComboBox.SelectedIndex = SalvageComboBox.FindString(ini.Read("SalvageKeySave", "Value"));
.– Jimi
Mar 24 at 2:32
Welcome. Your question is kinda borderline too broad. How to Ask. Good luck!
– MickyD
Mar 24 at 2:34
Welcome. Your question is kinda borderline too broad. How to Ask. Good luck!
– MickyD
Mar 24 at 2:34
Are you using the class found in this answer?. Anyway, I think you could dump the
ini
format and serialize/deserialize a JSON, using a class structure. Much more flexible. Or use the Project settings.– Jimi
Mar 24 at 2:39
Are you using the class found in this answer?. Anyway, I think you could dump the
ini
format and serialize/deserialize a JSON, using a class structure. Much more flexible. Or use the Project settings.– Jimi
Mar 24 at 2:39
I was using
ini
for all my other Stuff before im open for new things tho. How does JSON work ? never heard about it.– Godly
Mar 24 at 2:45
I was using
ini
for all my other Stuff before im open for new things tho. How does JSON work ? never heard about it.– Godly
Mar 24 at 2:45
and yes im using the Class in the Answer you posted.
– Godly
Mar 24 at 2:50
and yes im using the Class in the Answer you posted.
– Godly
Mar 24 at 2:50
add a comment |
1 Answer
1
active
oldest
votes
Check the video around 2:45. He shows how to use the Read() stuff, of that class.
Believe, you're after:
//I assume, you set the ComboBox DropDownStyle to DropDownList, to keep people from being able to type in bad key info?
comboBox1.SelectedIndex = comboBox1.FindStringExact(stringtofind);
If you let the users select a "ctrl - shift - alt key", as part of the shortcut, you'll need to split the incoming value. But, from the code above, it looks like you didn't. Here's the code, in case you change your mind.
Keys hookKey = (Keys)new KeysConverter().ConvertFrom(value); //If value is a string
checkBox1.Checked = ((hookKey & Keys.Control) == Keys.Control);
checkBox2.Checked = ((hookKey & Keys.Alt) == Keys.Alt);
checkBox3.Checked = ((hookKey & Keys.Shift) == Keys.Shift);
hookKey = (((hookKey & Keys.Control) == Keys.Control) ? (hookKey &= ~Keys.Control) : hookKey);
hookKey = (((hookKey & Keys.Shift) == Keys.Shift) ? (hookKey &= ~Keys.Shift) : hookKey);
hookKey = (((hookKey & Keys.Alt) == Keys.Alt) ? (hookKey &= ~Keys.Alt) : hookKey);
MessageBox.Show($"hookKey should only hold the key you need to put in the combobox : hookKey");
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Check the video around 2:45. He shows how to use the Read() stuff, of that class.
Believe, you're after:
//I assume, you set the ComboBox DropDownStyle to DropDownList, to keep people from being able to type in bad key info?
comboBox1.SelectedIndex = comboBox1.FindStringExact(stringtofind);
If you let the users select a "ctrl - shift - alt key", as part of the shortcut, you'll need to split the incoming value. But, from the code above, it looks like you didn't. Here's the code, in case you change your mind.
Keys hookKey = (Keys)new KeysConverter().ConvertFrom(value); //If value is a string
checkBox1.Checked = ((hookKey & Keys.Control) == Keys.Control);
checkBox2.Checked = ((hookKey & Keys.Alt) == Keys.Alt);
checkBox3.Checked = ((hookKey & Keys.Shift) == Keys.Shift);
hookKey = (((hookKey & Keys.Control) == Keys.Control) ? (hookKey &= ~Keys.Control) : hookKey);
hookKey = (((hookKey & Keys.Shift) == Keys.Shift) ? (hookKey &= ~Keys.Shift) : hookKey);
hookKey = (((hookKey & Keys.Alt) == Keys.Alt) ? (hookKey &= ~Keys.Alt) : hookKey);
MessageBox.Show($"hookKey should only hold the key you need to put in the combobox : hookKey");
add a comment |
Check the video around 2:45. He shows how to use the Read() stuff, of that class.
Believe, you're after:
//I assume, you set the ComboBox DropDownStyle to DropDownList, to keep people from being able to type in bad key info?
comboBox1.SelectedIndex = comboBox1.FindStringExact(stringtofind);
If you let the users select a "ctrl - shift - alt key", as part of the shortcut, you'll need to split the incoming value. But, from the code above, it looks like you didn't. Here's the code, in case you change your mind.
Keys hookKey = (Keys)new KeysConverter().ConvertFrom(value); //If value is a string
checkBox1.Checked = ((hookKey & Keys.Control) == Keys.Control);
checkBox2.Checked = ((hookKey & Keys.Alt) == Keys.Alt);
checkBox3.Checked = ((hookKey & Keys.Shift) == Keys.Shift);
hookKey = (((hookKey & Keys.Control) == Keys.Control) ? (hookKey &= ~Keys.Control) : hookKey);
hookKey = (((hookKey & Keys.Shift) == Keys.Shift) ? (hookKey &= ~Keys.Shift) : hookKey);
hookKey = (((hookKey & Keys.Alt) == Keys.Alt) ? (hookKey &= ~Keys.Alt) : hookKey);
MessageBox.Show($"hookKey should only hold the key you need to put in the combobox : hookKey");
add a comment |
Check the video around 2:45. He shows how to use the Read() stuff, of that class.
Believe, you're after:
//I assume, you set the ComboBox DropDownStyle to DropDownList, to keep people from being able to type in bad key info?
comboBox1.SelectedIndex = comboBox1.FindStringExact(stringtofind);
If you let the users select a "ctrl - shift - alt key", as part of the shortcut, you'll need to split the incoming value. But, from the code above, it looks like you didn't. Here's the code, in case you change your mind.
Keys hookKey = (Keys)new KeysConverter().ConvertFrom(value); //If value is a string
checkBox1.Checked = ((hookKey & Keys.Control) == Keys.Control);
checkBox2.Checked = ((hookKey & Keys.Alt) == Keys.Alt);
checkBox3.Checked = ((hookKey & Keys.Shift) == Keys.Shift);
hookKey = (((hookKey & Keys.Control) == Keys.Control) ? (hookKey &= ~Keys.Control) : hookKey);
hookKey = (((hookKey & Keys.Shift) == Keys.Shift) ? (hookKey &= ~Keys.Shift) : hookKey);
hookKey = (((hookKey & Keys.Alt) == Keys.Alt) ? (hookKey &= ~Keys.Alt) : hookKey);
MessageBox.Show($"hookKey should only hold the key you need to put in the combobox : hookKey");
Check the video around 2:45. He shows how to use the Read() stuff, of that class.
Believe, you're after:
//I assume, you set the ComboBox DropDownStyle to DropDownList, to keep people from being able to type in bad key info?
comboBox1.SelectedIndex = comboBox1.FindStringExact(stringtofind);
If you let the users select a "ctrl - shift - alt key", as part of the shortcut, you'll need to split the incoming value. But, from the code above, it looks like you didn't. Here's the code, in case you change your mind.
Keys hookKey = (Keys)new KeysConverter().ConvertFrom(value); //If value is a string
checkBox1.Checked = ((hookKey & Keys.Control) == Keys.Control);
checkBox2.Checked = ((hookKey & Keys.Alt) == Keys.Alt);
checkBox3.Checked = ((hookKey & Keys.Shift) == Keys.Shift);
hookKey = (((hookKey & Keys.Control) == Keys.Control) ? (hookKey &= ~Keys.Control) : hookKey);
hookKey = (((hookKey & Keys.Shift) == Keys.Shift) ? (hookKey &= ~Keys.Shift) : hookKey);
hookKey = (((hookKey & Keys.Alt) == Keys.Alt) ? (hookKey &= ~Keys.Alt) : hookKey);
MessageBox.Show($"hookKey should only hold the key you need to put in the combobox : hookKey");
edited Mar 24 at 5:34
answered Mar 24 at 3:37
tobeypeterstobeypeters
30517
30517
add a comment |
add a comment |
Well, since your
INIFile
class has aWrite()
method, it probably also has aRead()
method. Read the values back, then it could be, for example:SalvageComboBox.SelectedIndex = SalvageComboBox.FindString(ini.Read("SalvageKeySave", "Value"));
.– Jimi
Mar 24 at 2:32
Welcome. Your question is kinda borderline too broad. How to Ask. Good luck!
– MickyD
Mar 24 at 2:34
Are you using the class found in this answer?. Anyway, I think you could dump the
ini
format and serialize/deserialize a JSON, using a class structure. Much more flexible. Or use the Project settings.– Jimi
Mar 24 at 2:39
I was using
ini
for all my other Stuff before im open for new things tho. How does JSON work ? never heard about it.– Godly
Mar 24 at 2:45
and yes im using the Class in the Answer you posted.
– Godly
Mar 24 at 2:50