Ejemplo n.º 1
0
        public string ConvertButton(MyButton b, string s, List <string> controlVariableArray, List <string> controlFormArray,
                                    List <string> controlGBArray, object parentObj)
        {
            string name = b.General.Name;

            s = VBtoNET.CreateNETCode(s, b.General, "Button", controlVariableArray, controlFormArray, controlGBArray, parentObj);

            s += VBtoNET.padding + "Me." + name + ".UseVisualStyleBackColor = " + b.UseVisualStyleBackColor1.ToString() + "\r";

            //Me.Button1 = New System.Windows.Forms.Button()
            //Me.SuspendLayout()
            //'
            //'Button1
            //'
            //Me.Button1.Location = New System.Drawing.Point(34, 79)
            //Me.Button1.Name = "Button1"
            //Me.Button1.Size = New System.Drawing.Size(75, 23)
            //Me.Button1.TabIndex = 0
            //Me.Button1.Text = "Button1"
            //Me.Button1.UseVisualStyleBackColor = True

            // TODO rest of it



            //Friend WithEvents Button1 As Button

            // do these get updated??


            return(s);
        }
Ejemplo n.º 2
0
        private Dictionary <string, string> PopulateControlNamesList(int beginline, int endline, string[] lines, List <MyTabpage> tabList)
        {
            controlNameMap = new Dictionary <string, string>();
            for (int i = 0; i < tabList.Count; i++)
            {
                for (int j = 0; j < 99; j++)
                {
                    string key   = VBtoNET.GetProperty("Tab(" + i.ToString() + ").Control(" + j.ToString() + ")", beginline, endline, lines);
                    string value = tabList[i].General.Name;
                    if (!String.IsNullOrEmpty(key))
                    {
                        //if (VBtoNET.controlNameList.Contains(key)) {
                        //    // its an array
                        //    key = key + beginline.ToString(); // odd but guarantees uniqueness

                        //}
                        controlNameMap.Add(key, value);
                    }
                    else
                    {
                        break;
                    }
                }
            }

            return(controlNameMap);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        public static General PopulateGeneral(string key, string[] lines, int beginline, int endline)
        {
            General g = new General();

            int pos = lines[beginline].IndexOf(key) + key.Length;

            string name = lines[beginline].Substring(pos).Trim();

            // check if its a control array - same name
            string index = VBtoNET.GetProperty(" Index", beginline, endline, lines);

            if (!String.IsNullOrEmpty(index))
            {
                // its an array
                g.ArrayName = name + "(" + index + ")";
                name        = name + index; // odd but guarantees uniqueness
            }

            //controlNameList.Add(name);
            g.Name = name;

            g.Sizey     = VBtoNET.GetProperty("Height", beginline, endline, lines);
            g.Locationx = VBtoNET.GetProperty("Left", beginline, endline, lines);
            g.Tabindex  = VBtoNET.GetProperty("TabIndex", beginline, endline, lines);
            g.Locationy = VBtoNET.GetProperty("Top", beginline, endline, lines);
            g.Sizex     = VBtoNET.GetProperty("Width", beginline, endline, lines);
            g.Text      = VBtoNET.GetProperty("Caption", beginline, endline, lines);

            g = g.FixSizes(g);
            return(g);
        }
Ejemplo n.º 5
0
        public MyForm CreateForm(int beginline, int endline, string[] lines)
        {
            MyForm  frm = new MyForm();
            General g   = new General();

            try
            {
                string key = "Begin VB.Form ";
                int    pos = lines[beginline].IndexOf(key) + key.Length;

                string name = lines[beginline].Substring(pos).Trim();
                g.Name = name;


                g.Sizex = VBtoNET.GetProperty("ClientWidth", beginline, endline, lines);
                g.Sizey = VBtoNET.GetProperty("ClientHeight", beginline, endline, lines);

                g.Text = VBtoNET.GetProperty("Caption", beginline, endline, lines);
                if (String.IsNullOrEmpty(g.Text))
                {
                    g.Text = name;
                }

                g.FixSizes(g);
                frm.General = g;
            }
            catch (Exception e)
            {
                MessageBox.Show("General error - did you load a VB6 form?");
                return(null);
            }
            return(frm);
        }
Ejemplo n.º 6
0
        public string Convert(MyTextbox o, string s, List <string> controlVariableArray, List <string> controlFormArray,
                              List <string> controlGBArray, object parentObj, List <string> datasourceArray)
        {
            string name = o.General.Name;

            s = VBtoNET.CreateNETCode(s, o.General, "TextBox", controlVariableArray, controlFormArray, controlGBArray, parentObj);

            s += VBtoNET.padding + "Me." + name + ".Text = \"" + o.General.Text + "\"" + "\r";
            s += VBtoNET.padding + "Me." + name + ".Multiline = " + multiline.ToString() + "" + "\r";
            if (!String.IsNullOrEmpty(o.dataField))
            {
                s += VBtoNET.padding + "'Datafield = \"" + o.dataField + "\"" + "\r";
            }
            if (!String.IsNullOrEmpty(o.dataSource))
            {
                s += VBtoNET.padding + "'Datasource = \"" + o.dataSource + "\"" + "\r";
            }

            if (!String.IsNullOrEmpty(o.dataSource) && !String.IsNullOrEmpty(o.dataField))
            {
                datasourceArray.Add(name + ".Text = " + o.dataSource.Replace("rdc", "dt") + ".Rows(0)(\"" + o.dataField + "\").toString");
            }

            return(s);
        }
Ejemplo n.º 7
0
        public MyCombobox Create(int beginline, int endline, string[] lines)
        {
            MyCombobox o = new MyCombobox();

            string key = "Begin MSDBCtls.DBCombo ";

            o.General = VBtoNET.PopulateGeneral(key, lines, beginline, endline);
            return(o);
        }
Ejemplo n.º 8
0
        public MyRadioButton Create(int beginline, int endline, string[] lines)
        {
            MyRadioButton o   = new MyRadioButton();
            string        key = "Begin VB.OptionButton ";

            o.General = VBtoNET.PopulateGeneral(key, lines, beginline, endline);

            return(o);
        }
Ejemplo n.º 9
0
        public MyGroupBox Create(int beginline, int endline, string[] lines)
        {
            MyGroupBox o   = new MyGroupBox();
            string     key = "Begin VB.Frame ";

            o.General = VBtoNET.PopulateGeneral(key, lines, beginline, endline);

            return(o);
        }
Ejemplo n.º 10
0
        public MyCheckbox CreateCheckbox(int beginline, int endline, string[] lines)
        {
            MyCheckbox o   = new MyCheckbox();
            string     key = "Begin VB.CheckBox ";

            o.General = VBtoNET.PopulateGeneral(key, lines, beginline, endline);
            o.UseVisualStyleBackColor1 = true;
            return(o);
        }
Ejemplo n.º 11
0
        public string Convert(MyCombobox 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, "ComboBox", controlVariableArray, controlFormArray, controlGBArray, parentObj);

            return(s);
        }
