If all that you are trying to do is to pull out the information in the first row in a single column, I would look into the ExecuteScalar function (
SqlCommand.ExecuteScalar Method[
^]). Also, all you're doing is checking if the value is in the database. So, I would do something more like:
MySqlCommand sql1 = new MySqlCommand("SELECT name FROM users WHERE name = '" + this.UserList.SelectedValue.ToString() + "'", myConnection.GetConnection());
if(sql1.ExecuteScalar()==null)
{
this.Usernametxtbox.Text="Not Found";
}
else
{
this.Usernametxtbox.Text = this.UserList.SelectedValue.ToString();
}