I currently moved my windows form project to a different PC. In the project UI have some text boxes with a default value of "0". Before the move this worked fine. now if I run the code the UI does not show
this default values.
designer Code:

namespace PersonalBudget
{
    partial class Planner
    {
        /// <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.incomeOthertxt = new System.Windows.Forms.TextBox();
            this.savingTransfertxtbox = new System.Windows.Forms.TextBox();
            this.cashgifttxt = new System.Windows.Forms.TextBox();
            this.salarytxt = new System.Windows.Forms.TextBox();

 // 
            // incomeOthertxt
            // 
            this.incomeOthertxt.Location = new System.Drawing.Point(119, 90);
            this.incomeOthertxt.Name = "incomeOthertxt";
            this.incomeOthertxt.Size = new System.Drawing.Size(51, 20);
            this.incomeOthertxt.TabIndex = 4;
            this.incomeOthertxt.Text = "0";
            this.incomeOthertxt.TextChanged += new System.EventHandler(this.OnTextChangedSalary);
            // 
            // savingTransfertxtbox
            // 
            this.savingTransfertxtbox.Location = new System.Drawing.Point(119, 65);
            this.savingTransfertxtbox.Name = "savingTransfertxtbox";
            this.savingTransfertxtbox.Size = new System.Drawing.Size(51, 20);
            this.savingTransfertxtbox.TabIndex = 3;
            this.savingTransfertxtbox.Text = "0";
            this.savingTransfertxtbox.TextChanged += new System.EventHandler(this.OnTextChangedSalary);
            // 
            // cashgifttxt
            // 
            this.cashgifttxt.Location = new System.Drawing.Point(119, 42);
            this.cashgifttxt.Name = "cashgifttxt";
            this.cashgifttxt.Size = new System.Drawing.Size(51, 20);
            this.cashgifttxt.TabIndex = 2;
            this.cashgifttxt.Text = "0";
            this.cashgifttxt.TextChanged += new System.EventHandler(this.OnTextChangedSalary);
            // 
            // salarytxt
            // 
            this.salarytxt.Location = new System.Drawing.Point(119, 20);
            this.salarytxt.Name = "salarytxt";
            this.salarytxt.Size = new System.Drawing.Size(51, 20);
            this.salarytxt.TabIndex = 1;
            this.salarytxt.Text = "0";
            this.salarytxt.TextChanged += new System.EventHandler(this.OnTextChangedSalary);
}
 private System.Windows.Forms.TextBox cashgifttxt;
        private System.Windows.Forms.TextBox salarytxt;
private System.Windows.Forms.TextBox incomeOthertxt;
private System.Windows.Forms.TextBox savingTransfertxtbox;
}

thanks for your help..

Recommended Answers

All 8 Replies

Does it show the textboxes?

Does it show the textboxes?

yes, but not the values

I simulated a textbox like you have and I encounter no problem.
Did you copy all the code because your designer code is not complete, but I guess you did it to keep your post shorter.

no I didn't copy all the code:

Coming to think of it: designer code is very rarely problematic, you may look at it, but you may gererally not touch it. It is managed by VS.
So if you still have problems they must come from something other.

here you go

namespace PersonalBudget
      {

      partial class Planner
      {
      /// <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.incomeOthertxt = new System.Windows.Forms.TextBox();
      this.savingTransfertxtbox = new System.Windows.Forms.TextBox();
      this.cashgifttxt = new System.Windows.Forms.TextBox();
      this.salarytxt = new System.Windows.Forms.TextBox();
       
      //
      // incomeOthertxt
      //
      this.incomeOthertxt.Location = new System.Drawing.Point(119, 90);
      this.incomeOthertxt.Name = "incomeOthertxt";
      this.incomeOthertxt.Size = new System.Drawing.Size(51, 20);
      this.incomeOthertxt.TabIndex = 4;
      this.incomeOthertxt.Text = "0";
      this.incomeOthertxt.TextChanged += new System.EventHandler(this.OnTextChangedSalary);
      //
      // savingTransfertxtbox
      //
      this.savingTransfertxtbox.Location = new System.Drawing.Point(119, 65);
      this.savingTransfertxtbox.Name = "savingTransfertxtbox";
      this.savingTransfertxtbox.Size = new System.Drawing.Size(51, 20);
      this.savingTransfertxtbox.TabIndex = 3;
      this.savingTransfertxtbox.Text = "0";
      this.savingTransfertxtbox.TextChanged += new System.EventHandler(this.OnTextChangedSalary);
      //
      // cashgifttxt
      //
      this.cashgifttxt.Location = new System.Drawing.Point(119, 42);
      this.cashgifttxt.Name = "cashgifttxt";
      this.cashgifttxt.Size = new System.Drawing.Size(51, 20);
      this.cashgifttxt.TabIndex = 2;
      this.cashgifttxt.Text = "0";
      this.cashgifttxt.TextChanged += new System.EventHandler(this.OnTextChangedSalary);
      //
      // salarytxt
      //
      this.salarytxt.Location = new System.Drawing.Point(119, 20);
      this.salarytxt.Name = "salarytxt";
      this.salarytxt.Size = new System.Drawing.Size(51, 20);
      this.salarytxt.TabIndex = 1;
      this.salarytxt.Text = "0";
      this.salarytxt.TextChanged += new System.EventHandler(this.OnTextChangedSalary);
      }
      private System.Windows.Forms.TextBox cashgifttxt;
      private System.Windows.Forms.TextBox salarytxt;
      private System.Windows.Forms.TextBox incomeOthertxt;
      private System.Windows.Forms.TextBox savingTransfertxtbox;
      }

you must copy all your code......

Thanks guys, I found the problem. I had a reset method that ran each time the application starts Thereby setting all the text boxes to null...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.