问:
Why does Visual Studio 2017 keep changing my public static statements to "public" after I change any aspect of any object on a form in C#
I've posted my code. Every single time I change anything on my this form in my Windows Forms App in C#, it changes my "public static" changes at the end to just "public" and then it adds "this." to every single reference to them. My code seems to run fine after I edit it again, but this is really annoying. I just wanted to make sure I'm not missing something or taking a poor approach to this.

The reason I am using public static statements is because I am modifying some Textboxes and a DataGridView object on my main form from other forms - i.e. looking up customer info from a database in one form and then entering the data on the main form to write up an order, and taking shopping cart information from a WebBrowser control on one form and putting it into a DataGridView object on another form. If this isn't how to accomplish populating forms from another form please tell me how and be as specific as possible as I am quite new to C#. Sorry if I've posted too much code - this is almost everything from my form1.cs file and I didn't know what (if anything) that I have here is causing the problem. The relevant "public static" statements are at the end.

(AFTER I WROTE THIS - I looked up another thread where someone said that forms are supposed to be a "specific instantiation" and that is why the developer environment keeps taking out the "static"). That being the case... HELP!! I do not understand how to change the values on one form from another form and I absolutely need to do so. - this code works, but I guess it's bad practice? - Completely lost and need very specific instructions to make this work)

Thanks in advance!!!

