Resolved At Design View, Form Does Not Showing Any Control

SiamIT

Well-known member
Joined
Aug 3, 2021
Messages
53
Programming Experience
5-10
Greeting, i have manually convert a vb.net design file to c# file.

though it's working/showing fine on run time.. but on design view it's not showing anything (controls)

this is how it looks like on design view:

At Design Time.png


And this is how it looks likes on run time:

At Run Time.png


after many hours of trying i can't find any reason for that.. that's why i am here for some help!

here is the contents for RegForm.Designer.cs:


C#:
using System.Windows.Forms;

namespace SiamIT.NW
{
    public partial class RegForm : Form
    {

        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.cmdRequest = new System.Windows.Forms.Button();
            this.txtRefID = new System.Windows.Forms.TextBox();
            this.txtName = new System.Windows.Forms.TextBox();
            this.lblRefID = new System.Windows.Forms.Label();
            this.lblTitle = new System.Windows.Forms.Label();
            this.txtMobile = new System.Windows.Forms.TextBox();
            this.lblMobile = new System.Windows.Forms.Label();
            this.cmdCancel = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            //cmdRequest
            //
            this.cmdRequest.Location = new System.Drawing.Point(200, 45);
            this.cmdRequest.Name = "cmdRequest";
            this.cmdRequest.Size = new System.Drawing.Size(252, 48);
            this.cmdRequest.TabIndex = 6;
            this.cmdRequest.Text = "Request Activation Code";
            this.cmdRequest.UseVisualStyleBackColor = true;
            //
            //txtRefID
            //
            this.txtRefID.Location = new System.Drawing.Point(12, 132);
            this.txtRefID.MaxLength = 25;
            this.txtRefID.Name = "txtRefID";
            this.txtRefID.Size = new System.Drawing.Size(174, 20);
            this.txtRefID.TabIndex = 5;
            this.txtRefID.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            //
            //txtName
            //
            this.txtName.Location = new System.Drawing.Point(12, 29);
            this.txtName.MaxLength = 100;
            this.txtName.Name = "txtName";
            this.txtName.Size = new System.Drawing.Size(174, 20);
            this.txtName.TabIndex = 1;
            this.txtName.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            //
            //lblRefID
            //
            this.lblRefID.AutoSize = true;
            this.lblRefID.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblRefID.Location = new System.Drawing.Point(9, 113);
            this.lblRefID.Name = "lblRefID";
            this.lblRefID.Size = new System.Drawing.Size(113, 16);
            this.lblRefID.TabIndex = 4;
            this.lblRefID.Text = "&Transaction ID:";
            //
            //lblTitle
            //
            this.lblTitle.AutoSize = true;
            this.lblTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblTitle.Location = new System.Drawing.Point(9, 9);
            this.lblTitle.Name = "lblTitle";
            this.lblTitle.Size = new System.Drawing.Size(96, 16);
            this.lblTitle.TabIndex = 0;
            this.lblTitle.Text = "Client Name:";
            //
            //txtMobile
            //
            this.txtMobile.Location = new System.Drawing.Point(12, 80);
            this.txtMobile.MaxLength = 11;
            this.txtMobile.Name = "txtMobile";
            this.txtMobile.Size = new System.Drawing.Size(174, 20);
            this.txtMobile.TabIndex = 3;
            this.txtMobile.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            //
            //lblMobile
            //
            this.lblMobile.AutoSize = true;
            this.lblMobile.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblMobile.Location = new System.Drawing.Point(9, 61);
            this.lblMobile.Name = "lblMobile";
            this.lblMobile.Size = new System.Drawing.Size(102, 16);
            this.lblMobile.TabIndex = 2;
            this.lblMobile.Text = "Client Mobile:";
            //
            //cmdCancel
            //
            this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.cmdCancel.Location = new System.Drawing.Point(200, 100);
            this.cmdCancel.Name = "cmdCancel";
            this.cmdCancel.Size = new System.Drawing.Size(252, 23);
            this.cmdCancel.TabIndex = 7;
            this.cmdCancel.Text = "Cancel";
            this.cmdCancel.UseVisualStyleBackColor = true;
            //
            //RegForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.CancelButton = this.cmdCancel;
            this.ClientSize = new System.Drawing.Size(469, 175);
            this.Controls.Add(this.cmdCancel);
            this.Controls.Add(this.txtMobile);
            this.Controls.Add(this.lblMobile);
            this.Controls.Add(this.cmdRequest);
            this.Controls.Add(this.txtRefID);
            this.Controls.Add(this.txtName);
            this.Controls.Add(this.lblRefID);
            this.Controls.Add(this.lblTitle);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "RegForm";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "Registration";
            this.ResumeLayout(false);
            this.PerformLayout();
        }

        #endregion

        internal System.Windows.Forms.Button cmdRequest;
        internal System.Windows.Forms.TextBox txtRefID;
        internal System.Windows.Forms.TextBox txtName;
        internal System.Windows.Forms.Label lblRefID;
        internal System.Windows.Forms.Label lblTitle;
        internal System.Windows.Forms.TextBox txtMobile;
        internal System.Windows.Forms.Label lblMobile;
        internal System.Windows.Forms.Button cmdCancel;
    }
}

any idea what i have messed up?

thanks in advance..
 
The only obvious difference I can see, although I'm not sure why it would matter, is that this:
C#:
public partial class RegForm : Form
would normally be this:
C#:
partial class RegForm
The line you have would be in the user code file.

Have you tried adding a control in the designer? Hard to say what will happen, so make sure that you have backed up first.
 
The only obvious difference I can see, although I'm not sure why it would matter, is that this:
C#:
public partial class RegForm : Form
would normally be this:
C#:
partial class RegForm
The line you have would be in the user code file.

Have you tried adding a control in the designer? Hard to say what will happen, so make sure that you have backed up first.

sorry, but that didn't make any changes so i revert back to original :(

Does the form look correctly nested in the Solution Explorer?

great.. it's look like project file was corrupted (not formed correctly by the converter)

previously it was like this:

XML:
    <Compile Include="RegForm.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="RegForm.Designer.cs" />
C#:

but it should be and i changed to:

XML:
    <Compile Include="RegForm.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="RegForm.Designer.cs">
      <DependentUpon>RegForm.cs</DependentUpon>
    </Compile>

and it's looks like it solved the case :)

once again thanks a lot for your support,

A special thanks.. as it seems you are also the same person (by user name) who was helping me over years from vbnetforums as well :)

now i moved to c# and that causing some issues as well..

best regards
 

Latest posts

Back
Top Bottom