Example #1
0
        public MyTabControl Create(int beginline, int endline, string[] lines)
        {
            MyTabControl o   = new MyTabControl();
            string       key = "Begin TabDlg.SSTab ";

            o.General = VBtoNET.PopulateGeneral(key, lines, beginline, endline);
            // tab pages
            int tabPageNum = Int16.Parse(VBtoNET.GetProperty("Tabs", beginline, endline, lines));


            for (int i = 0; i < tabPageNum; i++)
            {
                MyTabpage page = new MyTabpage();

                page.General = new General();

                page.General.Name            = o.General.Name + "TabPage" + i.ToString();
                page.General.Text            = VBtoNET.GetProperty("TabCaption(" + i.ToString() + ")", beginline, endline, lines);
                page.Padding                 = 3;
                page.General.Tabindex        = i.ToString();
                page.UseVisualStyleBackColor = true;
                // these needs to be fixed a bit, i'm not sure what the size and location should be
                page.General.Locationx = "4";
                page.General.Locationy = "22";
                int sizex = Int16.Parse(o.General.Sizex) - 8;
                int sizey = Int16.Parse(o.General.Sizey) - 26;
                page.General.Sizex = sizex.ToString();
                page.General.Sizey = sizey.ToString();
                o.tabList.Add(page);
            }

            o.ControlNameMap = PopulateControlNamesList(beginline, endline, lines, o.tabList);

            return(o);
        }
Example #2
0
        public static string CreateNETCode(string s, General g, string objectName, List <string> controlVariableArray, List <string> controlFormArray,
                                           List <string> controlGBArray, object parentObj)
        {
            string name = g.Name;

            s += VBtoNET.padding + "'\r";
            s += VBtoNET.padding + "'" + name + "\r";
            s += VBtoNET.padding + "'\r";
            s += VBtoNET.padding + "Me." + name + " = New System.Windows.Forms." + objectName + "()\r";
            s += VBtoNET.padding + "Me." + name + ".Location = new System.Drawing.Point(" + g.Locationx + "," + g.Locationy + ")" + "\r";
            s += VBtoNET.padding + "Me." + name + ".Name = \"" + name + "\"\r";
            s += VBtoNET.padding + "Me." + name + ".Size = new System.Drawing.Size(" + g.Sizex + "," + g.Sizey + ")" + "\r";
            s += VBtoNET.padding + "Me." + name + ".TabIndex = " + g.Tabindex + "\r";
            s += VBtoNET.padding + "Me." + name + ".Text = \"" + g.Text + "\"" + "\r";

            controlVariableArray.Add("Friend WithEvents " + name + " As " + objectName + "\r");

            Type t = parentObj.GetType();

            if (objectName.Equals("TabPage"))
            {
                // don't add to the form if a tabpage
            }
            else if (t.Equals(typeof(MyForm)))
            {
                controlFormArray.Add("Me.Controls.Add(Me." + name + ")\r");
            }
            else if (t.Equals(typeof(MyGroupBox)))
            {
                MyGroupBox gb = (MyGroupBox)parentObj;
                controlGBArray.Add("Me." + gb.General.Name + ".Controls.Add(Me." + name + ")\r");
                //Me.GroupBox1.Controls.Add(Me.TextBox1)
            }
            else if (t.Equals(typeof(MyTabControl)))
            {
                // need to figure out which tabpage it belongs to
                MyTabControl tc     = (MyTabControl)parentObj;
                string       parent = "";
                string       key    = "";
                key = !String.IsNullOrEmpty(g.ArrayName) ? g.ArrayName : g.Name;

                tc.ControlNameMap.TryGetValue(key, out parent);
                controlGBArray.Add("Me." + parent + ".Controls.Add(Me." + name + ")\r");
            }
            return(s);
        }