```namespace WindowsFormsApp1
{
    public partial class frmMain
    {
        private System.ComponentModel.IContainer components = null;

    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region Windows Form Designer generated code

    private void InitializeComponent()
    {
        this.cmdSendEmail = new System.Windows.Forms.Button();
        this.cmdExit = new System.Windows.Forms.Button();
        this.cmdLookup = new System.Windows.Forms.Button();
        this.txtTransactionNumber = new System.Windows.Forms.TextBox();
        this.cmdEdit = new System.Windows.Forms.Button();
        this.groupBox1 = new System.Windows.Forms.GroupBox();
        this.cmdBrowse = new System.Windows.Forms.Button();
        this.groupBox2 = new System.Windows.Forms.GroupBox();
        this.cmdCustomer = new System.Windows.Forms.Button();
        this.txtNotes = new System.Windows.Forms.TextBox();
        txtZip = new System.Windows.Forms.TextBox();
        txtCountry = new System.Windows.Forms.TextBox();
        txtState = new System.Windows.Forms.TextBox();
        txtCity = new System.Windows.Forms.TextBox();
        txtAddress = new System.Windows.Forms.TextBox();
        txtName = new System.Windows.Forms.TextBox();
        txtPayPalEmail = new System.Windows.Forms.TextBox();
        txtEmail = new System.Windows.Forms.TextBox();
        txtPhone = new System.Windows.Forms.TextBox();
        txtLast = new System.Windows.Forms.TextBox();
        txtFirst = new System.Windows.Forms.TextBox();
        grdOrderItems = new System.Windows.Forms.DataGridView();
        this.Qty = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.Description = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.UnitPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.ExtPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.SCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.Options1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.Options2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.groupBox3 = new System.Windows.Forms.GroupBox();
        this.lblSubTotal = new System.Windows.Forms.Label();
        this.lblTotal = new System.Windows.Forms.Label();
        this.txtTax = new System.Windows.Forms.TextBox();
        this.txtShipping = new System.Windows.Forms.TextBox();
        this.txtShippingMethod = new System.Windows.Forms.TextBox();
        this.cmdTaxLookup = new System.Windows.Forms.Button();
        this.lstShipping = new System.Windows.Forms.ListBox();
        this.cmdBrowser = new System.Windows.Forms.Button();
        this.groupBox4 = new System.Windows.Forms.GroupBox();
        this.cmdSendRequest = new System.Windows.Forms.Button();
        this.cmdClear = new System.Windows.Forms.Button();
        this.cmdSave = new System.Windows.Forms.Button();
        this.cmdPrint = new System.Windows.Forms.Button();
        this.cmdSavePrintEmail = new System.Windows.Forms.Button();
        this.groupBox1.SuspendLayout();
        this.groupBox2.SuspendLayout();
        ((System.ComponentModel.ISupportInitialize)(grdOrderItems)).BeginInit();
        this.groupBox3.SuspendLayout();
        this.groupBox4.SuspendLayout();
        this.SuspendLayout();
        //
        // cmdLookup
        //
        this.cmdLookup.Location = new System.Drawing.Point(88, 15);
        this.cmdLookup.Name = "cmdLookup";
        this.cmdLookup.Size = new System.Drawing.Size(197, 33);
        this.cmdLookup.TabIndex = 3;
        this.cmdLookup.Text = "Look up order to attach request to";
        this.cmdLookup.UseVisualStyleBackColor = true;
        //
        // txtTransactionNumber
        //
        this.txtTransactionNumber.Location = new System.Drawing.Point(91, 57);
        this.txtTransactionNumber.Name = "txtTransactionNumber";
        this.txtTransactionNumber.Size = new System.Drawing.Size(158, 20);
        this.txtTransactionNumber.TabIndex = 5;
        //
        // cmdEdit
        //
        this.cmdEdit.Location = new System.Drawing.Point(260, 57);
        this.cmdEdit.Name = "cmdEdit";
        this.cmdEdit.Size = new System.Drawing.Size(87, 30);
        this.cmdEdit.TabIndex = 6;
        this.cmdEdit.Text = "Edit";
        this.cmdEdit.UseVisualStyleBackColor = true;
        //
        //
        // groupBox1
        //
        this.groupBox1.Location = new System.Drawing.Point(438, 125);
        this.groupBox1.Name = "groupBox1";
        this.groupBox1.Size = new System.Drawing.Size(345, 56);
        this.groupBox1.TabIndex = 10;
        this.groupBox1.TabStop = false;
        //
        // cmdBrowse
        //
        this.cmdBrowse.Location = new System.Drawing.Point(14, 139);
        this.cmdBrowse.Name = "cmdBrowse";
        this.cmdBrowse.Size = new System.Drawing.Size(220, 22);
        this.cmdBrowse.TabIndex = 11;
        this.cmdBrowse.Text = "Browse Unpaid Payment Requests";
        this.cmdBrowse.UseVisualStyleBackColor = true;
        //
        // groupBox2
        //
        this.groupBox2.BackColor = System.Drawing.Color.WhiteSmoke;
        this.groupBox2.Controls.Add(this.cmdCustomer);
        this.groupBox2.Controls.Add(this.txtNotes);
        this.groupBox2.Controls.Add(txtZip);
        this.groupBox2.Controls.Add(txtCountry);
        this.groupBox2.Controls.Add(txtState);
        this.groupBox2.Controls.Add(txtCity);
        this.groupBox2.Controls.Add(txtAddress);
        this.groupBox2.Controls.Add(txtName);
        this.groupBox2.Controls.Add(txtPayPalEmail);
        this.groupBox2.Controls.Add(txtEmail);
        this.groupBox2.Controls.Add(txtPhone);
        this.groupBox2.Controls.Add(txtLast);
        this.groupBox2.Controls.Add(txtFirst);
        this.groupBox2.Location = new System.Drawing.Point(14, 168);
        this.groupBox2.Name = "groupBox2";
        this.groupBox2.Size = new System.Drawing.Size(749, 264);
        this.groupBox2.TabIndex = 12;
        this.groupBox2.TabStop = false;
        this.groupBox2.Text = "Customer Information";
        this.groupBox2.Enter += new System.EventHandler(this.groupBox2_Enter);
        //
        // label21
        //
        this.label21.AutoSize = true;
        this.label21.Location = new System.Drawing.Point(186, 215);
        this.label21.Name = "label21";
        this.label21.Size = new System.Drawing.Size(25, 13);
        this.label21.TabIndex = 24;
        this.label21.Text = "Zip:";
        //
        // cmdCustomer
        //
        this.cmdCustomer.Location = new System.Drawing.Point(657, 136);
        this.cmdCustomer.Name = "cmdCustomer";
        this.cmdCustomer.Size = new System.Drawing.Size(86, 69);
        this.cmdCustomer.TabIndex = 23;
        this.cmdCustomer.Text = "Load Customer Info from Prior Order";
        this.cmdCustomer.UseVisualStyleBackColor = true;
        this.cmdCustomer.Click += new System.EventHandler(this.cmdCustomer_Click);
        //
        // txtNotes
        //
        this.txtNotes.AcceptsReturn = true;
        this.txtNotes.Location = new System.Drawing.Point(404, 136);
        this.txtNotes.Multiline = true;
        this.txtNotes.Name = "txtNotes";
        this.txtNotes.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
        this.txtNotes.Size = new System.Drawing.Size(247, 122);
        this.txtNotes.TabIndex = 19;
        //
        // txtZip
        //
        txtZip.Location = new System.Drawing.Point(211, 212);
        txtZip.Name = "txtZip";
        txtZip.Size = new System.Drawing.Size(99, 20);
        txtZip.TabIndex = 25;
        txtZip.TextChanged += new System.EventHandler(this.txtZip_TextChanged);
        //
        // txtCountry
        //
        txtCountry.Location = new System.Drawing.Point(72, 237);
        txtCountry.Name = "txtCountry";
        txtCountry.Size = new System.Drawing.Size(238, 20);
        txtCountry.TabIndex = 22;
        txtCountry.TextChanged += new System.EventHandler(this.txtCountry_TextChanged);
        //
        // txtState
        //
        txtState.Location = new System.Drawing.Point(72, 210);
        txtState.Name = "txtState";
        txtState.Size = new System.Drawing.Size(108, 20);
        txtState.TabIndex = 21;
        txtState.TextChanged += new System.EventHandler(this.txtState_TextChanged);
        //
        // txtCity
        //
        txtCity.Location = new System.Drawing.Point(72, 185);
        txtCity.Name = "txtCity";
        txtCity.Size = new System.Drawing.Size(238, 20);
        txtCity.TabIndex = 20;
        txtCity.TextChanged += new System.EventHandler(this.txtCity_TextChanged);
        //
        // txtAddress
        //
        txtAddress.AcceptsReturn = true;
        txtAddress.Location = new System.Drawing.Point(72, 92);
        txtAddress.Multiline = true;
        txtAddress.Name = "txtAddress";
        txtAddress.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
        txtAddress.Size = new System.Drawing.Size(236, 87);
        txtAddress.TabIndex = 18;
        txtAddress.TextChanged += new System.EventHandler(this.txtAddress_TextChanged);
        //
        // txtName
        //
        txtName.Location = new System.Drawing.Point(72, 68);
        txtName.Name = "txtName";
        txtName.Size = new System.Drawing.Size(238, 20);
        txtName.TabIndex = 17;
        txtName.TextChanged += new System.EventHandler(this.txtName_TextChanged);
        //
        // txtPayPalEmail
        //
        txtPayPalEmail.Location = new System.Drawing.Point(405, 98);
        txtPayPalEmail.Name = "txtPayPalEmail";
        txtPayPalEmail.Size = new System.Drawing.Size(203, 20);
        txtPayPalEmail.TabIndex = 16;
        //
        // txtEmail
        //
        txtEmail.Location = new System.Drawing.Point(404, 65);
        txtEmail.Name = "txtEmail";
        txtEmail.Size = new System.Drawing.Size(204, 20);
        txtEmail.TabIndex = 15;
        //
        // txtPhone
        //
        txtPhone.Location = new System.Drawing.Point(405, 39);
        txtPhone.Name = "txtPhone";
        txtPhone.Size = new System.Drawing.Size(203, 20);
        txtPhone.TabIndex = 14;
        txtPhone.TextChanged += new System.EventHandler(this.txtPhone_TextChanged);
        //
        // txtLast
        //
        txtLast.Location = new System.Drawing.Point(189, 39);
        txtLast.Name = "txtLast";
        txtLast.Size = new System.Drawing.Size(121, 20);
        txtLast.TabIndex = 13;
        txtLast.TextChanged += new System.EventHandler(this.txtLast_TextChanged);
        //
        // txtFirst
        //
        txtFirst.Location = new System.Drawing.Point(72, 39);
        txtFirst.Name = "txtFirst";
        txtFirst.Size = new System.Drawing.Size(84, 20);
        txtFirst.TabIndex = 12;
        txtFirst.TextChanged += new System.EventHandler(this.txtFirst_TextChanged);

        // grdOrderItems
        //
        grdOrderItems.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
        grdOrderItems.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
        grdOrderItems.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
        this.Qty,
        this.Description,
        this.UnitPrice,
        this.ExtPrice,
        this.SCode,
        this.Options1,
        this.Options2});
        grdOrderItems.Location = new System.Drawing.Point(10, 19);
        grdOrderItems.Name = "grdOrderItems";
        grdOrderItems.Size = new System.Drawing.Size(732, 81);
        grdOrderItems.TabIndex = 0;
        grdOrderItems.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(grdOrderItems_CellValueChanged);
        grdOrderItems.RowsAdded += new System.Windows.Forms.DataGridViewRowsAddedEventHandler(this.grdOrderItems_RowsAdded);
        //
        // Qty
        //
        this.Qty.HeaderText = "Qty";
        this.Qty.Name = "Qty";
        this.Qty.Width = 48;
        //
        // Description
        //
        this.Description.HeaderText = "Description";
        this.Description.Name = "Description";
        this.Description.Width = 85;
        //
        // UnitPrice
        //
        this.UnitPrice.HeaderText = "Unit Price";
        this.UnitPrice.Name = "UnitPrice";
        this.UnitPrice.Width = 78;
        //
        // ExtPrice
        //
        this.ExtPrice.HeaderText = "Ext. Price3";
        this.ExtPrice.Name = "ExtPrice";
        this.ExtPrice.ReadOnly = true;
        this.ExtPrice.Width = 83;
        //
        // SCode
        //
        this.SCode.HeaderText = "S-Code";
        this.SCode.Name = "SCode";
        this.SCode.Width = 67;
        //
        // Options1
        //
        this.Options1.HeaderText = "Options1";
        this.Options1.Name = "Options1";
        this.Options1.Width = 74;
        //
        // Options2
        //
        this.Options2.HeaderText = "Options2";
        this.Options2.Name = "Options2";
        this.Options2.Width = 74;
        //
        // groupBox3
        //
        this.groupBox3.BackColor = System.Drawing.Color.WhiteSmoke;
        this.groupBox3.Controls.Add(this.checkBox1);
        this.groupBox3.Controls.Add(this.cmdApplyTaxRate);
        this.groupBox3.Controls.Add(this.txtTaxRate);
        this.groupBox3.Controls.Add(this.lblSubTotal);
        this.groupBox3.Controls.Add(this.lblTotal);
        this.groupBox3.Controls.Add(this.txtTax);
        this.groupBox3.Controls.Add(this.txtShipping);
        this.groupBox3.Controls.Add(this.txtShippingMethod);
        this.groupBox3.Controls.Add(this.cmdTaxLookup);
        this.groupBox3.Controls.Add(this.lstShipping);
        this.groupBox3.Controls.Add(this.cmdBrowser);
        this.groupBox3.Controls.Add(this.groupBox4);
        this.groupBox3.Controls.Add(grdOrderItems);
        this.groupBox3.Location = new System.Drawing.Point(14, 443);
        this.groupBox3.Name = "groupBox3";
        this.groupBox3.Size = new System.Drawing.Size(749, 242);
        this.groupBox3.TabIndex = 13;
        this.groupBox3.TabStop = false;
        this.groupBox3.Text = "Order Information";
        //
        // checkBox1
        //
        this.checkBox1.AutoSize = true;
        this.checkBox1.Checked = true;
        this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
        this.checkBox1.Location = new System.Drawing.Point(253, 224);
        this.checkBox1.Name = "checkBox1";
        this.checkBox1.Size = new System.Drawing.Size(257, 17);
        this.checkBox1.TabIndex = 21;
        this.checkBox1.Text = "Automatically Apply Tax Rate with order changes";
        this.checkBox1.UseVisualStyleBackColor = true;
        //
        // cmdApplyTaxRate
        //
        this.cmdApplyTaxRate.Location = new System.Drawing.Point(313, 194);
        this.cmdApplyTaxRate.Name = "cmdApplyTaxRate";
        this.cmdApplyTaxRate.Size = new System.Drawing.Size(126, 24);
        this.cmdApplyTaxRate.TabIndex = 20;
        this.cmdApplyTaxRate.Text = "Apply Tax Rate";
        this.cmdApplyTaxRate.UseVisualStyleBackColor = true;
        //
        // txtTaxRate
        //
        this.txtTaxRate.Location = new System.Drawing.Point(186, 198);
        this.txtTaxRate.Name = "txtTaxRate";
        this.txtTaxRate.Size = new System.Drawing.Size(101, 20);
        this.txtTaxRate.TabIndex = 19;
        //
        // lblSubTotal
        //
        this.lblSubTotal.AutoSize = true;
        this.lblSubTotal.Location = new System.Drawing.Point(571, 128);
        this.lblSubTotal.Name = "lblSubTotal";
        this.lblSubTotal.Size = new System.Drawing.Size(13, 13);
        this.lblSubTotal.TabIndex = 18;
        this.lblSubTotal.Text = "$";
        //
        // lblTotal
        //
        this.lblTotal.AutoSize = true;
        this.lblTotal.Location = new System.Drawing.Point(571, 210);
        this.lblTotal.Name = "lblTotal";
        this.lblTotal.Size = new System.Drawing.Size(13, 13);
        this.lblTotal.TabIndex = 17;
        this.lblTotal.Text = "$";
        //
        // txtTax
        //
        this.txtTax.Location = new System.Drawing.Point(561, 177);
        this.txtTax.Name = "txtTax";
        this.txtTax.Size = new System.Drawing.Size(182, 20);
        this.txtTax.TabIndex = 16;
        //
        // txtShipping
        //
        this.txtShipping.Location = new System.Drawing.Point(561, 149);
        this.txtShipping.Name = "txtShipping";
        this.txtShipping.Size = new System.Drawing.Size(182, 20);
        this.txtShipping.TabIndex = 15;
        //
        // txtShippingMethod
        //
        this.txtShippingMethod.Location = new System.Drawing.Point(559, 105);
        this.txtShippingMethod.Name = "txtShippingMethod";
        this.txtShippingMethod.Size = new System.Drawing.Size(182, 20);
        this.txtShippingMethod.TabIndex = 14;
        //
        // cmdTaxLookup
        //
        this.cmdTaxLookup.Location = new System.Drawing.Point(138, 218);
        this.cmdTaxLookup.Name = "cmdTaxLookup";
        this.cmdTaxLookup.Size = new System.Drawing.Size(99, 21);
        this.cmdTaxLookup.TabIndex = 13;
        this.cmdTaxLookup.Text = "Lookup Tax Rate";
        this.cmdTaxLookup.UseVisualStyleBackColor = true;
        //
        // lstShipping
        //
        this.lstShipping.FormattingEnabled = true;
        this.lstShipping.Location = new System.Drawing.Point(304, 106);
        this.lstShipping.Name = "lstShipping";
        this.lstShipping.Size = new System.Drawing.Size(150, 69);
        this.lstShipping.TabIndex = 5;
        //
        // cmdBrowser
        //
        this.cmdBrowser.Location = new System.Drawing.Point(16, 106);
        this.cmdBrowser.Name = "cmdBrowser";
        this.cmdBrowser.Size = new System.Drawing.Size(164, 21);
        this.cmdBrowser.TabIndex = 2;
        this.cmdBrowser.Text = "Launch Browser Form";
        this.cmdBrowser.UseVisualStyleBackColor = true;
        this.cmdBrowser.Click += new System.EventHandler(this.cmdBrowser_Click);
        //
        // groupBox4
        //
        this.groupBox4.Controls.Add(this.cmdSendRequest);
        this.groupBox4.Location = new System.Drawing.Point(18, 133);
        this.groupBox4.Name = "groupBox4";
        this.groupBox4.Size = new System.Drawing.Size(162, 57);
        this.groupBox4.TabIndex = 1;
        this.groupBox4.TabStop = false;
        this.groupBox4.Text = "PayPal";
        //
        // cmdSendRequest
        //
        this.cmdSendRequest.Location = new System.Drawing.Point(7, 19);
        this.cmdSendRequest.Name = "cmdSendRequest";
        this.cmdSendRequest.Size = new System.Drawing.Size(131, 32);
        this.cmdSendRequest.TabIndex = 2;
        this.cmdSendRequest.Text = "Send Payment Request";
        this.cmdSendRequest.UseVisualStyleBackColor = true;
        this.cmdSendRequest.Click += new System.EventHandler(this.cmdSendRequest_Click_1);
        //
        // cmdClear
        //
        this.cmdClear.Location = new System.Drawing.Point(16, 696);
        this.cmdClear.Name = "cmdClear";
        this.cmdClear.Size = new System.Drawing.Size(67, 25);
        this.cmdClear.TabIndex = 14;
        this.cmdClear.Text = "Clear";
        this.cmdClear.UseVisualStyleBackColor = true;
        //
        // cmdSave
        //
        this.cmdSave.Location = new System.Drawing.Point(91, 697);
        this.cmdSave.Name = "cmdSave";
        this.cmdSave.Size = new System.Drawing.Size(67, 25);
        this.cmdSave.TabIndex = 15;
        this.cmdSave.Text = "Save";
        this.cmdSave.UseVisualStyleBackColor = true;
        //
        // cmdPrint
        //
        this.cmdPrint.Location = new System.Drawing.Point(164, 697);
        this.cmdPrint.Name = "cmdPrint";
        this.cmdPrint.Size = new System.Drawing.Size(67, 25);
        this.cmdPrint.TabIndex = 16;
        this.cmdPrint.Text = "Print";
        this.cmdPrint.UseVisualStyleBackColor = true;
        //
        // cmdSavePrintEmail
        //
        this.cmdSavePrintEmail.Location = new System.Drawing.Point(393, 694);
        this.cmdSavePrintEmail.Name = "cmdSavePrintEmail";
        this.cmdSavePrintEmail.Size = new System.Drawing.Size(131, 31);
        this.cmdSavePrintEmail.TabIndex = 17;
        this.cmdSavePrintEmail.Text = "Save, Print, and Email";
        this.cmdSavePrintEmail.UseVisualStyleBackColor = true;
        //
        // frmMain
        //
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.BackColor = System.Drawing.Color.Aqua;
        this.ClientSize = new System.Drawing.Size(790, 725);
        this.Controls.Add(this.cmdSavePrintEmail);
        this.Controls.Add(this.cmdPrint);
        this.Controls.Add(this.cmdSave);
        this.Controls.Add(this.cmdClear);
        this.Controls.Add(this.groupBox3);
        this.Controls.Add(this.groupBox2);
        this.Controls.Add(this.cmdBrowse);
        this.Controls.Add(this.groupBox1);
        this.Controls.Add(this.optRequestNew);
        this.Controls.Add(this.optRequestShipping);
        this.Controls.Add(this.optRequestAdd);
        this.Controls.Add(this.cmdEdit);
        this.Controls.Add(this.txtTransactionNumber);
        this.Controls.Add(this.cmdLookup);
        this.Controls.Add(this.cmdExit);
        this.Controls.Add(this.cmdSendEmail);
        this.Name = "frmMain";
        this.Text = "PayPal Payment Request Program version C1";
        this.Load += new System.EventHandler(this.Form1_Load);
        this.groupBox1.ResumeLayout(false);
        this.groupBox1.PerformLayout();
        this.groupBox2.ResumeLayout(false);
        this.groupBox2.PerformLayout();
        ((System.ComponentModel.ISupportInitialize)(grdOrderItems)).EndInit();
        this.groupBox3.ResumeLayout(false);
        this.groupBox3.PerformLayout();
        this.groupBox4.ResumeLayout(false);
        this.ResumeLayout(false);
        this.PerformLayout();

    }

    #endregion

    private System.Windows.Forms.Button cmdSendEmail;
    private System.Windows.Forms.Button cmdExit;
    private System.Windows.Forms.Button cmdLookup;
    private System.Windows.Forms.TextBox txtTransactionNumber;
    private System.Windows.Forms.Button cmdEdit;
    private System.Windows.Forms.GroupBox groupBox1;
    private System.Windows.Forms.Button cmdBrowse;
    private System.Windows.Forms.GroupBox groupBox2;
    private System.Windows.Forms.Button cmdCustomer;
    private System.Windows.Forms.TextBox txtNotes;
    private System.Windows.Forms.GroupBox groupBox3;
    private System.Windows.Forms.GroupBox groupBox4;
    private System.Windows.Forms.Button cmdSendRequest;
    private System.Windows.Forms.Button cmdBrowser;
    private System.Windows.Forms.CheckBox checkBox1;
    private System.Windows.Forms.Button cmdApplyTaxRate;
    private System.Windows.Forms.TextBox txtTaxRate;
    private System.Windows.Forms.TextBox txtTax;
    private System.Windows.Forms.TextBox txtShipping;
    private System.Windows.Forms.TextBox txtShippingMethod;
    private System.Windows.Forms.Button cmdTaxLookup;
    private System.Windows.Forms.ListBox lstShipping;
    private System.Windows.Forms.Button cmdClear;
    private System.Windows.Forms.Button cmdSave;
    private System.Windows.Forms.Button cmdPrint;
    private System.Windows.Forms.Button cmdSavePrintEmail;
    private System.Windows.Forms.DataGridViewTextBoxColumn Qty;
    private System.Windows.Forms.DataGridViewTextBoxColumn Description;
    private System.Windows.Forms.DataGridViewTextBoxColumn UnitPrice;
    private System.Windows.Forms.DataGridViewTextBoxColumn ExtPrice;
    private System.Windows.Forms.DataGridViewTextBoxColumn SCode;
    private System.Windows.Forms.DataGridViewTextBoxColumn Options1;
    private System.Windows.Forms.DataGridViewTextBoxColumn Options2;
    public static System.Windows.Forms.TextBox txtEmail;
    public static System.Windows.Forms.TextBox txtPhone;
    public static System.Windows.Forms.TextBox txtLast;
    public static System.Windows.Forms.TextBox txtCountry;
    public static System.Windows.Forms.TextBox txtState;
    public static System.Windows.Forms.TextBox txtAddress;
    public static System.Windows.Forms.TextBox txtPayPalEmail;
    public static System.Windows.Forms.DataGridView grdOrderItems;
    public static System.Windows.Forms.TextBox txtZip;
    public static System.Windows.Forms.TextBox txtCity;
    public static System.Windows.Forms.TextBox txtName;
    public static System.Windows.Forms.TextBox txtFirst;
}
```

}

