>public virtual void DataBind(System.Data.DataTable Data, string Path) >{ > for (int i = 0; i < this.DataBindings.Count; i++) > { > if (this.DataBindings[i].Equals(this.oBinding)) > { > this.DataBindings.Remove(this.oBinding); > break; > } > } > > this.Text = ""; > this.m_BoundTable = Data; > this.m_BoundColumn = Path; > this.oBinding = new Binding(this.m_BoundProperty, Data, Path); > this.oBinding.Format += new ConvertEventHandler(this.FormatHandler); > this.oBinding.Parse += new ConvertEventHandler(this.ParseHandler); > this.DataBindings.Add(this.oBinding); >} >>
>>>this.txtOne.DataBindings.Add("Text", dsData.Tables[0], "MyFirstColumn"); >>>this.txtLast.DataBindings.Add("Text", dsData.Tables[0], "MyLastColumn"); >>>>>>
>>>>using System; >>>>using System.Collections.Generic; >>>>using System.ComponentModel; >>>>using System.Data; >>>>using System.Drawing; >>>>using System.Text; >>>>using System.Windows.Forms; >>>> >>>>using UPCI.WinUI; >>>>using UPCI.Atlas.Business.MyBiz; >>>> >>>>namespace UPCI.Atlas.WinUI.MyUI >>>>{ >>>> public partial class Policy : UPCIForm >>>> { >>>> private string PolicyNumber; >>>> private DataSet dsData; >>>> private PolicyBiz oBiz; >>>> >>>> // Need to save the polid so later I can get related info >>>> public string PolID; >>>> >>>> public Policy(string pn) >>>> { >>>> >>>> this.PolicyNumber = pn; >>>> InitializeComponent(); >>>> >>>> this.FillData(); >>>> } >>>> public void FillData() >>>> { >>>> // I'm directly calling a Biz class. In reality, a Web Service >>>> // should be here which calls the Biz class >>>> oBiz = new PolicyBiz(); >>>> dsData = oBiz.GetPolicy(this.PolicyNumber); >>>> >>>> >>>> >>>> } >>>> >>>> private void Policy_Load(object sender, EventArgs e) >>>> { >>>> >>>> } >>>> >>>> private void Policy_Layout(object sender, LayoutEventArgs e) >>>> { >>>> //this.tabControl1.Dock = DockStyle.Fill; >>>> } >>>> >>>> >>>> } >>>>} >>>> >>>>>>>>