[問題] tabcontrol and binding source

看板C_Sharp作者時間9年前 (2014/07/27 14:38), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
我有一個tabcontrol 有兩個tabpage 按照這篇作法 儲存表單的資料 http://www.dotblogs.com.tw/yc421206/archive/2011/07/08/31290.aspx tabpage1有一個config1.xml tabpage2有一個config2.xml 我在formload的時候依序執行兩個function function1()是負責讀取config1.xml for tabpage1,內容為: BindingList<Config> configs = null; if (File.Exists("Configs1.xml")) { configs = XmlSerialize.DeserializeFromXml<BindingList<Config>>("Configs.xml"); } else { configs = new BindingList<Config>(); configs.Add(new Config() { ProductName = "Test", Axis = "A", Acceleration = 1000, Deceleration = 1000, Speed = 1000, Position = 1000 }); } this._Source.DataSource = configs; this.bindingNavigator1.BindingSource = this._Source; this.dataGridView1.DataSource = this._Source; this.comboBox1.DataSource = this._Source; this.comboBox1.DisplayMember = "ProductName"; this.txtDeceleration.DataBindings.Add("Text", this._Source, "Deceleration"); this.txtPosition.DataBindings.Add("Text", this._Source, "Position"); this.txtAxis.DataBindings.Add("Text", this._Source, "Axis"); this.txtAcceleration.DataBindings.Add("Text", this._Source, "Acceleration"); this.txtSpeed.DataBindings.Add("Text", this._Source, "Speed"); 同樣的function2()是負責讀取config2.xml for tabpage2 但是fuction2裡面的textbox的text卻沒有assign到東西 是空的 fuction1卻沒問題 請問為什麼會發生這樣的事?? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 211.20.129.164 ※ 文章網址: http://www.ptt.cc/bbs/C_Sharp/M.1406443137.A.879.html
文章代碼(AID): #1Jr9w1Xv (C_Sharp)