答:
If you look into the .designer.cs file carefully you will notice this little comment

```<code>    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
</code>```

Basically that part of the code are auto generated by the designer and should never be modified manually.

And yes this is considered bad practice. Firstly the control should be self contained inside the form instead of being a static one. Static just means there will only be one instance across all the forms of the same class.

Direct modification of UI from one form to another is considered anti-pattern as well. You should be making a Data model and have the UI reads the updated data when they are changed. I know this might be a bit challenging for beginners as well for winform.

So if you want to take the shortcut you can expose a public property on the other form and by modifying the property your other form will update the appropriate control.

Edit:
In the other form's code behind (.cs file)

you can do like

```<code>public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    public string SelectedUser { get; private set; }
}
</code>```

and then in your main form you would listen to the close event

```<code>    Form1 other = new Form1();
    other.FormClosed += Other_FormClosed;
    other.Show();
</code>```

...

```<code>private void Other_FormClosed(object sender, FormClosedEventArgs e)
{
    Form1 other = (Form1)sender;
    string selectedUser = other.SelectedUser;

    //do something
}
</code>```

Body:
I've posted my code. Every single time I change anything on my this form in my Windows Forms App in C#, it changes my "public static" changes at the end to just "public" and then it adds "this." to every single reference to them. My code seems to run fine after I edit it again, but this is really annoying. I just wanted to make sure I'm not missing something or taking a poor approach to this.

The reason I am using public static statements is because I am modifying some Textboxes and a DataGridView object on my main form from other forms - i.e. looking up customer info from a database in one form and then entering the data on the main form to write up an order, and taking shopping cart information from a WebBrowser control on one form and putting it into a DataGridView object on another form. If this isn't how to accomplish populating forms from another form please tell me how and be as specific as possible as I am quite new to C#. Sorry if I've posted too much code - this is almost everything from my form1.cs file and I didn't know what (if anything) that I have here is causing the problem. The relevant "public static" statements are at the end.

(AFTER I WROTE THIS - I looked up another thread where someone said that forms are supposed to be a "specific instantiation" and that is why the developer environment keeps taking out the "static"). That being the case... HELP!! I do not understand how to change the values on one form from another form and I absolutely need to do so. - this code works, but I guess it's bad practice? - Completely lost and need very specific instructions to make this work)

Thanks in advance!!!

namespace WindowsFormsApp1
{
    public partial class frmMain
    {
        private System.ComponentModel.IContainer components = null;

    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region Windows Form Designer generated code