Ejemplo n.º 12
0
        public string Convert(MyListbox 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, "ListBox", controlVariableArray, controlFormArray, controlGBArray, parentObj);
            s += VBtoNET.padding + "Me." + name + ".FormattingEnabled = True\r";

            return(s);
        }
Ejemplo n.º 13
0
        public string ConvertCheckbox(MyCheckbox c, string s, List <string> controlVariableArray, List <string> controlFormArray,
                                      List <string> controlGBArray, object parentObj)
        {
            string name = c.General.Name;

            s = VBtoNET.CreateNETCode(s, c.General, "CheckBox", controlVariableArray, controlFormArray, controlGBArray, parentObj);


            return(s);
        }
Ejemplo n.º 14
0
        public string Convert(MyDatagridview l, string s, List <string> controlVariableArray, List <string> controlFormArray,
                              List <string> controlGBArray, object parentObj)
        {
            string name = l.General.Name;

            s = VBtoNET.CreateNETCode(s, l.General, "DataGridView", controlVariableArray, controlFormArray, controlGBArray, parentObj);

            s += VBtoNET.padding + "Me." + name + ".ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize\r";

            return(s);
        }
Ejemplo n.º 15
0
        public string Convert(MyRadioButton 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, "RadioButton", controlVariableArray, controlFormArray, controlGBArray, parentObj);

            s += VBtoNET.padding + "Me." + name + ".Text = \"" + o.General.Text + "\"" + "\r";

            return(s);
        }
Ejemplo n.º 16
0
        public MyCombobox Create(int beginline, int endline, string[] lines)
        {
            MyCombobox o = new MyCombobox();

            string key = "Begin MSDBCtls.DBCombo ";

            o.General    = VBtoNET.PopulateGeneral(key, lines, beginline, endline);
            o.dataSource = VBtoNET.GetProperty("DataSource", beginline, endline, lines);
            o.dataField  = VBtoNET.GetProperty("DataField", beginline, endline, lines);

            return(o);
        }
Ejemplo n.º 17
0
        public MyButton CreateButton(int beginline, int endline, string[] lines)
        {
            MyButton o = new MyButton();

            o.General = VBtoNET.PopulateGeneral("Begin VB.CommandButton ", lines, beginline, endline);

            if (String.IsNullOrEmpty(o.General.Text))
            {
                o.General.Text = o.General.Name;
            }

            o.UseVisualStyleBackColor1 = true;
            return(o);
        }
