Since value is
null
, I would do something like this:
var result = (from t in root.Descendants("VAR")
let nameAttr = t.Attribute("name")
where nameAttr != null && nameAttr.Value != null
where String.Equals(nameAttr.Value, textBox1.Text, StringComparison.OrginalIgnoreCase)
select t.Ancestors("PACKET").Attributes().First().Value)
.ToList();