1
I’m developing an O.S. software where I’ve divided the main problems into several checkboxes. All data populated on the screen will be sent to a text file, which soon after will be viewed by the boss in Excel.
My problem is that I am not able to capture information only from checkboxes that have been marked.
My question is: How to capture information relating only to checkboxes that have been marked and play in a text file?
PS: To identify the checkbox, next to each one I added a Label with the description of the problem q the checkbox represents, I do not know if it is the most correct way. I added a code that I assembled from a Net tutorial, I need to capture the information for each checkbox that is marked
private void BtSalvar_Click(object sender, EventArgs e)
{
String path = @"C:\\Users\\Core i3\\Desktop\\OS.Soluctions.txt";
StreamWriter arq = new StreamWriter(path, true);
arq.WriteLine("");
arq.Write(TbNumeroOS.Text.ToUpper() + "," + maskedTextBox1.Text.ToUpper() + "," + maskedTextBox3.Text.ToUpper() + "," + TbSuporte.Text.ToUpper() + "," + maskedTextBox5.Text.ToUpper() + "," + maskedTextBox4.Text.ToUpper() + "," + CbListTec.Text.ToUpper() + "," + CbStatus.Text.ToUpper()
+ "," + label12.Text.ToUpper() + "," + label13.Text.ToUpper() + "," + label14.Text.ToUpper() + "," + label15.Text.ToUpper() + "," + label16.Text.ToUpper());
TbNumeroOS.Clear();
TbSuporte.Clear();
maskedTextBox1.Clear();
maskedTextBox3.Clear();
maskedTextBox5.Clear();
maskedTextBox4.Clear();
arq.Close();
arq.Dispose();
Console.WriteLine("Text Appended");
MessageBox.Show("O.S. ADCIONADA COM SUCESSO", "ATENÇÃO!!!", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
}
private void CbSupUsuario_CheckedChanged(object sender, EventArgs e)
{
if (CbSupUsuario.Checked == true)
label12.Text = "Suporte ao Usuário";
}
private void CbMaqEquip_CheckedChanged(object sender, EventArgs e)
{
if (CbMaqEquip.Checked == true)
label13.Text = "Máquina/Equipamento";
else
label13.Text = "";
}
private void CbFaltaInter_CheckedChanged(object sender, EventArgs e)
{
if (CbFaltaInter.Checked == true)
label14.Text = "Falta de Internet";
else
label14.Text = "";
}
private void CbConfigEquip_CheckedChanged(object sender, EventArgs e)
{
if (CbConfigEquip.Checked == true)
label15.Text = "Configuracao de Equipamento";
else
label15.Text = "";
}
private void CbAtuaSoftWare_CheckedChanged(object sender, EventArgs e)
{
if (CbAtuaSoftWare.Checked == true)
label16.Text = "Atualizacao de Software";
else
label16.Text = "";
}
Winforms? WPF? ASP.NET Webforms? ASP.NET MVC?
– Jéf Bueno
I’m doing with Winforms
– Luiz Felipe
And what information do you need to get from the checkboxes? They are inside some container (a parent control)?
– Jéf Bueno
I’ve added more code so you can better understand the structure I’m trying to build
– Luiz Felipe
Your code tells me nothing. If you answered what I asked would be much easier.
– Jéf Bueno
They are without control, sorry for the delay to answer, is that I am learning in the fight, but confident
– Luiz Felipe
Young, it’s okay you don’t know/understand something. But trying to develop something without at least understanding the basis of the technology/language/framework is shooting in the foot. Also watch out when you come to ask for help, write some lines of text (confusing, by the way) and put a block of code is not enough in most cases. You need to explain to us well what you are trying to do and how you are trying to do it, what your expected behavior is and where your difficulty lies. Stop to notice how many questions I asked you, without them it is impossible to answer your question, this is reason to close it
– Jéf Bueno
I put an observation at the end of my answer. It’s all I can answer with the information you’ve given so far. You can comment if you have any questions or want to add information to your problem. For now, this is the most I can do.
– Jéf Bueno
I’m already meeting, the Checkboxes are outside the Parent Container, they are all inside a Panel. That’s what I was able to identify
– Luiz Felipe
Great. You just got confused about one thing. There is no parent container, I mean, there’s no parent control for the form, that’s a relative concept, your dashboard is the parent container of checkboxes. Now look at my answer, change the
parent
by panel name.– Jéf Bueno