本文介绍了我遇到关于tabcontrol的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我单击选项卡时,错误消息会弹出,如下所示:
控件System.Windows.Forms.TabControl在设计器中引发了未处理的异常,并且已被禁用.
When I click the tab then the error message popup as follows:
The control System.Windows.Forms.TabControl has thrown an unhandled exception in the designer and has been disabled.
Exception:
Object reference not set to an instance of an object.
Stack trace:
at
System.Windows.Forms.TabControl.UpdateTabSelection(Boolean updateFocus)
at
System.Windows.Forms.TabControl.OnSelectedIndexChanged(EventArgs e)
at System.Windows.Forms.TabControl.WmSelChange()
at System.Windows.Forms.TabControl.Wndproc(Message& m)
只有两个标签
only two tabs
//
// tabControlServings
//
this.tabControlServings.Appearance = System.Windows.Forms.TabAppearance.FlatButtons;
this.tabControlServings.Controls.Add(this.tabPageServingList);
this.tabControlServings.Controls.Add(this.tabPageServingType);
this.tabControlServings.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControlServings.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabControlServings.ItemSize = new System.Drawing.Size(120, 40);
this.tabControlServings.Location = new System.Drawing.Point(0, 0);
this.tabControlServings.Name = "tabControlServings";
this.tabControlServings.SelectedIndex = 0;
this.tabControlServings.Size = new System.Drawing.Size(409, 567);
this.tabControlServings.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
this.tabControlServings.TabIndex = 11;
//
// tabPageServingType
//
this.tabPageServingType.Controls.Add(this.panel2);
this.tabPageServingType.Controls.Add(this.panel1);
this.tabPageServingType.Controls.Add(this.dataRepeaterServingType);
this.tabPageServingType.Location = new System.Drawing.Point(4, 44);
this.tabPageServingType.Name = "tabPageServingType";
this.tabPageServingType.Padding = new System.Windows.Forms.Padding(3);
this.tabPageServingType.Size = new System.Drawing.Size(401, 519);
this.tabPageServingType.TabIndex = 1;
this.tabPageServingType.Text = "Serving Type";
this.tabPageServingType.UseVisualStyleBackColor = true;
它构建成功,仅在设计器视图中单击选项卡时才会出现错误.
F5和调试没有出现错误,我不知道为什么.
It build success, the error appears just when clicking the tab in the designer view.
F5 and debugging there is no error appeared, I don''t know why.
推荐答案
这篇关于我遇到关于tabcontrol的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!