    private void InitializeComponent()
    {
        this.cmdSendEmail = new System.Windows.Forms.Button();
        this.cmdExit = new System.Windows.Forms.Button();
        this.cmdLookup = new System.Windows.Forms.Button();
        this.txtTransactionNumber = new System.Windows.Forms.TextBox();
        this.cmdEdit = new System.Windows.Forms.Button();
        this.groupBox1 = new System.Windows.Forms.GroupBox();
        this.cmdBrowse = new System.Windows.Forms.Button();
        this.groupBox2 = new System.Windows.Forms.GroupBox();
        this.cmdCustomer = new System.Windows.Forms.Button();
        this.txtNotes = new System.Windows.Forms.TextBox();
        txtZip = new System.Windows.Forms.TextBox();
        txtCountry = new System.Windows.Forms.TextBox();
        txtState = new System.Windows.Forms.TextBox();
        txtCity = new System.Windows.Forms.TextBox();
        txtAddress = new System.Windows.Forms.TextBox();
        txtName = new System.Windows.Forms.TextBox();
        txtPayPalEmail = new System.Windows.Forms.TextBox();
        txtEmail = new System.Windows.Forms.TextBox();
        txtPhone = new System.Windows.Forms.TextBox();
        txtLast = new System.Windows.Forms.TextBox();
        txtFirst = new System.Windows.Forms.TextBox();
        grdOrderItems = new System.Windows.Forms.DataGridView();
        this.Qty = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.Description = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.UnitPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.ExtPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.SCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.Options1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.Options2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.groupBox3 = new System.Windows.Forms.GroupBox();
        this.lblSubTotal = new System.Windows.Forms.Label();
        this.lblTotal = new System.Windows.Forms.Label();
        this.txtTax = new System.Windows.Forms.TextBox();
        this.txtShipping = new System.Windows.Forms.TextBox();
        this.txtShippingMethod = new System.Windows.Forms.TextBox();
        this.cmdTaxLookup = new System.Windows.Forms.Button();
        this.lstShipping = new System.Windows.Forms.ListBox();
        this.cmdBrowser = new System.Windows.Forms.Button();
        this.groupBox4 = new System.Windows.Forms.GroupBox();
        this.cmdSendRequest = new System.Windows.Forms.Button();
        this.cmdClear = new System.Windows.Forms.Button();
        this.cmdSave = new System.Windows.Forms.Button();
        this.cmdPrint = new System.Windows.Forms.Button();
        this.cmdSavePrintEmail = new System.Windows.Forms.Button();
        this.groupBox1.SuspendLayout();
        this.groupBox2.SuspendLayout();
        ((System.ComponentModel.ISupportInitialize)(grdOrderItems)).BeginInit();
        this.groupBox3.SuspendLayout();
        this.groupBox4.SuspendLayout();
        this.SuspendLayout();
        //
        // cmdLookup
        //
        this.cmdLookup.Location = new System.Drawing.Point(88, 15);
        this.cmdLookup.Name = "cmdLookup";
        this.cmdLookup.Size = new System.Drawing.Size(197, 33);
        this.cmdLookup.TabIndex = 3;
        this.cmdLookup.Text = "Look up order to attach request to";
        this.cmdLookup.UseVisualStyleBackColor = true;
        //
        // txtTransactionNumber
        //
        this.txtTransactionNumber.Location = new System.Drawing.Point(91, 57);
        this.txtTransactionNumber.Name = "txtTransactionNumber";
        this.txtTransactionNumber.Size = new System.Drawing.Size(158, 20);
        this.txtTransactionNumber.TabIndex = 5;
        //
        // cmdEdit
        //
        this.cmdEdit.Location = new System.Drawing.Point(260, 57);
        this.cmdEdit.Name = "cmdEdit";
        this.cmdEdit.Size = new System.Drawing.Size(87, 30);
        this.cmdEdit.TabIndex = 6;
        this.cmdEdit.Text = "Edit";
        this.cmdEdit.UseVisualStyleBackColor = true;
        //
        //
        // groupBox1
        //
        this.groupBox1.Location = new System.Drawing.Point(438, 125);
        this.groupBox1.Name = "groupBox1";
        this.groupBox1.Size = new System.Drawing.Size(345, 56);
        this.groupBox1.TabIndex = 10;
        this.groupBox1.TabStop = false;
        //
        // cmdBrowse
        //
        this.cmdBrowse.Location = new System.Drawing.Point(14, 139);
        this.cmdBrowse.Name = "cmdBrowse";
        this.cmdBrowse.Size = new System.Drawing.Size(220, 22);
        this.cmdBrowse.TabIndex = 11;
        this.cmdBrowse.Text = "Browse Unpaid Payment Requests";
        this.cmdBrowse.UseVisualStyleBackColor = true;
        //
        // groupBox2
        //
        this.groupBox2.BackColor = System.Drawing.Color.WhiteSmoke;
        this.groupBox2.Controls.Add(this.cmdCustomer);
        this.groupBox2.Controls.Add(this.txtNotes);
        this.groupBox2.Controls.Add(txtZip);
        this.groupBox2.Controls.Add(txtCountry);
        this.groupBox2.Controls.Add(txtState);
        this.groupBox2.Controls.Add(txtCity);
        this.groupBox2.Controls.Add(txtAddress);
        this.groupBox2.Controls.Add(txtName);
        this.groupBox2.Controls.Add(txtPayPalEmail);
        this.groupBox2.Controls.Add(txtEmail);
        this.groupBox2.Controls.Add(txtPhone);
        this.groupBox2.Controls.Add(txtLast);
        this.groupBox2.Controls.Add(txtFirst);
        this.groupBox2.Location = new System.Drawing.Point(14, 168);
        this.groupBox2.Name = "groupBox2";
        this.groupBox2.Size = new System.Drawing.Size(749, 264);
        this.groupBox2.TabIndex = 12;
        this.groupBox2.TabStop = false;
        this.groupBox2.Text = "Customer Information";
        this.groupBox2.Enter += new System.EventHandler(this.groupBox2_Enter);
        //
        // label21
        //
        this.label21.AutoSize = true;
        this.label21.Location = new System.Drawing.Point(186, 215);
        this.label21.Name = "label21";
        this.label21.Size = new System.Drawing.Size(25, 13);
        this.label21.TabIndex = 24;
        this.label21.Text = "Zip:";
        //
        // cmdCustomer
        //
        this.cmdCustomer.Location = new System.Drawing.Point(657, 136);
        this.cmdCustomer.Name = "cmdCustomer";
        this.cmdCustomer.Size = new System.Drawing.Size(86, 69);
        this.cmdCustomer.TabIndex = 23;
        this.cmdCustomer.Text = "Load Customer Info from Prior Order";
        this.cmdCustomer.UseVisualStyleBackColor = true;
        this.cmdCustomer.Click += new System.EventHandler(this.cmdCustomer_Click);
        //
        // txtNotes
        //
        this.txtNotes.AcceptsReturn = true;
        this.txtNotes.Location = new System.Drawing.Point(404, 136);
        this.txtNotes.Multiline = true;
        this.txtNotes.Name = "txtNotes";
        this.txtNotes.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
        this.txtNotes.Size = new System.Drawing.Size(247, 122);
        this.txtNotes.TabIndex = 19;
        //
        // txtZip
        //
        txtZip.Location = new System.Drawing.Point(211, 212);
        txtZip.Name = "txtZip";
        txtZip.Size = new System.Drawing.Size(99, 20);
        txtZip.TabIndex = 25;
        txtZip.TextChanged += new System.EventHandler(this.txtZip_TextChanged);
        //
        // txtCountry
        //
        txtCountry.Location = new System.Drawing.Point(72, 237);
        txtCountry.Name = "txtCountry";
        txtCountry.Size = new System.Drawing.Size(238, 20);
        txtCountry.TabIndex = 22;
        txtCountry.TextChanged += new System.EventHandler(this.txtCountry_TextChanged);
        //
        // txtState
        //
        txtState.Location = new System.Drawing.Point(72, 210);
        txtState.Name = "txtState";
        txtState.Size = new System.Drawing.Size(108, 20);
        txtState.TabIndex = 21;
        txtState.TextChanged += new System.EventHandler(this.txtState_TextChanged);
        //
        // txtCity
        //
        txtCity.Location = new System.Drawing.Point(72, 185);
        txtCity.Name = "txtCity";
        txtCity.Size = new System.Drawing.Size(238, 20);
        txtCity.TabIndex = 20;
        txtCity.TextChanged += new System.EventHandler(this.txtCity_TextChanged);
        //
        // txtAddress
        //
        txtAddress.AcceptsReturn = true;
        txtAddress.Location = new System.Drawing.Point(72, 92);
        txtAddress.Multiline = true;
        txtAddress.Name = "txtAddress";
        txtAddress.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
        txtAddress.Size = new System.Drawing.Size(236, 87);
        txtAddress.TabIndex = 18;
        txtAddress.TextChanged += new System.EventHandler(this.txtAddress_TextChanged);
        //
        // txtName
        //
        txtName.Location = new System.Drawing.Point(72, 68);
        txtName.Name = "txtName";
        txtName.Size = new System.Drawing.Size(238, 20);
        txtName.TabIndex = 17;
        txtName.TextChanged += new System.EventHandler(this.txtName_TextChanged);
        //
        // txtPayPalEmail
        //
        txtPayPalEmail.Location = new System.Drawing.Point(405, 98);
        txtPayPalEmail.Name = "txtPayPalEmail";
        txtPayPalEmail.Size = new System.Drawing.Size(203, 20);
        txtPayPalEmail.TabIndex = 16;
        //
        // txtEmail
        //
        txtEmail.Location = new System.Drawing.Point(404, 65);
        txtEmail.Name = "txtEmail";
        txtEmail.Size = new System.Drawing.Size(204, 20);
        txtEmail.TabIndex = 15;
        //
        // txtPhone
        //
        txtPhone.Location = new System.Drawing.Point(405, 39);
        txtPhone.Name = "txtPhone";
        txtPhone.Size = new System.Drawing.Size(203, 20);
        txtPhone.TabIndex = 14;
        txtPhone.TextChanged += new System.EventHandler(this.txtPhone_TextChanged);
        //
        // txtLast
        //
        txtLast.Location = new System.Drawing.Point(189, 39);
        txtLast.Name = "txtLast";
        txtLast.Size = new System.Drawing.Size(121, 20);
        txtLast.TabIndex = 13;
        txtLast.TextChanged += new System.EventHandler(this.txtLast_TextChanged);
        //
        // txtFirst
        //
        txtFirst.Location = new System.Drawing.Point(72, 39);
        txtFirst.Name = "txtFirst";
        txtFirst.Size = new System.Drawing.Size(84, 20);
        txtFirst.TabIndex = 12;
        txtFirst.TextChanged += new System.EventHandler(this.txtFirst_TextChanged);

        // grdOrderItems
        //
        grdOrderItems.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
        grdOrderItems.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
        grdOrderItems.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
        this.Qty,
        this.Description,
        this.UnitPrice,
        this.ExtPrice,
        this.SCode,
        this.Options1,
        this.Options2});
        grdOrderItems.Location = new System.Drawing.Point(10, 19);
        grdOrderItems.Name = "grdOrderItems";
        grdOrderItems.Size = new System.Drawing.Size(732, 81);
        grdOrderItems.TabIndex = 0;
        grdOrderItems.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(grdOrderItems_CellValueChanged);
        grdOrderItems.RowsAdded += new System.Windows.Forms.DataGridViewRowsAddedEventHandler(this.grdOrderItems_RowsAdded);
        //
        // Qty
        //
        this.Qty.HeaderText = "Qty";
        this.Qty.Name = "Qty";
        this.Qty.Width = 48;
        //
        // Description
        //
        this.Description.HeaderText = "Description";
        this.Description.Name = "Description";
        this.Description.Width = 85;
        //
        // UnitPrice
        //
        this.UnitPrice.HeaderText = "Unit Price";
        this.UnitPrice.Name = "UnitPrice";
        this.UnitPrice.Width = 78;
        //
        // ExtPrice
        //
        this.ExtPrice.HeaderText = "Ext. Price3";
        this.ExtPrice.Name = "ExtPrice";
        this.ExtPrice.ReadOnly = true;
        this.ExtPrice.Width = 83;
        //
        // SCode
        //
        this.SCode.HeaderText = "S-Code";
        this.SCode.Name = "SCode";
        this.SCode.Width = 67;
        //
        // Options1
        //
        this.Options1.HeaderText = "Options1";
        this.Options1.Name = "Options1";
        this.Options1.Width = 74;
        //
        // Options2
        //
        this.Options2.HeaderText = "Options2";
        this.Options2.Name = "Options2";
        this.Options2.Width = 74;
        //
        // groupBox3
        //
        this.groupBox3.BackColor = System.Drawing.Color.WhiteSmoke;
        this.groupBox3.Controls.Add(this.checkBox1);
        this.groupBox3.Controls.Add(this.cmdApplyTaxRate);
        this.groupBox3.Controls.Add(this.txtTaxRate);
        this.groupBox3.Controls.Add(this.lblSubTotal);
        this.groupBox3.Controls.Add(this.lblTotal);
        this.groupBox3.Controls.Add(this.txtTax);
        this.groupBox3.Controls.Add(this.txtShipping);
        this.groupBox3.Controls.Add(this.txtShippingMethod);
        this.groupBox3.Controls.Add(this.cmdTaxLookup);
        this.groupBox3.Controls.Add(this.lstShipping);
        this.groupBox3.Controls.Add(this.cmdBrowser);
        this.groupBox3.Controls.Add(this.groupBox4);
        this.groupBox3.Controls.Add(grdOrderItems);
        this.groupBox3.Location = new System.Drawing.Point(14, 443);
        this.groupBox3.Name = "groupBox3";
        this.groupBox3.Size = new System.Drawing.Size(749, 242);
        this.groupBox3.TabIndex = 13;
        this.groupBox3.TabStop = false;
        this.groupBox3.Text = "Order Information";
        //
        // checkBox1
        //
        this.checkBox1.AutoSize = true;
        this.checkBox1.Checked = true;
        this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
        this.checkBox1.Location = new System.Drawing.Point(253, 224);
        this.checkBox1.Name = "checkBox1";
        this.checkBox1.Size = new System.Drawing.Size(257, 17);
        this.checkBox1.TabIndex = 21;
        this.checkBox1.Text = "Automatically Apply Tax Rate with order changes";
        this.checkBox1.UseVisualStyleBackColor = true;
        //
        // cmdApplyTaxRate
        //
        this.cmdApplyTaxRate.Location = new System.Drawing.Point(313, 194);
        this.cmdApplyTaxRate.Name = "cmdApplyTaxRate";
        this.cmdApplyTaxRate.Size = new System.Drawing.Size(126, 24);
        this.cmdApplyTaxRate.TabIndex = 20;
        this.cmdApplyTaxRate.Text = "Apply Tax Rate";
        this.cmdApplyTaxRate.UseVisualStyleBackColor = true;
        //
        // txtTaxRate
        //
        this.txtTaxRate.Location = new System.Drawing.Point(186, 198);
        this.txtTaxRate.Name = "txtTaxRate";
        this.txtTaxRate.Size = new System.Drawing.Size(101, 20);
        this.txtTaxRate.TabIndex = 19;
        //
        // lblSubTotal
        //
        this.lblSubTotal.AutoSize = true;
        this.lblSubTotal.Location = new System.Drawing.Point(571, 128);
        this.lblSubTotal.Name = "lblSubTotal";
        this.lblSubTotal.Size = new System.Drawing.Size(13, 13);
        this.lblSubTotal.TabIndex = 18;
        this.lblSubTotal.Text = "$";
        //
        // lblTotal
        //
        this.lblTotal.AutoSize = true;
        this.lblTotal.Location = new System.Drawing.Point(571, 210);
        this.lblTotal.Name = "lblTotal";
        this.lblTotal.Size = new System.Drawing.Size(13, 13);
        this.lblTotal.TabIndex = 17;
        this.lblTotal.Text = "$";
        //
        // txtTax
        //
        this.txtTax.Location = new System.Drawing.Point(561, 177);
        this.txtTax.Name = "txtTax";
        this.txtTax.Size = new System.Drawing.Size(182, 20);
        this.txtTax.TabIndex = 16;
        //
        // txtShipping
        //
        this.txtShipping.Location = new System.Drawing.Point(561, 149);
        this.txtShipping.Name = "txtShipping";
        this.txtShipping.Size = new System.Drawing.Size(182, 20);
        this.txtShipping.TabIndex = 15;
        //
        // txtShippingMethod
        //
        this.txtShippingMethod.Location = new System.Drawing.Point(559, 105);
        this.txtShippingMethod.Name = "txtShippingMethod";
        this.txtShippingMethod.Size = new System.Drawing.Size(182, 20);
        this.txtShippingMethod.TabIndex = 14;
        //
        // cmdTaxLookup
        //
        this.cmdTaxLookup.Location = new System.Drawing.Point(138, 218);
        this.cmdTaxLookup.Name = "cmdTaxLookup";
        this.cmdTaxLookup.Size = new System.Drawing.Size(99, 21);
        this.cmdTaxLookup.TabIndex = 13;
        this.cmdTaxLookup.Text = "Lookup Tax Rate";
        this.cmdTaxLookup.UseVisualStyleBackColor = true;
        //
        // lstShipping
        //
        this.lstShipping.FormattingEnabled = true;
        this.lstShipping.Location = new System.Drawing.Point(304, 106);
        this.lstShipping.Name = "lstShipping";
        this.lstShipping.Size = new System.Drawing.Size(150, 69);
        this.lstShipping.TabIndex = 5;
        //
        // cmdBrowser
        //
        this.cmdBrowser.Location = new System.Drawing.Point(16, 106);
        this.cmdBrowser.Name = "cmdBrowser";
        this.cmdBrowser.Size = new System.Drawing.Size(164, 21);
        this.cmdBrowser.TabIndex = 2;
        this.cmdBrowser.Text = "Launch Browser Form";
        this.cmdBrowser.UseVisualStyleBackColor = true;
        this.cmdBrowser.Click += new System.EventHandler(this.cmdBrowser_Click);
        //
        // groupBox4
        //
        this.groupBox4.Controls.Add(this.cmdSendRequest);
        this.groupBox4.Location = new System.Drawing.Point(18, 133);
        this.groupBox4.Name = "groupBox4";
        this.groupBox4.Size = new System.Drawing.Size(162, 57);
        this.groupBox4.TabIndex = 1;
        this.groupBox4.TabStop = false;
        this.groupBox4.Text = "PayPal";
        //
        // cmdSendRequest
        //
        this.cmdSendRequest.Location = new System.Drawing.Point(7, 19);
        this.cmdSendRequest.Name = "cmdSendRequest";
        this.cmdSendRequest.Size = new System.Drawing.Size(131, 32);
        this.cmdSendRequest.TabIndex = 2;
        this.cmdSendRequest.Text = "Send Payment Request";
        this.cmdSendRequest.UseVisualStyleBackColor = true;
        this.cmdSendRequest.Click += new System.EventHandler(this.cmdSendRequest_Click_1);
        //
        // cmdClear
        //
        this.cmdClear.Location = new System.Drawing.Point(16, 696);
        this.cmdClear.Name = "cmdClear";
        this.cmdClear.Size = new System.Drawing.Size(67, 25);
        this.cmdClear.TabIndex = 14;
        this.cmdClear.Text = "Clear";
        this.cmdClear.UseVisualStyleBackColor = true;
        //
        // cmdSave
        //
        this.cmdSave.Location = new System.Drawing.Point(91, 697);
        this.cmdSave.Name = "cmdSave";
        this.cmdSave.Size = new System.Drawing.Size(67, 25);
        this.cmdSave.TabIndex = 15;
        this.cmdSave.Text = "Save";
        this.cmdSave.UseVisualStyleBackColor = true;
        //
        // cmdPrint
        //
        this.cmdPrint.Location = new System.Drawing.Point(164, 697);
        this.cmdPrint.Name = "cmdPrint";
        this.cmdPrint.Size = new System.Drawing.Size(67, 25);
        this.cmdPrint.TabIndex = 16;
        this.cmdPrint.Text = "Print";
        this.cmdPrint.UseVisualStyleBackColor = true;
        //
        // cmdSavePrintEmail
        //
        this.cmdSavePrintEmail.Location = new System.Drawing.Point(393, 694);
        this.cmdSavePrintEmail.Name = "cmdSavePrintEmail";
        this.cmdSavePrintEmail.Size = new System.Drawing.Size(131, 31);
        this.cmdSavePrintEmail.TabIndex = 17;
        this.cmdSavePrintEmail.Text = "Save, Print, and Email";
        this.cmdSavePrintEmail.UseVisualStyleBackColor = true;
        //
        // frmMain
        //
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.BackColor = System.Drawing.Color.Aqua;
        this.ClientSize = new System.Drawing.Size(790, 725);
        this.Controls.Add(this.cmdSavePrintEmail);
        this.Controls.Add(this.cmdPrint);
        this.Controls.Add(this.cmdSave);
        this.Controls.Add(this.cmdClear);
        this.Controls.Add(this.groupBox3);
        this.Controls.Add(this.groupBox2);
        this.Controls.Add(this.cmdBrowse);
        this.Controls.Add(this.groupBox1);
        this.Controls.Add(this.optRequestNew);
        this.Controls.Add(this.optRequestShipping);
        this.Controls.Add(this.optRequestAdd);
        this.Controls.Add(this.cmdEdit);
        this.Controls.Add(this.txtTransactionNumber);
        this.Controls.Add(this.cmdLookup);
        this.Controls.Add(this.cmdExit);
        this.Controls.Add(this.cmdSendEmail);
        this.Name = "frmMain";
        this.Text = "PayPal Payment Request Program version C1";
        this.Load += new System.EventHandler(this.Form1_Load);
        this.groupBox1.ResumeLayout(false);
        this.groupBox1.PerformLayout();
        this.groupBox2.ResumeLayout(false);
        this.groupBox2.PerformLayout();
        ((System.ComponentModel.ISupportInitialize)(grdOrderItems)).EndInit();
        this.groupBox3.ResumeLayout(false);
        this.groupBox3.PerformLayout();
        this.groupBox4.ResumeLayout(false);
        this.ResumeLayout(false);
        this.PerformLayout();

    }

    #endregion

    private System.Windows.Forms.Button cmdSendEmail;
    private System.Windows.Forms.Button cmdExit;
    private System.Windows.Forms.Button cmdLookup;
    private System.Windows.Forms.TextBox txtTransactionNumber;
    private System.Windows.Forms.Button cmdEdit;
    private System.Windows.Forms.GroupBox groupBox1;
    private System.Windows.Forms.Button cmdBrowse;
    private System.Windows.Forms.GroupBox groupBox2;
    private System.Windows.Forms.Button cmdCustomer;
    private System.Windows.Forms.TextBox txtNotes;
    private System.Windows.Forms.GroupBox groupBox3;
    private System.Windows.Forms.GroupBox groupBox4;
    private System.Windows.Forms.Button cmdSendRequest;
    private System.Windows.Forms.Button cmdBrowser;
    private System.Windows.Forms.CheckBox checkBox1;
    private System.Windows.Forms.Button cmdApplyTaxRate;
    private System.Windows.Forms.TextBox txtTaxRate;
    private System.Windows.Forms.TextBox txtTax;
    private System.Windows.Forms.TextBox txtShipping;
    private System.Windows.Forms.TextBox txtShippingMethod;
    private System.Windows.Forms.Button cmdTaxLookup;
    private System.Windows.Forms.ListBox lstShipping;
    private System.Windows.Forms.Button cmdClear;
    private System.Windows.Forms.Button cmdSave;
    private System.Windows.Forms.Button cmdPrint;
    private System.Windows.Forms.Button cmdSavePrintEmail;
    private System.Windows.Forms.DataGridViewTextBoxColumn Qty;
    private System.Windows.Forms.DataGridViewTextBoxColumn Description;
    private System.Windows.Forms.DataGridViewTextBoxColumn UnitPrice;
    private System.Windows.Forms.DataGridViewTextBoxColumn ExtPrice;
    private System.Windows.Forms.DataGridViewTextBoxColumn SCode;
    private System.Windows.Forms.DataGridViewTextBoxColumn Options1;
    private System.Windows.Forms.DataGridViewTextBoxColumn Options2;
    public static System.Windows.Forms.TextBox txtEmail;
    public static System.Windows.Forms.TextBox txtPhone;
    public static System.Windows.Forms.TextBox txtLast;
    public static System.Windows.Forms.TextBox txtCountry;
    public static System.Windows.Forms.TextBox txtState;
    public static System.Windows.Forms.TextBox txtAddress;
    public static System.Windows.Forms.TextBox txtPayPalEmail;
    public static System.Windows.Forms.DataGridView grdOrderItems;
    public static System.Windows.Forms.TextBox txtZip;
    public static System.Windows.Forms.TextBox txtCity;
    public static System.Windows.Forms.TextBox txtName;
    public static System.Windows.Forms.TextBox txtFirst;
}

}