Example #3
0
        public string Convert(MyTabControl o, string s, List <string> controlVariableArray, List <string> controlFormArray,
                              List <string> controlGBArray, object parentObj)
        {
            string name = o.General.Name;

            s  = VBtoNET.CreateNETCode(s, o.General, "TabControl", controlVariableArray, controlFormArray, controlGBArray, parentObj);
            s += VBtoNET.padding + "Me." + name + ".SelectedIndex = 0\r";
            foreach (MyTabpage page in o.tabList)
            {
                s += VBtoNET.padding + "Me." + name + ".Controls.Add(Me." + page.General.Name + ")\r";
            }
            foreach (MyTabpage page in o.tabList)
            {
                s = VBtoNET.CreateNETCode(s, page.General, "TabPage", controlVariableArray, controlFormArray, controlGBArray, parentObj);
            }



            // do tab pages


            return(s);
        }
Example #4
0
        private void btnExecute_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            try {
                ClearData(false);
                InitNetDesigner();

                int    beginline = 0, endline = 0;
                MyForm form    = new MyForm();
                bool   formEnd = false;


                bool   inGroupBox = false, inTabControl = false;
                string s = "";
                //object parentObj = new object();
                //object priorParentObj = new object();

                for (int i = 0; i < rtbVB.Lines.Count(); i++)
                {
                    mylinenumer = i;        // this is used for debugging

                    if (inGroupBox)         // solves issue of the first control of the group box being skipped
                    {
                        inGroupBox = false; // reset the flag
                        i--;
                    }
                    else if (inTabControl)
                    {
                        inTabControl = false; // reset the flag
                        i--;
                    }
                    else
                    {
                        s = rtbVB.Lines[i];
                    }
                    if (s.Contains("Option Explicit"))
                    {
                        for (int j = i; j < rtbVB.Lines.Count(); j++)
                        {
                            codeText = codeText + rtbVB.Lines[j] + "\r\n";
                        }
                        break;
                    }

                    if (s.Contains("Begin VB.Form"))
                    {
                        beginline = i;
                        do
                        {
                            i++;
                            s = rtbVB.Lines[i];
                            if (i > beginline && s.Contains("Begin"))
                            {
                                formEnd = true;
                            }
                        }while (!formEnd && i < rtbVB.Lines.Count());
                        endline = i;
                        form    = form.CreateForm(beginline, endline, rtbVB.Lines);
                        if (form == null)
                        {
                            return;               // bad parsing, exit
                        }
                        txtFormName.Text = form.General.Name;
                        parentArray.Add((MyForm)form);
                    }

                    if (s.Contains("Begin VB.Frame "))
                    {
                        beginline = i;
                        do
                        {
                            i++;
                            s = rtbVB.Lines[i];
                            if (s.Contains("BeginProperty"))
                            {
                                SkipProperties(i, s);
                            }
                        } while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End ") && (s.Trim().Length >= 6 && !s.Trim().Substring(0, 6).Equals("Begin ")));
                        //while (!s.Trim().Equals("End") && i < rtbVB.Lines.Count() && controlEnd);
                        endline = i;
                        MyGroupBox o = new MyGroupBox();
                        o      = o.Create(beginline, endline, rtbVB.Lines);
                        output = o.Convert(o, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1]);
                        parentArray.Add(o);
                        inGroupBox = true;
                    }
                    else if (s.Contains("Begin VB.CommandButton"))
                    {
                        beginline = i;
                        do
                        {
                            i++;
                            s = rtbVB.Lines[i];
                            if (s.Contains("BeginProperty"))
                            {
                                SkipProperties(i, s);
                            }
                        }while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End "));
                        endline = i;
                        MyButton button = new MyButton();
                        button = button.CreateButton(beginline, endline, rtbVB.Lines);
                        output = button.ConvertButton(button, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1]);
                    }
                    else if (s.Contains("Begin VB.CheckBox"))
                    {
                        beginline = i;
                        do
                        {
                            i++;
                            s = rtbVB.Lines[i];
                            if (s.Contains("BeginProperty"))
                            {
                                SkipProperties(i, s);
                            }
                        } while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End "));
                        endline = i;
                        MyCheckbox c = new MyCheckbox();
                        c      = c.CreateCheckbox(beginline, endline, rtbVB.Lines);
                        output = c.ConvertCheckbox(c, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1]);
                    }
                    else if (s.Contains("Begin VB.Label"))
                    {
                        beginline = i;
                        do
                        {
                            i++;
                            s = rtbVB.Lines[i];
                            if (s.Contains("BeginProperty"))
                            {
                                SkipProperties(i, s);
                            }
                        } while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End "));
                        endline = i;
                        MyLabel l = new MyLabel();
                        l      = l.Create(beginline, endline, rtbVB.Lines);
                        output = l.Convert(l, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1]);
                    }
                    else if (s.Contains("Begin VB.TextBox"))
                    {
                        beginline = i;
                        do
                        {
                            i++;
                            s = rtbVB.Lines[i];
                            if (s.Contains("BeginProperty"))
                            {
                                SkipProperties(i, s);
                            }
                        }while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End "));
                        endline = i;
                        MyTextbox o = new MyTextbox();
                        o      = o.Create(beginline, endline, rtbVB.Lines);
                        output = o.Convert(o, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1], datasourceArray);
                    }
                    else if (s.Contains("Begin MSDBCtls.DBCombo"))
                    {
                        beginline = i;
                        do
                        {
                            i++;
                            s = rtbVB.Lines[i];
                            if (s.Contains("BeginProperty"))
                            {
                                SkipProperties(i, s);
                            }
                        }while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End "));
                        endline = i;
                        MyCombobox o = new MyCombobox();
                        o      = o.Create(beginline, endline, rtbVB.Lines);
                        output = o.Convert(o, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1], datasourceArray);
                    }
                    else if (s.Contains("Begin VB.ListBox") || s.Contains("Begin MSDBCtls.DBList"))
                    {
                        beginline = i;
                        do
                        {
                            i++;
                            s = rtbVB.Lines[i];
                            if (s.Contains("BeginProperty"))
                            {
                                SkipProperties(i, s);
                            }
                        }while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End "));
                        endline = i;
                        MyListbox o = new MyListbox();
                        o      = o.Create(beginline, endline, rtbVB.Lines);
                        output = o.Convert(o, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1]);
                    }
                    else if (s.Contains("Begin TabDlg.SSTab "))     // tab control
                    {
                        beginline = i;
                        do
                        {
                            i++;
                            s = rtbVB.Lines[i];
                            if (s.Contains("BeginProperty"))
                            {
                                SkipProperties(i, s);
                            }
                        } while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End ") && (s.Trim().Length >= 6 && !s.Trim().Substring(0, 6).Equals("Begin ")));
                        endline = i;
                        MyTabControl o = new MyTabControl();
                        o      = o.Create(beginline, endline, rtbVB.Lines);
                        output = o.Convert(o, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1]);
                        parentArray.Add(o);
                        inTabControl = true; // not sure if we need another variable specifically for tabcontrols.
                    }
                    else if (s.Contains("Begin MSDBGrid.DBGrid"))
                    {
                        beginline = i;
                        do
                        {
                            i++;
                            s = rtbVB.Lines[i];
                            if (s.Contains("BeginProperty"))
                            {
                                SkipProperties(i, s);
                            }
                        }while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End "));
                        endline = i;
                        MyDatagridview o = new MyDatagridview();
                        o      = o.Create(beginline, endline, rtbVB.Lines);
                        output = o.Convert(o, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1]);
                    }
                    else if (s.Contains("Begin VB.OptionButton"))
                    {
                        beginline = i;
                        do
                        {
                            i++;
                            s = rtbVB.Lines[i];
                            if (s.Contains("BeginProperty"))
                            {
                                SkipProperties(i, s);
                            }
                        }while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End "));
                        endline = i;
                        MyRadioButton o = new MyRadioButton();
                        o      = o.Create(beginline, endline, rtbVB.Lines);
                        output = o.Convert(o, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1]);
                    }
                    else if (s.Contains("Begin ComctlLib.ListView"))
                    {
                        beginline = i;
                        do
                        {
                            i++;
                            s = rtbVB.Lines[i];
                            if (s.Contains("BeginProperty"))
                            {
                                SkipProperties(i, s);
                            }
                        }while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End "));
                        endline = i;
                        MyDatagridview o = new MyDatagridview("Begin ComctlLib.ListView");
                        o      = o.Create(beginline, endline, rtbVB.Lines);
                        output = o.Convert(o, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1]);
                    }
                    else if (s.Contains("Begin"))    // catches and removes unsupported things.

                    {
                        bool knownControl = false;
                        foreach (string ctrl in controlTypeList)
                        {
                            if (s.Contains(ctrl))
                            {
                                knownControl = true;
                            }
                        }
                        do
                        {
                            i++;
                            s = rtbVB.Lines[i];
                            if (s.Contains("BeginProperty"))
                            {
                                SkipProperties(i, s);
                            }
                        } while (!knownControl && i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End "));
                    }


                    if (s.Trim().Equals("End") && rtbVB.Lines[i - 1].Trim().Equals("End")) // two Ends alone means end of a parent
                    {
                        // end of group box
                        if (parentArray.Count > 0)
                        {
                            parentArray.RemoveAt(parentArray.Count - 1); //pop
                        }
                        foreach (string ctrlstr in controlGBArray)
                        {
                            output += VBtoNET.padding + ctrlstr;
                        }

                        controlGBArray = new List <string>();
                    }
                }
                // set up form
                output = form.ConvertForm(form, output, controlFormArray);

                // end the file
                EndDesigner();
                this.Cursor = Cursors.Arrow;
                Clipboard.SetText(rtbNET.Text);
            } catch (Exception ex) {
                this.Cursor = Cursors.Arrow;
                MessageBox.Show("Exception in VB6 Parsing line: " + this.mylinenumer.ToString() + " " + ex.Message);
            }
        }
