locked
read from Tag Array RRS feed

  • Question

  • How to read value from Tag array

    this is my code

        List<object> ObjUser = new List<object>();
                ObjUser.Add(rec.ID);
                ObjUser.Add(rec.Name);
             
                frm.Tag = ObjUser;
                frm.ShowDialog();

    I would like to read from the Tag array in the second form and fill TagId  and TagName

      private void FormChangeUserPassword_Load(object sender, EventArgs e)
            {
              
                if (this.Tag != null)
                {   
                 
                    int TagId =  ????

                    string TagName=???

                   
                }
            }

    Please help and thanks in advance

    Thursday, December 22, 2016 10:05 AM

Answers

  • Try this:

    var user = (List<Object>)Tag;
    int id = (int)user[0]; 
    string name = (string)user[1];

    It is also possible to write these data, or the rec value, to some special new members of the form.

    • Marked as answer by Sam.A.Dev Tuesday, December 27, 2016 7:42 AM
    Thursday, December 22, 2016 3:35 PM

All replies

  • Try this:

    var user = (List<Object>)Tag;
    int id = (int)user[0]; 
    string name = (string)user[1];

    It is also possible to write these data, or the rec value, to some special new members of the form.

    • Marked as answer by Sam.A.Dev Tuesday, December 27, 2016 7:42 AM
    Thursday, December 22, 2016 3:35 PM
  • Thank you for solving my problem

    yes you are right I can use new members on the form

    I just wanted to use Object Tag

    Tuesday, December 27, 2016 7:45 AM