Body:
If you look into the .designer.cs file carefully you will notice this little comment

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>

Basically that part of the code are auto generated by the designer and should never be modified manually.

And yes this is considered bad practice. Firstly the control should be self contained inside the form instead of being a static one. Static just means there will only be one instance across all the forms of the same class.

Direct modification of UI from one form to another is considered anti-pattern as well. You should be making a Data model and have the UI reads the updated data when they are changed. I know this might be a bit challenging for beginners as well for winform.

So if you want to take the shortcut you can expose a public property on the other form and by modifying the property your other form will update the appropriate control.

Edit:
In the other form's code behind (.cs file)

you can do like

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    public string SelectedUser { get; private set; }
}

and then in your main form you would listen to the close event

    Form1 other = new Form1();
    other.FormClosed += Other_FormClosed;
    other.Show();

...

private void Other_FormClosed(object sender, FormClosedEventArgs e)
{
    Form1 other = (Form1)sender;
    string selectedUser = other.SelectedUser;

    //do something
}


来源: stackexchange

问:
Insert Multiple Rows If Not Exists
I have two tables. Table A and Table B. Table A has some unique id's already existing. I want to insert a new custom row into Table A where those rows for my condition exist in Table B and not in Table A. How do I insert all rows from Table B that don't exist in Table A? I am looking for MSSQL solution.

I have tried the following two forms but neither seem to work:

Example A:

```<code>INSERT into TableA
(
    Id,
    Selection1,
    Selection2,
    Selection3
)
SELECT
(
    Id,  /* this field comes from TableB */
     0,
     0,
     1
)
from TableB
where NOT EXISTS ( SELECT * FROM TableA
                INNER JOIN TableB
                ON TableA.Id = TableB.ID)
</code>```

Example B

```<code>IF NOT EXISTS ( SELECT * FROM TableA
        INNER JOIN TableB
        ON TableA.Id = TableB.Id)

    INSERT into TableA
    (
        Id,
        Selection1,
        Selection2,
        Selection3
    )
    SELECT
    (
        Id,  /* this field comes from TableB */
         0,
         0,
         1
    )
    from TableB
</code>```

答:
You're looking for MERGE. The following pseudo code will get you there:</p>

```<code>MERGE INTO [TableA] AS [target]
using (SELECT distinct [Id] /* multiple ids exist in table a */
              , [Selection1]
              , [Selection2]
              , [Selection3]
       FROM   [TableB]) AS [source]
ON [target].[ID] = [source].ID
WHEN NOT matched THEN
    INSERT ([Id]
            , [Selection1]
            , [Selection2]
            , [Selection3])
    VALUES ([Id]
            , [Selection1]
            , [Selection2]
            , [Selection3]);
</code>```

ContentLicense: CC BY-SA 3.0

