you can put "Invalid Username or Password" this message in a different variable as messege and display final message after comparing Label4.text and message, if once for loop satisfies
condition if (id_user[k].Equals(txt_uname.Text))then name is in arraylist and if it is in database then do smething show appropriate message in Label4 (if needed) and break the loop.
Please try this.
id_user is a name of Arraylist.
string messege="";
for (int k = 0; k < id_user.Count; k++)
{
if (id_user[k].Equals(txt_uname.Text))
{
string username = "select ID,password from empl where id='" + txt_uname.Text + "' and password='" + txt_pass.Text + "'";
SqlDataAdapter ad = new SqlDataAdapter(username, c.getcon());
DataSet ds = new DataSet();
ad.Fill(ds);
c.close();
if (ds.Tables[0].Rows.Count != 0)
{
Label4.Text ="valid user";
break;
}
else
{
messege = "Invalid Username or Password";
}
}
else
{
Label4.Text = messege==""?"You Are Not Authorized User":messege;
}
}