Click here to Skip to main content
15,905,683 members
Home / Discussions / C#
   

C#

 
GeneralRe: Where Is the Current Free Download Of Visual C# ? Pin
BobJanova24-Mar-14 4:40
BobJanova24-Mar-14 4:40 
GeneralRe: Where Is the Current Free Download Of Visual C# ? Pin
harold aptroot24-Mar-14 7:40
harold aptroot24-Mar-14 7:40 
GeneralRe: Where Is the Current Free Download Of Visual C# ? Pin
BobJanova24-Mar-14 8:07
BobJanova24-Mar-14 8:07 
GeneralRe: Where Is the Current Free Download Of Visual C# ? Pin
Kenneth Haugland24-Mar-14 11:10
mvaKenneth Haugland24-Mar-14 11:10 
QuestionUsing nonce for authentication Pin
TygerBS24-Mar-14 2:21
TygerBS24-Mar-14 2:21 
AnswerRe: Using nonce for authentication Pin
Pete O'Hanlon24-Mar-14 3:17
mvePete O'Hanlon24-Mar-14 3:17 
QuestionDeveloping a C# Project Pin
Bobba Praneeth24-Mar-14 0:09
Bobba Praneeth24-Mar-14 0:09 
AnswerRe: Developing a C# Project Pin
Keith Barrow24-Mar-14 1:23
professionalKeith Barrow24-Mar-14 1:23 
AnswerRe: Developing a C# Project Pin
V.24-Mar-14 3:49
professionalV.24-Mar-14 3:49 
AnswerRe: Developing a C# Project Pin
BobJanova24-Mar-14 3:58
BobJanova24-Mar-14 3:58 
AnswerRe: Developing a C# Project Pin
OriginalGriff24-Mar-14 6:23
mveOriginalGriff24-Mar-14 6:23 
Question[solved] Array of classes nested into array of classes (and serialization) Pin
Mario 5623-Mar-14 22:23
Mario 5623-Mar-14 22:23 
AnswerRe: Array of classes nested into array of classes (and serialization) Pin
Pete O'Hanlon23-Mar-14 22:48
mvePete O'Hanlon23-Mar-14 22:48 
GeneralRe: Array of classes nested into array of classes (and serialization) Pin
Mario 5623-Mar-14 23:43
Mario 5623-Mar-14 23:43 
GeneralRe: Array of classes nested into array of classes (and serialization) Pin
Pete O'Hanlon24-Mar-14 2:23
mvePete O'Hanlon24-Mar-14 2:23 
GeneralRe: Array of classes nested into array of classes (and serialization) Pin
Mario 5624-Mar-14 2:42
Mario 5624-Mar-14 2:42 
GeneralRe: Array of classes nested into array of classes (and serialization) Pin
Pete O'Hanlon24-Mar-14 2:48
mvePete O'Hanlon24-Mar-14 2:48 
GeneralRe: Array of classes nested into array of classes (and serialization) Pin
Mario 5624-Mar-14 5:54
Mario 5624-Mar-14 5:54 
AnswerRe: Array of classes nested into array of classes (and serialization) Pin
BobJanova24-Mar-14 4:14
BobJanova24-Mar-14 4:14 
GeneralRe: Array of classes nested into array of classes (and serialization) Pin
Mario 5624-Mar-14 6:17
Mario 5624-Mar-14 6:17 
GeneralRe: Array of classes nested into array of classes (and serialization) Pin
Mario 5624-Mar-14 7:44
Mario 5624-Mar-14 7:44 
GeneralRe: Array of classes nested into array of classes (and serialization) Pin
BobJanova24-Mar-14 8:05
BobJanova24-Mar-14 8:05 
You still haven't quite got the concept that an instance of Parameters should contain all references to instances of the subclasses. You're storing references to the inner classes in MainForm – that means they're not in the same object tree and really aren't related to the object 'param' you create.

Your MainForm initialisation should just be
private Parameters param = new Parameters();


Parameters.InitParameters should build the instances of products and products.preProcessing – not as local variables it is now. You're currently building arrays in that function that are never assigned to anything and go out of scope immediately.

public void InitParameters()
        {
            autoLockTime = 0;
            screenOffTime = 0;
            loopAutoStartTime = 0;
 
// Don't do this
//          preProcessing[] pp = new preProcessing[10];
            this.pp = new preProcessing[10];
            for (int i = 0; i < 9; i++)
            {
                pp[i] = new preProcessing();
                pp[i].preProcessId = i;
                pp[i].preProcessingName = "";
                for (int j = 0; j < 5; j++) pp[i].preProcessingParms[j] = 0.0;
            }
 
// or this
//          product[] p = new product[30];
            this.p = new product[30];
            for (int i = 0; i < 30; i++)
            {
                p[i] = new product();
                p[i].enabled = false;
                p[i].unit = "mm";
                p[i].productName = "H2O";
                p[i].zero = 0.0;
                p[i].span = 0.0;
                for (int j = 0; j < 10; j++)                    // we can have at max 10 preProcessing for product
                {
                    p[i].preProcessId[j] = 0;
                }
            }
        }


You'll have to add the declarations for p and pp to the Parameters class as I explained in my previous post to make those assignments work.

Now, all you have to do is serialise an instance of Parameters (i.e. MainForm.param), and it will serialise the whole object tree.
GeneralRe: Array of classes nested into array of classes (and serialization) Pin
Mario 5624-Mar-14 10:24
Mario 5624-Mar-14 10:24 
QuestionRegarding Role based Login Pin
Member 1067835223-Mar-14 22:08
Member 1067835223-Mar-14 22:08 
SuggestionRe: Regarding Role based Login Pin
Richard MacCutchan23-Mar-14 23:01
mveRichard MacCutchan23-Mar-14 23:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.