Title: Insert Multiple Rows If Not Exists

Body:
I have two tables. Table A and Table B. Table A has some unique id's already existing. I want to insert a new custom row into Table A where those rows for my condition exist in Table B and not in Table A. How do I insert all rows from Table B that don't exist in Table A? I am looking for MSSQL solution.

I have tried the following two forms but neither seem to work:

Example A:

INSERT into TableA
(
    Id,
    Selection1,
    Selection2,
    Selection3
)
SELECT
(
    Id,  /* this field comes from TableB */
     0,
     0,
     1
)
from TableB
where NOT EXISTS ( SELECT * FROM TableA
                INNER JOIN TableB
                ON TableA.Id = TableB.ID)

Example B

IF NOT EXISTS ( SELECT * FROM TableA
        INNER JOIN TableB
        ON TableA.Id = TableB.Id)

    INSERT into TableA
    (
        Id,
        Selection1,
        Selection2,
        Selection3
    )
    SELECT
    (
        Id,  /* this field comes from TableB */
         0,
         0,
         1
    )
    from TableB

Body:
You're looking for MERGE. The following pseudo code will get you there:

MERGE INTO [TableA] AS [target]
using (SELECT distinct [Id] /* multiple ids exist in table a */
              , [Selection1]
              , [Selection2]
              , [Selection3]
       FROM   [TableB]) AS [source]
ON [target].[ID] = [source].ID
WHEN NOT matched THEN
    INSERT ([Id]
            , [Selection1]
            , [Selection2]
            , [Selection3])
    VALUES ([Id]
            , [Selection1]
            , [Selection2]
            , [Selection3]);


问:
save symfony/workflow in database using mysqli php
im new in symfony/workflow so i read the documentation and do my first workflow in my exist hp project, i added the code like this : </p>

```<code>$definitionBuilder = new DefinitionBuilder();

$definition = $definitionBuilder->addPlaces(['create_contest', 'approve', 'reject', 'launch_contest','contest_edit','submition','not_submition','pay_contest','pass','full','post_mortem','final_review','fail','final_pass','completed'])

    // Transitions are defined with a unique name, an origin place and a destination place
    ->addTransition(new Transition('pending_contest', 'create_contest','approve','reject'))
    ->addTransition(new Transition('Pending_contest', 'contest_edit', 'approve','reject'))
    ->addTransition(new Transition('admin_approve', 'approve', 'launch_contest'))
    ->addTransition(new Transition('admin_reject', 'reject', 'contest_edit'))
    ->addTransition(new Transition('wait_to_pay', 'launch_contest','pay_contest'))
    ->addTransition(new Transition('submition_phase', 'pay_contest', 'submition','not_submition'))
    ->addTransition(new Transition('review','submition','pass','full'))
    ->addTransition(new Transition('post_mortem', 'not_submition','post_mortem'))
    ->addTransition(new Transition('Post_mortem', 'full', 'post_mortem'))
    ->addTransition(new Transition('final_fixes','pass','final_review'))
    ->addTransition(new Transition('Final_fixes','fail','final_review'))
    ->addTransition(new Transition('fail','final_review','fail'))
    ->addTransition(new Transition('pass','final_review','final_pass'))
    ->addTransition(new Transition('approve','final_pass','completed'))
    ->build();

$marking = new SingleStateMarkingStore('currentState');
$workflow = new Workflow($definition, $marking);
</code>```

<p>so .. what i need to do after this ? do i need to add more code like controller stuff ? how to use the transitions ? the code i add it after create new contest,  so i need to call the first transition and save it in database using Mysqli
i need help please </p>

答:
Here read this docs

and try this example:

may be you rushed to ask and missed to read those docs "_"

Body:
im new in symfony/workflow so i read the documentation and do my first workflow in my exist hp project, i added the code like this :

$definitionBuilder = new DefinitionBuilder();

$definition = $definitionBuilder->addPlaces(['create_contest', 'approve', 'reject', 'launch_contest','contest_edit','submition','not_submition','pay_contest','pass','full','post_mortem','final_review','fail','final_pass','completed'])

    // Transitions are defined with a unique name, an origin place and a destination place
    ->addTransition(new Transition('pending_contest', 'create_contest','approve','reject'))
    ->addTransition(new Transition('Pending_contest', 'contest_edit', 'approve','reject'))
    ->addTransition(new Transition('admin_approve', 'approve', 'launch_contest'))
    ->addTransition(new Transition('admin_reject', 'reject', 'contest_edit'))
    ->addTransition(new Transition('wait_to_pay', 'launch_contest','pay_contest'))
    ->addTransition(new Transition('submition_phase', 'pay_contest', 'submition','not_submition'))
    ->addTransition(new Transition('review','submition','pass','full'))
    ->addTransition(new Transition('post_mortem', 'not_submition','post_mortem'))
    ->addTransition(new Transition('Post_mortem', 'full', 'post_mortem'))
    ->addTransition(new Transition('final_fixes','pass','final_review'))
    ->addTransition(new Transition('Final_fixes','fail','final_review'))
    ->addTransition(new Transition('fail','final_review','fail'))
    ->addTransition(new Transition('pass','final_review','final_pass'))
    ->addTransition(new Transition('approve','final_pass','completed'))
    ->build();

$marking = new SingleStateMarkingStore('currentState');
$workflow = new Workflow($definition, $marking);

so .. what i need to do after this ? do i need to add more code like controller stuff ? how to use the transitions ? the code i add it after create new contest,  so i need to call the first transition and save it in database using Mysqli
i need help please


问:
Shared libraries on Windows - dependencies using wrong dll
I have a C++ code that uses gdal as library. Compiled with intel c++ compiler 16 on visual studio 2013.

In the configuration, I specify the gdal library path and library file to link with:

Additional Library Directories: C:\OSGeo4W64\lib   (where gdal_i.lib is)

Additional Dependencies: gdal_i.lib

It used to work a few months ago, but something must have changed in my system. Now, when I try my executable, I get a popup with error:

The ordinal 361 could not be located in the dynamic link library SSLEAY32.dll

I can fix it by copying the SSLEAY32.dll from the gdal folder in the executable folder or by removing any call to gdal from my code, but I would like to fix my system rather. How to tell Windows to look in the right directory (I played with the PATH a lot with no success).

Using Dependency Walker, it seems that the gdal.dll is not the one from my OSGEO path, but is taken from my miniconda install. Is there a clean way to fix it? I though that if a library had its dependencies in the same folder, those ones would be used.

EDIT: Solution, thanks to Naidu's answer:

add C:\OSGeo4W64\bin; at the beginning of my path, such that the correct gdal202.dll is used in priority.

but now python does not start anymore, because it is not selecting its own gdal libraries in the miniconda folder but rather in OSGeo4W64... I can get one or the other working with the same path but not both

solution place first in the PATH the directory of Miniconda python executable, then OSGeo4W64 libraries path, then Miniconda libraries path

答:
Additional Library Directories will helps in only for looking up the .lib (static libraries) files, but not for DLLs.

The DLLs are looked up as shown in the order in below link.

https://msdn.microsoft.com/en-us/library/7d83bc18.aspx

So now, if your intended DLL is to be picked up, then place the DLL in any of the locations in first 4 steps said in above link..... or you can edit the PATH variable of user variables of Environment variables, with your DLL location.

Because

User variables take precedence over system environment variables. The
  user path is appended to the system path.


问:
Xamarin.Forms on iOS 11.1.2: Webview loads a bigger font
I'm using Xamarin.Forms to load an internet's webpage (requirements of the client, please don't judge me), the problem is that in iOS the webpage appears to be bigger that it is.

I don't have any custom render on iOS.

Here is the website loaded on safari on a iPhone 6 iOS 11.1.2

And here is loaded on the webview

MainPage.xaml

```<code><?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:Juppie"
             x:Class="Juppie.MainPage">
             <Grid>

    <WebView x:Name="Navegador" Source="http://empleosapp.caonainteractive.com/"
    WidthRequest="1000" HeightRequest="1000" IsVisible="{Binding Path=HayInternet}" ></WebView>
    <ActivityIndicator IsRunning="{Binding Path=Navegando}" IsVisible="{Binding Path=Navegando}"
        VerticalOptions="CenterAndExpand"
                               HorizontalOptions="CenterAndExpand"
                               RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent,
                                        Property=Height,
                                        Factor=0.33}"
                               RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent,
                                        Property=Height,
                                        Factor=0.33}"/>
    </Grid>

</ContentPage>
</code>```

MainPage.xaml.cs

```<code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Plugin.Connectivity;
using System.ComponentModel;

namespace Juppie
{
    public partial class MainPage : ContentPage, INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        public MainPage()
        {
            InitializeComponent();

            Navegador.Navigating += Navegador_Navigating;
            Navegador.Navigated += (sender, e) => { Navegando = false; };
            HayInternet = true;
            BindingContext = this;
        }
        bool hayInternet;

        public bool HayInternet
        {
            get
            {
                return hayInternet;
            }

            set
            {
                hayInternet = value;

                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("HayInternet"));

                EvaluarInternet();
            }
        }
        bool navegando;

        public bool Navegando
        {
            get
            {
                return navegando;
            }

            set
            {
                navegando = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Navegando"));

            }
        }

        public async void EvaluarInternet(){
            if (!HayInternet)
            {
             await DisplayAlert("Aviso","Se requiere conexion a internet para emplear esta aplicacion", "OK");
            }
        }

        protected override void OnAppearing()
        {
            HayInternet = CrossConnectivity.IsSupported && CrossConnectivity.Current.IsConnected;

            CrossConnectivity.Current.ConnectivityChanged += (sender, args) =>
            {
                HayInternet = args.IsConnected;
            };

            base.OnAppearing();
        }

        protected override bool OnBackButtonPressed()
        {
            if (Navegador.CanGoBack)
            {
                Navegador.GoBack();
                return false;
            }

            return base.OnBackButtonPressed();
        }

        void Navegador_Navigating(object sender, WebNavigatingEventArgs e)
        {
            Navegando = true;
            if (e.Url.Contains("/banner"))
            {
                e.Cancel = true;

                var uri = new Uri(e.Url.Replace("/banner", ""));
                Device.OpenUri(uri);
            }
        }
    }
}
</code>```

I tried with a custom render and set the scalePageToFit = false, without success.
If anyone knows how can I fix this, please let me know.

答:
Xaml: - VerticalOptions="FillAndExpand" seems to fill the HeightRequest and WidthRequest property specification requirements for the WebView to render in a StackLayout - in a Grid it seems to render anyway:

```<code><Grid>
    <WebView x:Name="webView"
             VerticalOptions="FillAndExpand"
             Source="https://www.xamarin.com/"/>
</Grid>
</code>```

Renderer, ScalesPageToFit is false by default (at least in the simulator with iPhone SE 11.2)

```<code>[assembly: ExportRenderer(typeof(WebView), typeof(MyWebViewRenderer))]
namespace MyNamespace.iOS
{
    public class MyWebViewRenderer : WebViewRenderer
    {
        protected override void OnElementChanged(VisualElementChangedEventArgs e)
        {
            base.OnElementChanged(e);

            if (NativeView != null && e.NewElement != null)
            {
                var webView = ((UIWebView)NativeView);
                webView.ScalesPageToFit = true;
            }
        }
    }
}
</code>```

The screenshots below are from the simulator with iPhone SE.

ScalesPageToFit = true:

ScalesPageToFit = false:

Body:
I'm using Xamarin.Forms to load an internet's webpage (requirements of the client, please don't judge me), the problem is that in iOS the webpage appears to be bigger that it is.

I don't have any custom render on iOS.

Here is the website loaded on safari on a iPhone 6 iOS 11.1.2

And here is loaded on the webview

MainPage.xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:Juppie"
             x:Class="Juppie.MainPage">
             <Grid>

    <WebView x:Name="Navegador" Source="http://empleosapp.caonainteractive.com/"
    WidthRequest="1000" HeightRequest="1000" IsVisible="{Binding Path=HayInternet}" ></WebView>
    <ActivityIndicator IsRunning="{Binding Path=Navegando}" IsVisible="{Binding Path=Navegando}"
        VerticalOptions="CenterAndExpand"
                               HorizontalOptions="CenterAndExpand"
                               RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent,
                                        Property=Height,
                                        Factor=0.33}"
                               RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent,
                                        Property=Height,
                                        Factor=0.33}"/>
    </Grid>

