So basically what im trying to do is using settLoadBooleans
as changing the checkboxes state based on a text file that got loaded, the problem is i need to set the name of the checkbox using the string i got from that text file.
in "public partial class MainForm : Form"
public static string curDir = System.IO.Directory.GetCurrentDirectory();
public static string settingsdnt = curDir + @"\settings.dnt";
public static int settNo = 1;
public static string[] readSettdnt = File.ReadAllLines(settingsdnt);
public void MainForm_Load(object sender, EventArgs e)
{
Settings.VibeCheck();
string getLineForBool = readSettdnt[settNo - 1].Substring(readSettdnt[settNo - 1].IndexOf(":") + 1);
string getLineName = readSettdnt[settNo - 1].Substring(readSettdnt[settNo - 1].LastIndexOf(':') + 1);
for (; settNo < 128; settNo++)
{
if (getLineForBool == "True" && getLineForBool == "False")
{
settLoadBooleans(getLineName);
}
}
}
public static void settLoadBooleans(string settName)
{
string getLine = readSettdnt[settNo - 1].Substring(readSettdnt[settNo - 1].IndexOf(":") + 1);
//thats where i need to change the string to checkbox
if (getLine == "True")
{
settNameCb.Checked = true;
}
else
{
settNameCb.Checked = false;
}
}
in "class Settings"
public static string curDir = System.IO.Directory.GetCurrentDirectory();
public static void VibeCheck()
{
FileStream fs = File.Create(curDir + @"\settings.dnt");
fs.Close();
using (StreamWriter sw = File.AppendText(curDir + @"\settings.dnt"))
{
for (int i = 0; i < 128; i++)
{
sw.WriteLine("");
}
sw.Close();
}
}
In the end of this, what im trying to do is: When settNo
hits a line that has "True" or "False" string after ":" it should change the checkboxes name to the string that created from that line we hit before and take the part before ":"
Aucun commentaire:
Enregistrer un commentaire