Example #5
0
        public MyTabControl Create(int beginline, int endline, string[] lines)
        {
            MyTabControl o   = new MyTabControl();
            string       key = "Begin TabDlg.SSTab ";

            o.General = VBtoNET.PopulateGeneral(key, lines, beginline, endline);
            // tab pages
            string tabPageNumStr = VBtoNET.GetProperty("Tabs", beginline, endline, lines);
            int    tabPageCount  = 0;

            if (tabPageNumStr == "")
            {
                bool foundTab = true;
                // can't find the tabs property
                for (int tabnum = 0; tabnum < 20; tabnum++)
                {
                    if (!foundTab)
                    {
                        break;
                    }
                    for (int i = beginline; i < endline; i++)
                    {
                        string s = lines[i];
                        if (s.Contains("Tab(" + tabnum.ToString()))
                        {
                            tabPageCount++;
                            break;
                        }
                        if (i == endline - 1)
                        {
                            foundTab = false;
                            break;
                        }
                    }
                }
            }
            else
            {
                tabPageCount = Int16.Parse(tabPageNumStr);
            }


            for (int i = 0; i < tabPageCount; i++)
            {
                MyTabpage page = new MyTabpage();

                page.General = new General();

                page.General.Name            = o.General.Name + "TabPage" + i.ToString();
                page.General.Text            = VBtoNET.GetProperty("TabCaption(" + i.ToString() + ")", beginline, endline, lines);
                page.Padding                 = 3;
                page.General.Tabindex        = i.ToString();
                page.UseVisualStyleBackColor = true;
                // these needs to be fixed a bit, i'm not sure what the size and location should be
                page.General.Locationx = "4";
                page.General.Locationy = "22";
                int sizex = Int16.Parse(o.General.Sizex) - 8;
                int sizey = Int16.Parse(o.General.Sizey) - 26;
                page.General.Sizex = sizex.ToString();
                page.General.Sizey = sizey.ToString();
                o.tabList.Add(page);
            }

            o.ControlNameMap = PopulateControlNamesList(beginline, endline, lines, o.tabList);

            return(o);
        }
