예제 #1
0
        public static bool Redim(ref string[] valarr, int iSetSize)
        {
            bool bGood = false;

            if (iSetSize == 0)
            {
                valarr = null;
            }
            else if (iSetSize > 0)
            {
                if (iSetSize != RReporting.SafeLength(valarr))
                {
                    string[] valarrNew = new string[iSetSize];
                    for (int iNow = 0; iNow < iSetSize; iNow++)
                    {
                        if (iNow < RReporting.SafeLength(valarr))
                        {
                            valarrNew[iNow] = valarr[iNow];
                        }
                        else
                        {
                            valarrNew[iNow] = "";
                        }
                    }
                    valarr = valarrNew;
                    bGood  = true;
                }
            }
            else
            {
                string sCallStack = RReporting.StackTraceToLatinCallStack(new System.Diagnostics.StackTrace());
                RReporting.ShowErr("Tried to set " + sCallStack + " maximum strings to less than zero" + " set maximum strings", "setting " + sCallStack + " to negative maximum {iSetSize:" + iSetSize.ToString() + "}");
            }
            return(bGood);
        }        //end Redim(ref string[],...)
예제 #2
0
        }        //end Redim byte[]

        public static bool Redim(ref PictureBox[] arrNow, int iSetSize)
        {
            bool bGood = false;

            if (iSetSize != RReporting.SafeLength(arrNow))
            {
                if (iSetSize <= 0)
                {
                    arrNow = null; bGood = true;
                }
                else
                {
                    try {
                        //bool bGood=false;
                        PictureBox[] arrNew = new PictureBox[iSetSize];
                        for (int iNow = 0; iNow < arrNew.Length; iNow++)
                        {
                            if (iNow < RReporting.SafeLength(arrNow))
                            {
                                arrNew[iNow] = arrNow[iNow];
                            }
                            else
                            {
                                arrNew[iNow] = null;                           //new PictureBox();//null;//Var.Create("",TypeNULL);
                            }
                        }
                        arrNow = arrNew;
                        //bGood=true;
                        //if (!bGood) RReporting.ShowErr("No vars were found while trying to set MaximumSeq!");
                        bGood = true;
                    }
                    catch (Exception e) {
                        bGood = false;
                        string sCallStack = RReporting.StackTraceToLatinCallStack(new System.Diagnostics.StackTrace());
                        RReporting.ShowExn(e, "resizing picture box array", "Redim(PictureBox array)[" + sCallStack + " failed setting PictureBox array Maximum]");
                    }
                }
            }
            else
            {
                bGood = true;
            }
            return(bGood);
        }        //Redim