Raghavendra Kumar
Raghavendra Kumar

Reputation: 728

Windows Forms re-arranging elements in table layout panel

I am developing a POS system in .net with windows forms as the GUI. I am facing a very peculiar problem with one window in my app.

(Note : Application is compiled for .net 4 framework and as a windows forms project. I am using a table layout to arrange all the elements in the form).

Given below is the screenshot of the form in Visual Studio.

Window as seen in Visual Studio 2012

Following is the screenshot in my system (Windows 8 Pro, DELL Full HD monitor).

Window as shown in my system.

Now I am building the executable files and DLL's and copying them into my dad's system (Windows 7, 1440 X 900 monitor). The application runs successfully but the output is shown below.

Application running in my dad's system

Two things have changed.

  1. The Start-Date and End-Date labels and calendars both have swapped (I tested this functionally too. The start date cannot be later than the end date, if so an error is given. I have checked by this, and the calendars are swapped too.)

  2. The format of the Dates being displayed is changed.

NOTE : I have such minor problems in other windows too.

Has anyone ever come across such problem?

Upvotes: 3

Views: 2504

Answers (1)

Raghavendra Kumar
Raghavendra Kumar

Reputation: 728

I found out the solution.

The windows designer generated code is added the controls in the tablelayoutpanel object in a wrong way.

The windows designer panel is adding controls to the tablelayoutpanel into the same cell.

Ex : Incorrect Code

this.tableLayoutPanel5.Controls.Add(this.tbInvoice, 0, 0);
this.tableLayoutPanel5.Controls.Add(this.label4, 0, 0);

Correct Code

this.tableLayoutPanel5.Controls.Add(this.tbInvoice, 1, 0);
this.tableLayoutPanel5.Controls.Add(this.label4, 0, 0);

Solution : Re-arrange the controls in the panel by removing them or moving them into a separate table and then moving them back.

Upvotes: 2

Related Questions