void resetListBoxContents()
        {
            listBox1.Items.Clear();
            List <KeyValuePair <string, string> > vars;

            if (ent != null)
            {
                vars = ent.GetVars();
            }
            else
            {
                vars = PrimaryEditor.GetVars();
            }
            foreach (KeyValuePair <string, string> kvp in vars)
            {
                if (kvp.Value == null)
                {
                    listBox1.Items.Add(kvp.Key + ": &NULL");
                }
                else
                {
                    listBox1.Items.Add(kvp.Key + ": " + kvp.Value.Replace("&", "&amp").Replace("\n", "&nl"));
                }
            }
        }
 void textBox1_TextChanged(object sender, EventArgs e)
 {
     if (textBox1.Text.Length > 0 && !textBox1.ReadOnly)
     {
         string s2 = textBox1.Text.Replace(Environment.NewLine, "\n").Replace("\r", "");
         if (ent != null)
         {
             ent.ApplyVar(label2.Text, s2);
             ent.Recalculate();
         }
         else
         {
             PrimaryEditor.ApplyVar(label2.Text, s2);
         }
         resetListBoxContents();
         PrimaryEditor.PRFMain.invalidateAll();
     }
 }