Answer the question
In order to leave comments, you need to log in
How can I edit the dataGridView data of a text file from the form, from which the dataGridView rows are displayed in the form?
There is a program that reads data from the text file "data.cfg" and outputs them to the dataGridvView rows.
Let's say the "data.cfg" file contains: account|password|. The dataGridView displays:
private void Form1_Load(object sender, EventArgs e)
{
int num2;
ManagementObjectCollection instances = new ManagementClass("win32_processor").GetInstances();
string[] strArray = File.ReadAllLines("данные.cfg", Encoding.UTF8);
Application.ApplicationExit += new EventHandler(this.OnApplicationExit);
for (num2 = -0; num2 < strArray.Length; num2++)
{
if (strArray[num2][0] != '#')
{
string[] strArray2 = strArray[num2].Split(new char[] { '|' });
this.dataGridView1.Rows.Add();
this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[1].Value = strArray2[0];
this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[2].Value = strArray2[1];
string аккуант = strArray2[0];
string пароль = strArray2[1];
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question