Click here to Skip to main content
15,915,094 members

Comments by MarioPT (Top 7 by date)

MarioPT 11-May-16 6:55am View    
It´s working!!! Thanks i just had to change the bool to another side like this:

<pre>private void btnSubmit_Click(object sender, EventArgs e)
{

bool isExists = false;
if (check())
{

}
else
{
foreach (ListViewItem item in listView1.Items)
if (item.SubItems[2].Text == txtName.Text)
{
isExists = true;
break;
}

if (isExists)
MessageBox.Show("Your list already contains one person with that Name.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
else
add();


}
}
</pre>
MarioPT 11-May-16 6:53am View    
And when i start my listview already with persons he will get inside the foreach and verify, so the problem is just when my listview is empty
MarioPT 11-May-16 6:52am View    
My problem is just when my listview is empty it will leave the foreach and i don't want that, if the listvew is empty he can add the person
MarioPT 11-May-16 6:50am View    
my add method is working fine and it's adding items to my listview, if i let just this code:

private void btnSubmit_Click(object sender, EventArgs e)
{
if (check())
{

}
else
add();
}
it will check if my textboxes are empty if not he will add if some are empty it will popup one messageBox warning
MarioPT 9-May-16 6:33am View    
Well i also think that im not far from the solution the problem is that i don't know how to replace

public Person(TypeTimer s1) : this()
{
//I have removed the switch from here and put in my elapsed and now i need something that tells wich one is checked in my elapsed so i need some code here that i don't know, and yes i have done the code with some help, im still in school learning C# and this way of doing this code is completly new for me
}