Ejemplo n.º 18
0
        public MyListbox Create(int beginline, int endline, string[] lines)
        {
            MyListbox o = new MyListbox();

            if (lines[beginline].Contains("MSDBCtls.DBList "))
            {
                o.General = VBtoNET.PopulateGeneral("Begin MSDBCtls.DBList ", lines, beginline, endline);
            }
            else
            {
                o.General = VBtoNET.PopulateGeneral("Begin VB.ListBox ", lines, beginline, endline);
            }


            return(o);
        }
Ejemplo n.º 19
0
        public MyDatagridview Create(int beginline, int endline, string[] lines)
        {
            MyDatagridview o   = new MyDatagridview();
            string         key = "Begin MSDBGrid.DBGrid ";

            o.General = VBtoNET.PopulateGeneral(key, lines, beginline, endline);
            if (String.IsNullOrEmpty(o.General.Text))
            {
                o.General.Text = o.General.Name;
            }

            int sizex = Int16.Parse(o.General.Sizex);

            o.General.Sizex = sizex.ToString();
            return(o);
        }
Ejemplo n.º 20
0
        public string Convert(MyDatagridview l, string s, List <string> controlVariableArray, List <string> controlFormArray,
                              List <string> controlGBArray, object parentObj)
        {
            string name = l.General.Name;

            s = VBtoNET.CreateNETCode(s, l.General, "DataGridView", controlVariableArray, controlFormArray, controlGBArray, parentObj);

            s += VBtoNET.padding + "Me." + name + ".ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize\r";
            s += VBtoNET.padding + "Me." + name + ".AllowUserToAddRows = False\r";
            s += VBtoNET.padding + "Me." + name + ".AllowUserToDeleteRows = False\r";
            s += VBtoNET.padding + "Me." + name + ".MultiSelect = False\r";
            s += VBtoNET.padding + "Me." + name + ".ReadOnly = True\r";
            s += VBtoNET.padding + "Me." + name + ".SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect\r";

            return(s);
        }
Ejemplo n.º 21
0
        public MyLabel Create(int beginline, int endline, string[] lines)
        {
            MyLabel o   = new MyLabel();
            string  key = "Begin VB.Label ";

            o.General = VBtoNET.PopulateGeneral(key, lines, beginline, endline);
            if (String.IsNullOrEmpty(o.General.Text))
            {
                o.General.Text = o.General.Name;
            }

            int sizex = Int16.Parse(o.General.Sizex);

            sizex          += 10; // the font or size is a bit off in the conversion
            o.General.Sizex = sizex.ToString();
            return(o);
        }
Ejemplo n.º 22
0
        public MyTextbox Create(int beginline, int endline, string[] lines)
        {
            MyTextbox o   = new MyTextbox();
            string    key = "Begin VB.TextBox ";

            o.General = VBtoNET.PopulateGeneral(key, lines, beginline, endline);
            string multi = VBtoNET.GetProperty("MultiLine", beginline, endline, lines);

            if (multi.Contains("-1"))
            {
                o.Multiline = true;
            }
            o.dataSource = VBtoNET.GetProperty("DataSource", beginline, endline, lines);
            o.dataField  = VBtoNET.GetProperty("DataField", beginline, endline, lines);

            return(o);
        }
Ejemplo n.º 23
0
        public string Convert(MyTextbox 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, "TextBox", controlVariableArray, controlFormArray, controlGBArray, parentObj);

            s += VBtoNET.padding + "Me." + name + ".Text = \"" + o.General.Text + "\"" + "\r";
            s += VBtoNET.padding + "Me." + name + ".Multiline = " + multiline.ToString() + "" + "\r";

            if (!String.IsNullOrEmpty(o.dataField) || !String.IsNullOrEmpty(o.dataSource))
            {
                string dataBindingInfo = VBtoNET.padding + name + ".Text = ";
                dataBindingInfo += o.dataSource.Replace("rdc", "dt") + ".Rows(0)(";
                dataBindingInfo += "\"" + o.dataField + "\").ToString\r";
                //TxtLocType.Text = dtPhantomLocation.Rows(0)("LocType").ToString
                VBtoNET.controlDBList.Add(dataBindingInfo);
            }

            return(s);
        }
Ejemplo n.º 24
0
        public string Convert(MyGroupBox 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, "GroupBox", controlVariableArray, controlFormArray, controlGBArray, parentObj);



            //    '
            //'ListBox1
            //'
            //Me.ListBox1.FormattingEnabled = True
            //Me.ListBox1.Location = New System.Drawing.Point(131, 24)
            //Me.ListBox1.Name = "ListBox1"
            //Me.ListBox1.Size = New System.Drawing.Size(120, 43)
            //Me.ListBox1.TabIndex = 5


            //controlVariableArray.Add("Friend WithEvents " + name + " As GroupBox\r");
            //controlFormArray.Add("Me.Controls.Add(Me." + name + ")\r");
            return(s);
        }
Ejemplo n.º 25
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);
        }
Ejemplo n.º 26
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);
        }