</ContentPage>

MainPage.xaml.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Plugin.Connectivity;
using System.ComponentModel;

namespace Juppie
{
    public partial class MainPage : ContentPage, INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        public MainPage()
        {
            InitializeComponent();

            Navegador.Navigating += Navegador_Navigating;
            Navegador.Navigated += (sender, e) => { Navegando = false; };
            HayInternet = true;
            BindingContext = this;
        }
        bool hayInternet;

        public bool HayInternet
        {
            get
            {
                return hayInternet;
            }

            set
            {
                hayInternet = value;

                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("HayInternet"));

                EvaluarInternet();
            }
        }
        bool navegando;

        public bool Navegando
        {
            get
            {
                return navegando;
            }

            set
            {
                navegando = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Navegando"));

            }
        }

        public async void EvaluarInternet(){
            if (!HayInternet)
            {
             await DisplayAlert("Aviso","Se requiere conexion a internet para emplear esta aplicacion", "OK");
            }
        }

        protected override void OnAppearing()
        {
            HayInternet = CrossConnectivity.IsSupported && CrossConnectivity.Current.IsConnected;

            CrossConnectivity.Current.ConnectivityChanged += (sender, args) =>
            {
                HayInternet = args.IsConnected;
            };

            base.OnAppearing();
        }

        protected override bool OnBackButtonPressed()
        {
            if (Navegador.CanGoBack)
            {
                Navegador.GoBack();
                return false;
            }

            return base.OnBackButtonPressed();
        }

        void Navegador_Navigating(object sender, WebNavigatingEventArgs e)
        {
            Navegando = true;
            if (e.Url.Contains("/banner"))
            {
                e.Cancel = true;

                var uri = new Uri(e.Url.Replace("/banner", ""));
                Device.OpenUri(uri);
            }
        }
    }
}

I tried with a custom render and set the scalePageToFit = false, without success.
If anyone knows how can I fix this, please let me know.

Body:
Xaml: - VerticalOptions="FillAndExpand" seems to fill the HeightRequest and WidthRequest property specification requirements for the WebView to render in a StackLayout - in a Grid it seems to render anyway:

<Grid>
    <WebView x:Name="webView"
             VerticalOptions="FillAndExpand"
             Source="https://www.xamarin.com/"/>
</Grid>

Renderer, ScalesPageToFit is false by default (at least in the simulator with iPhone SE 11.2)

[assembly: ExportRenderer(typeof(WebView), typeof(MyWebViewRenderer))]
namespace MyNamespace.iOS
{
    public class MyWebViewRenderer : WebViewRenderer
    {
        protected override void OnElementChanged(VisualElementChangedEventArgs e)
        {
            base.OnElementChanged(e);

            if (NativeView != null && e.NewElement != null)
            {
                var webView = ((UIWebView)NativeView);
                webView.ScalesPageToFit = true;
            }
        }
    }
}

The screenshots below are from the simulator with iPhone SE.

ScalesPageToFit = true:

ScalesPageToFit = false:


问:
Laravel app doesn't work after moving to Homestead
So I used XAMPP, but I had few problems with it, so my employer told me to move to homestead. I created VB and moved my laravel app folder to linked folder for homestead. I run all migrations and seeding and it successfully completed, but now I get this error:
error

What could be the problem? I haven't touched the code.

答: In your Homestead.yaml file you can add a php: "7.1" key to the site settings so specify which version of PHP you'd like to use for that site. This way you can easily swap PHP versions.


问:
MS Access report Pass through query to SQL Server with parameter
I have a PDF report that opens when one clicks on a form button. Recently we've had to migrate the db to SQL Server. I have a stored procedure in SQL Server that requires one argument and I'm trying to access the stored procedure from Ms Access front end. Anyone knows how to go about this; from the syntax of the Pass Through Query to the report's code for opening. Any help will be gladly appreciated.</p>

答:
I'm assuming you are not still using pre-2007 Access.....</p>

```<code>Access 2007
On the Create tab, click Query Design in the Other group.
Click Close in the Show Table dialog box without adding any tables or queries.
On the Design tab, click Pass-Through in the Query Type workgroup.
Click Property Sheet in the Show/Hide workgroup to display the property sheet for the query.
In the query property sheet, place the mouse pointer in the
ODBC Connect Str property, and then, click the Build (...) button.

With the ODBC Connect Str property, you specify information about the database to which you want to connect. You can type the connection information, or click Build, and then enter information about the server to which you are connecting.
When you are prompted to save the password in the connection string, click Yes if you want the password and logon name to be stored in the connection string information.
If the query is not the type that returns records, set the ReturnsRecords property to No.
In the SQL Pass-Through Query window, type your pass-through query. For example, the following pass-through query uses the Microsoft SQL Server TOP operator in the SELECT statement to return only the first 25 orders in the Orders table from the sample Northwind database:
SELECT TOP 25 orderid from orders
To run the query, click Run in the Results group on the Design tab. For a SQL pass-through query that returns records, click Datasheet view on the status bar.
If necessary, Microsoft Access prompts you for information about your server database.
</code>```

Body:
I'm assuming you are not still using pre-2007 Access.....

Access 2007
On the Create tab, click Query Design in the Other group.
Click Close in the Show Table dialog box without adding any tables or queries.
On the Design tab, click Pass-Through in the Query Type workgroup.
Click Property Sheet in the Show/Hide workgroup to display the property sheet for the query.
In the query property sheet, place the mouse pointer in the
ODBC Connect Str property, and then, click the Build (...) button.

With the ODBC Connect Str property, you specify information about the database to which you want to connect. You can type the connection information, or click Build, and then enter information about the server to which you are connecting.
When you are prompted to save the password in the connection string, click Yes if you want the password and logon name to be stored in the connection string information.
If the query is not the type that returns records, set the ReturnsRecords property to No.
In the SQL Pass-Through Query window, type your pass-through query. For example, the following pass-through query uses the Microsoft SQL Server TOP operator in the SELECT statement to return only the first 25 orders in the Orders table from the sample Northwind database:
SELECT TOP 25 orderid from orders
To run the query, click Run in the Results group on the Design tab. For a SQL pass-through query that returns records, click Datasheet view on the status bar.
If necessary, Microsoft Access prompts you for information about your server database.


问:
How to deploy node app on openshift and run it?

Just created a very simple hello world app using node:

```<code>var express = require('express');
var app = express();
app.get('/', function (req, res) {
  res.send('Hello World!');
});
var server_port = process.env.OPENSHIFT_NODEJS_PORT || 8080
var server_ip_address = process.env.OPENSHIFT_NODEJS_IP || '127.0.0.1'

app.listen(server_port, server_ip_address, function () {
  console.log( "Listening on " + server_ip_address + ", port " + server_port )
});
</code>```

and it works as it is expected in my local machine,

put that on github and deployed it on openshift, pod created and server running fine:

 but when I browse the route which I could find it in Application>>routes menu it says:

```<code>Application is not available

The application is currently not serving requests at this endpoint. It may not have been started or is still starting.
I guess I'm using the latest version of openshift since just created an account.
</code>```

I'm expecting it to show me the Hello world!

update1:

here is my package.json:

```<code>{
  "name": "npmtest",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node index.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.16.2"
  }
}
</code>```

答: Your application server IP address needs to be 0.0.0.0. So you either specify an environment variable for that, or hard code it.

Body:
Just created a very simple hello world app using node:

var express = require('express');
var app = express();
app.get('/', function (req, res) {
  res.send('Hello World!');
});
var server_port = process.env.OPENSHIFT_NODEJS_PORT || 8080
var server_ip_address = process.env.OPENSHIFT_NODEJS_IP || '127.0.0.1'

app.listen(server_port, server_ip_address, function () {
  console.log( "Listening on " + server_ip_address + ", port " + server_port )
});

and it works as it is expected in my local machine,

put that on github and deployed it on openshift, pod created and server running fine:

 but when I browse the route which I could find it in Application>>routes menu it says:

Application is not available

The application is currently not serving requests at this endpoint. It may not have been started or is still starting.
I guess I'm using the latest version of openshift since just created an account.

I'm expecting it to show me the Hello world!

update1:

here is my package.json:

{
  "name": "npmtest",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node index.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.16.2"
  }
}


问:
fmap applied to types other than the type variable
I have a datatype which keeps track of a 'block' of numbers (kinda like a matrix).

```<code>newtype Block a = Block [[a]]
</code>```

I would like to make it an instance of Functor. However, I am trying to do it in such a way that fmap can apply to the whole list block, so that fmap has type fmap :: [[a]] -> [[b]] instead of type fmap :: a -> b.

The reason is because I would like to map into my Block functor functions like transpose which apply to the list block [[a]] not to each element a. That is, I would like to be able to define functions like

```<code>transposeBlock :: Block a -> Block a
transposeBlock = (transpose <$>)
</code>```

I tried to declare my functor instance as the following.

```<code>instance Functor (Block [[a]]) where
  fmap f (Block x) = Block (f x)
</code>```

But I ran into the type errors that arise from attempting to compile this.

```<code>error:
• Expecting one fewer argument to ‘Block [[a]]’
  Expected kind ‘* -> *’, but ‘Block [[a]]’ has kind ‘*’
• In the first argument of ‘Functor’, namely ‘Block [[a]]’
  In the instance declaration for ‘Functor (Block [[a]])’
</code>```

What are some ways that I could map functions into the list block [[a]] of my Block type?

答:
The easiest way to achieve that would be

```<code>newtype BlockWr a = Block a deriving (Functor)
type Block a = BlockWr [[a]]
</code>```

Now transposeBlock = (transpose <$>) would work.

But I wouldn't recommend this. BlockWr is just the identity functor, this is not very useful.

Really, the point is that Block a is isomorphic to [[a]]. You can witness that:

```<code>{-# LANGUAGE TemplateHaskell #-}

import Control.Lens
import Control.Lens.TH

newtype Block a = Block {_blockMat::[[a]]}
makeLenses ''Block

transposeBlock :: Block a -> Block a
transposeBlock = blockMat %~ transpose
</code>```

Body:
I have a datatype which keeps track of a 'block' of numbers (kinda like a matrix).

newtype Block a = Block [[a]]

I would like to make it an instance of Functor. However, I am trying to do it in such a way that fmap can apply to the whole list block, so that fmap has type fmap :: [[a]] -> [[b]] instead of type fmap :: a -> b.

The reason is because I would like to map into my Block functor functions like transpose which apply to the list block [[a]] not to each element a. That is, I would like to be able to define functions like

transposeBlock :: Block a -> Block a
transposeBlock = (transpose <$>)