Example #6
0
        private void btnExecute_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            //try {
            rtbNET.Text = "";

            InitNetDesigner();
            int    beginline = 0, endline = 0;
            MyForm form    = new MyForm();
            bool   formEnd = false;


            bool   inGroupBox = false, inTabControl = false;
            string s = "";

            //object parentObj = new object();
            //object priorParentObj = new object();

            for (int i = 0; i < rtbVB.Lines.Count(); i++)
            {
                if (inGroupBox)         // solves issue of the first control of the group box being skipped
                {
                    inGroupBox = false; // reset the flag
                    i--;
                }
                else if (inTabControl)
                {
                    inTabControl = false; // reset the flag
                    i--;
                }
                else
                {
                    s = rtbVB.Lines[i];
                }

                if (s.Contains("Begin VB.Form"))
                {
                    beginline = i;
                    do
                    {
                        i++;
                        s = rtbVB.Lines[i];
                        if (i > beginline && s.Contains("Begin"))
                        {
                            formEnd = true;
                        }
                    }while (!formEnd && i < rtbVB.Lines.Count());
                    endline = i;
                    form    = form.CreateForm(beginline, endline, rtbVB.Lines);

                    if (form.General == null || String.IsNullOrEmpty(form.General.Name))
                    {
                        MessageBox.Show("Trouble parsing VB form, did you input a VB .frm file?");
                        return;
                    }
                    txtFormName.Text = form.General.Name;
                    parentArray.Add((MyForm)form);
                }

                if (s.Contains("Begin VB.Frame "))
                {
                    beginline = i;
                    do
                    {
                        i++;
                        s = rtbVB.Lines[i];
                        if (s.Contains("BeginProperty"))
                        {
                            SkipProperties(i, s);
                        }
                    } while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End ") && (s.Trim().Length >= 6 && !s.Trim().Substring(0, 6).Equals("Begin ")));
                    //while (!s.Trim().Equals("End") && i < rtbVB.Lines.Count() && controlEnd);
                    endline = i;
                    MyGroupBox o = new MyGroupBox();
                    o      = o.Create(beginline, endline, rtbVB.Lines);
                    output = o.Convert(o, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1]);
                    parentArray.Add(o);
                    inGroupBox = true;
                }
                else if (s.Contains("Begin VB.CommandButton"))
                {
                    beginline = i;
                    do
                    {
                        i++;
                        s = rtbVB.Lines[i];
                        if (s.Contains("BeginProperty"))
                        {
                            SkipProperties(i, s);
                        }
                    }while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End "));
                    endline = i;
                    MyButton button = new MyButton();
                    button = button.CreateButton(beginline, endline, rtbVB.Lines);
                    output = button.ConvertButton(button, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1]);
                }
                else if (s.Contains("Begin VB.CheckBox"))
                {
                    beginline = i;
                    do
                    {
                        i++;
                        s = rtbVB.Lines[i];
                        if (s.Contains("BeginProperty"))
                        {
                            SkipProperties(i, s);
                        }
                    } while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End "));
                    endline = i;
                    MyCheckbox c = new MyCheckbox();
                    c      = c.CreateCheckbox(beginline, endline, rtbVB.Lines);
                    output = c.ConvertCheckbox(c, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1]);
                }
                else if (s.Contains("Begin VB.Label"))
                {
                    beginline = i;
                    do
                    {
                        i++;
                        s = rtbVB.Lines[i];
                        if (s.Contains("BeginProperty"))
                        {
                            SkipProperties(i, s);
                        }
                    } while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End "));
                    endline = i;
                    MyLabel l = new MyLabel();
                    l      = l.Create(beginline, endline, rtbVB.Lines);
                    output = l.Convert(l, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1]);
                }
                else if (s.Contains("Begin VB.TextBox"))
                {
                    beginline = i;
                    do
                    {
                        i++;
                        s = rtbVB.Lines[i];
                        if (s.Contains("BeginProperty"))
                        {
                            SkipProperties(i, s);
                        }
                    }while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End "));
                    endline = i;
                    MyTextbox o = new MyTextbox();
                    o      = o.Create(beginline, endline, rtbVB.Lines);
                    output = o.Convert(o, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1]);
                }
                else if (s.Contains("Begin MSDBCtls.DBCombo"))
                {
                    beginline = i;
                    do
                    {
                        i++;
                        s = rtbVB.Lines[i];
                        if (s.Contains("BeginProperty"))
                        {
                            SkipProperties(i, s);
                        }
                    }while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End "));
                    endline = i;
                    MyCombobox o = new MyCombobox();
                    o      = o.Create(beginline, endline, rtbVB.Lines);
                    output = o.Convert(o, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1]);
                }
                else if (s.Contains("Begin VB.ListBox") || s.Contains("Begin MSDBCtls.DBList"))
                {
                    beginline = i;
                    do
                    {
                        i++;
                        s = rtbVB.Lines[i];
                        if (s.Contains("BeginProperty"))
                        {
                            SkipProperties(i, s);
                        }
                    }while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End "));
                    endline = i;
                    MyListbox o = new MyListbox();
                    o      = o.Create(beginline, endline, rtbVB.Lines);
                    output = o.Convert(o, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1]);
                }
                else if (s.Contains("Begin TabDlg.SSTab "))     // tab control
                {
                    beginline = i;
                    do
                    {
                        i++;
                        s = rtbVB.Lines[i];
                        if (s.Contains("BeginProperty"))
                        {
                            SkipProperties(i, s);
                        }
                    } while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End ") && (s.Trim().Length >= 6 && !s.Trim().Substring(0, 6).Equals("Begin ")));
                    endline = i;
                    MyTabControl o = new MyTabControl();
                    o      = o.Create(beginline, endline, rtbVB.Lines);
                    output = o.Convert(o, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1]);
                    parentArray.Add(o);
                    inTabControl = true; // not sure if we need another variable specifically for tabcontrols.
                }
                else if (s.Contains("Begin MSDBGrid.DBGrid"))
                {
                    beginline = i;
                    do
                    {
                        i++;
                        s = rtbVB.Lines[i];
                        if (s.Contains("BeginProperty"))
                        {
                            SkipProperties(i, s);
                        }
                    }while (i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End "));
                    endline = i;
                    MyDatagridview o = new MyDatagridview();
                    o      = o.Create(beginline, endline, rtbVB.Lines);
                    output = o.Convert(o, output, controlVariableArray, controlFormArray, controlGBArray, parentArray[parentArray.Count - 1]);
                }
                else if (s.Contains("Begin"))      // catches and removes unsupported things.

                {
                    bool knownControl = false;
                    foreach (string ctrl in controlTypeList)
                    {
                        if (s.Contains(ctrl))
                        {
                            knownControl = true;
                        }
                    }
                    do
                    {
                        i++;
                        s = rtbVB.Lines[i];
                        if (s.Contains("BeginProperty"))
                        {
                            SkipProperties(i, s);
                        }
                    } while (!knownControl && i < rtbVB.Lines.Count() && s.Trim().Length >= 4 && !s.Trim().Substring(0, 4).Equals("End "));
                }

                if (s.Trim().Equals("End") && rtbVB.Lines[i - 1].Trim().Equals("End")) // two Ends alone means end of a parent
                {
                    if (i > 1500 || parentArray.Count == 1)
                    {
                        string foo = "bar";
                    }


                    // end of group box
                    parentArray.RemoveAt(parentArray.Count - 1); //pop
                    foreach (string ctrlstr in controlGBArray)
                    {
                        output += VBtoNET.padding + ctrlstr;
                    }

                    controlGBArray = new List <string>();
                }
            }
            // set up form


            output = form.ConvertForm(form, output, controlFormArray);
            if (String.IsNullOrEmpty(output))
            {
                MessageBox.Show("Trouble parsing VB form, did you input a VB .frm file?");
                return;
            }
            // end the file
            EndDesigner();
            this.Cursor = Cursors.Arrow;
            //} catch (Exception ex) {
            //    this.Cursor = Cursors.Arrow;
            //    MessageBox.Show("Exception in VB6 Parsing: " + ex.Message);
            //}
        }