示例#1
0
        private void FillComplex(ComplexStruct cs)
        {
            string temp = "";

            txtIntVal.Text   = cs.intVal.ToString();
            temp             = cs.dintArray[0].ToString() + "," + cs.dintArray[1].ToString() + ",";
            temp             = temp + cs.dintArray[2].ToString() + "," + cs.dintArray[3].ToString() + "," + cs.dintArray[4].ToString();
            txtDintVal.Text  = temp;
            txtBoolVal.Text  = cs.boolVal.ToString();
            txtByteVal.Text  = cs.byteVal.ToString();
            txtStr1Val.Text  = cs.stringVal.ToString();
            txtLrealVal.Text = cs.lrealVal.ToString();

            txtSimpleDint.Text  = cs.simple.dintVal.ToString();
            txtSimpleLreal.Text = cs.simple.lrealVal.ToString();
        }
示例#2
0
        private ComplexStruct GetStruct()
        {
            ComplexStruct cs = new ComplexStruct();

            cs.intVal = short.Parse(txtIntVal.Text);
            string[] str = txtDintVal.Text.Split(new char[] { ',' });
            for (int i = 0; i < str.Length; i++)
            {
                cs.dintArray[i] = int.Parse(str[i]);
            }
            cs.boolVal = Boolean.Parse(txtBoolVal.Text);

            cs.byteVal         = byte.Parse(txtByteVal.Text);
            cs.lrealVal        = double.Parse(txtLrealVal.Text);
            cs.stringVal       = txtStr1Val.Text;
            cs.simple.lrealVal = double.Parse(txtSimpleLreal.Text);
            cs.simple.dintVal  = int.Parse(txtSimpleDint.Text);
            return(cs);
        }