I tried to declare my functor instance as the following.

instance Functor (Block [[a]]) where
  fmap f (Block x) = Block (f x)

But I ran into the type errors that arise from attempting to compile this.

error:
• Expecting one fewer argument to ‘Block [[a]]’
  Expected kind ‘* -> *’, but ‘Block [[a]]’ has kind ‘*’
• In the first argument of ‘Functor’, namely ‘Block [[a]]’
  In the instance declaration for ‘Functor (Block [[a]])’

What are some ways that I could map functions into the list block [[a]] of my Block type?

Body:
The easiest way to achieve that would be

newtype BlockWr a = Block a deriving (Functor)
type Block a = BlockWr [[a]]

Now transposeBlock = (transpose <$>) would work.

But I wouldn't recommend this. BlockWr is just the identity functor, this is not very useful.

Really, the point is that Block a is isomorphic to [[a]]. You can witness that:

{-# LANGUAGE TemplateHaskell #-}

import Control.Lens
import Control.Lens.TH

newtype Block a = Block {_blockMat::[[a]]}
makeLenses ''Block

transposeBlock :: Block a -> Block a
transposeBlock = blockMat %~ transpose


问:
download url in txt format into pandas dataframe
I am having trouble trying to download the data from this particular URL and store it in a pandas data-frame.  Can anyone help with this?

```<code>url ='http://www2.conectiv.com/cpd/tps/archives/nj/2017/12/20171205NJA1.txt'
</code>```

I need to store each Segment as a row with corresponding numbers in separate columns.  so, I need it in this format:

```<code>NJAAP, 12/5/2017, 37.63, 36.34, 35.97,..., 38.52
NJAAS, 12/5/2017, 37.63, 36.34, ...        etc
</code>```

I tried the following method:

```<code>import pandas as pd
from urllib.request import urlopen

df = pd.read_csv(url, skiprows=4)
</code>```

But, I am not getting what i wanted.  I am getting this instead:

```<code>Segment:NJAAP 12/05/2017 37.63 36.34 35.97 35.76 36.71 39.90 46.36 52.49 56.16 58.41 58.98 59.60 59.58 58.52 57.40 54.34 53.90 53.15 51.44 49.49 46.96 44.12 41.02 38.52
0   Segment:NJAAS 12/05/2017 ...
1   Segment:NJADC 12/05/2017 ...
2   Segment:NJAGN 12/05/2017 ...
3   Segment:NJAGT 12/05/2017 ...
</code>```

Can someone please help?  Thanks

答:
read_csv() has many useful options

header=None - and first row is not treated as headers.

sep='\s+' - and it uses spaces to split columns (instead of comma ,). It is regex.

.

```<code>import pandas as pd

url ='http://www2.conectiv.com/cpd/tps/archives/nj/2017/12/20171205NJA1.txt'
df = pd.read_csv(url, skiprows=4, header=None, sep='\s+')
</code>```

After you load data you can change values in columns.

This removes Segments: in first column

```<code>df[0] = df[0].str.replace('Segment:', '')
</code>```

Body:
I am having trouble trying to download the data from this particular URL and store it in a pandas data-frame.  Can anyone help with this?

url ='http://www2.conectiv.com/cpd/tps/archives/nj/2017/12/20171205NJA1.txt'

I need to store each Segment as a row with corresponding numbers in separate columns.  so, I need it in this format:

NJAAP, 12/5/2017, 37.63, 36.34, 35.97,..., 38.52
NJAAS, 12/5/2017, 37.63, 36.34, ...        etc

I tried the following method:

import pandas as pd
from urllib.request import urlopen

df = pd.read_csv(url, skiprows=4)

But, I am not getting what i wanted.  I am getting this instead:

Segment:NJAAP 12/05/2017 37.63 36.34 35.97 35.76 36.71 39.90 46.36 52.49 56.16 58.41 58.98 59.60 59.58 58.52 57.40 54.34 53.90 53.15 51.44 49.49 46.96 44.12 41.02 38.52
0   Segment:NJAAS 12/05/2017 ...
1   Segment:NJADC 12/05/2017 ...
2   Segment:NJAGN 12/05/2017 ...
3   Segment:NJAGT 12/05/2017 ...

Can someone please help?  Thanks

Body:
read_csv() has many useful options

header=None - and first row is not treated as headers.

sep='\s+' - and it uses spaces to split columns (instead of comma ,). It is regex.

.

import pandas as pd

url ='http://www2.conectiv.com/cpd/tps/archives/nj/2017/12/20171205NJA1.txt'
df = pd.read_csv(url, skiprows=4, header=None, sep='\s+')

After you load data you can change values in columns.

This removes Segments: in first column

df[0] = df[0].str.replace('Segment:', '')

ContentLicense: CC BY-SA 4.0


问:
how to convert float and string into integer value in python3
i have a value which is float and string (it's in quotation marks) and i have to convert a integer value.
for example ,when i write x = "1.2", i want take this output:1

i wrote this code:

```<code>x = "1.2"
print(int(x))
</code>```

but i get this error:

```<code>Traceback (most recent call last):
  File xxx, line 2, in <module>
    print(int(x))
ValueError: invalid literal for int() with base 10: '1.2'
</code>```

how can i fix this ?

答:
If you know the string is going to be a float use float(x) to turn it in to a float first. Then you can use int() around that or if you need to round you can use another function like round() to round the number.

```<code>print(int(float(x))
</code>```

Body:
i have a value which is float and string (it's in quotation marks) and i have to convert a integer value.
for example ,when i write x = "1.2", i want take this output:1

i wrote this code:

x = "1.2"
print(int(x))

but i get this error:

Traceback (most recent call last):
  File xxx, line 2, in <module>
    print(int(x))
ValueError: invalid literal for int() with base 10: '1.2'

how can i fix this ?

Body:
If you know the string is going to be a float use float(x) to turn it in to a float first. Then you can use int() around that or if you need to round you can use another function like round() to round the number.

print(int(float(x))


问:
How to get ImageView scale to fill the layout as much as the width permits
What I want is for the ImageView to scale with the same ratio to fill the layout without being cropped. Since the width is going to match first, effectively, this means scaling until the width is maximized.

My code is:

```<code>@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_display);
    ImageView img = findViewById(R.id.displayImg);
    img.setImageBitmap(bmp); // bmp is a public static Bitmap set by another class
    img.setRotation(90);
    img.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
}
</code>```

My layout is:

```<code><?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

   <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/displayImg" />

</android.support.constraint.ConstraintLayout>
</code>```

As per Android ImageView ScaleType: A Visual Guide CENTER_INSIDE should

Scale the image uniformly (maintain the image’s aspect ratio) so that both dimensions (width and height) of the image will be equal to or less than the corresponding dimension of the view (minus padding).

The black image is what I'm currently, and I've drawn what I believe I should be seeing instead (as you can tell, I'm the modern-day Michelangelo).

答:
You may acheive your desired result by making the dimensions of the ImageView match to the parent layout and apply fitCenter as a scaleType so it fills the view without losing aspect ratio:</p>

```<code><?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
   <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="fitCenter"
        android:id="@+id/displayImg" />
</android.support.constraint.ConstraintLayout>
</code>```

Body:
What I want is for the ImageView to scale with the same ratio to fill the layout without being cropped. Since the width is going to match first, effectively, this means scaling until the width is maximized.

My code is:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_display);
    ImageView img = findViewById(R.id.displayImg);
    img.setImageBitmap(bmp); // bmp is a public static Bitmap set by another class
    img.setRotation(90);
    img.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
}

My layout is:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

   <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/displayImg" />

</android.support.constraint.ConstraintLayout>

As per Android ImageView ScaleType: A Visual Guide CENTER_INSIDE should

Scale the image uniformly (maintain the image’s aspect ratio) so that both dimensions (width and height) of the image will be equal to or less than the corresponding dimension of the view (minus padding).

The black image is what I'm currently, and I've drawn what I believe I should be seeing instead (as you can tell, I'm the modern-day Michelangelo).

Body:
You may acheive your desired result by making the dimensions of the ImageView match to the parent layout and apply fitCenter as a scaleType so it fills the view without losing aspect ratio:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
   <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="fitCenter"
        android:id="@+id/displayImg" />
</android.support.constraint.ConstraintLayout>


问:
Unable to connect to neo4j server on my aws ec2 instance - port 7474
After installing neo4j on my aws ec2 instance, the following seems to indicate that the server is up.

```<code># bin/neo4j console
Active database: graph.db
Directories in use:
  home:         /usr/local/share/neo4j-community-3.3.1
  config:       /usr/local/share/neo4j-community-3.3.1/conf
  logs:         /usr/local/share/neo4j-community-3.3.1/logs
  plugins:      /usr/local/share/neo4j-community-3.3.1/plugins
  import:       /usr/local/share/neo4j-community-3.3.1/import
  data:         /usr/local/share/neo4j-community-3.3.1/data
  certificates: /usr/local/share/neo4j-community-3.3.1/certificates
  run:          /usr/local/share/neo4j-community-3.3.1/run
Starting Neo4j.
WARNING: Max 1024 open files allowed, minimum of 40000 recommended.
See the Neo4j manual.
2017-12-01 16:03:04.380+0000 INFO  ======== Neo4j 3.3.1 ========
2017-12-01 16:03:04.447+0000 INFO  Starting...
2017-12-01 16:03:05.986+0000 INFO  Bolt enabled on 127.0.0.1:7687.
2017-12-01 16:03:11.206+0000 INFO  Started.
2017-12-01 16:03:12.860+0000 INFO  Remote interface available at
http://localhost:7474/
</code>```

At this point I am not able to connect. I have opened up ports 7474 - and 7687 - and I can access port 80, plus ssh into the instance, etc.

Is this a neo4j or aws problem?

Any help is appreciated.

Colin Goldberg

答: Set the dbms.connectors.default_listen_address to be 0.0.0.0, then only open the SSL port located on 7473 using Amazon's ec2 security groups. Don't use 7474 if you don't have to.</p>

Body:
After installing neo4j on my aws ec2 instance, the following seems to indicate that the server is up.

# bin/neo4j console
Active database: graph.db
Directories in use:
  home:         /usr/local/share/neo4j-community-3.3.1
  config:       /usr/local/share/neo4j-community-3.3.1/conf
  logs:         /usr/local/share/neo4j-community-3.3.1/logs
  plugins:      /usr/local/share/neo4j-community-3.3.1/plugins
  import:       /usr/local/share/neo4j-community-3.3.1/import
  data:         /usr/local/share/neo4j-community-3.3.1/data
  certificates: /usr/local/share/neo4j-community-3.3.1/certificates
  run:          /usr/local/share/neo4j-community-3.3.1/run
Starting Neo4j.
WARNING: Max 1024 open files allowed, minimum of 40000 recommended.
See the Neo4j manual.
2017-12-01 16:03:04.380+0000 INFO  ======== Neo4j 3.3.1 ========
2017-12-01 16:03:04.447+0000 INFO  Starting...
2017-12-01 16:03:05.986+0000 INFO  Bolt enabled on 127.0.0.1:7687.
2017-12-01 16:03:11.206+0000 INFO  Started.
2017-12-01 16:03:12.860+0000 INFO  Remote interface available at
http://localhost:7474/

At this point I am not able to connect. I have opened up ports 7474 - and 7687 - and I can access port 80, plus ssh into the instance, etc.

Is this a neo4j or aws problem?

Any help is appreciated.

Colin Goldberg