English 中文(简体)
C# Winform活动手递
原标题:C# Winform event handler

I have 2 constructors in my class:

public partial class Fiche_Ordre : Le_MainForm
    {
         public Fiche_Ordre()
              {
                  InitializeComponent();           
                  Constuct_Page();            
              }

              public Fiche_Ordre(string OrderID): this()
              {


                    Pers_Ordre oPersOrdr = oOrder_BL.Get_OrdreOne_BL(ClientID, Convert.ToInt32(OrderID), false);

                textEdit_RefExpred.Text = oPersOrdr.RefExpd;
                lookUpEdit_Agence.EditValue = oPersOrdr.Agence;
                lookUpEdit_Transport.EditValue = oPersOrdr.Transporteur;

                lookUpEdit_Dest.EditValue = oPersOrdr.DestId;
    ..................

              }


              public void Constuct_Page()
              {
                  try
                  {
                      ClientID = Program.Le_ClientID;
                      ....

              #region LookUpEdidt Destinataire

                   lookUpEdit_Dest.Properties.DataSource = Auxiliaire_BL.FillCombo_BL(false, ClientID).Tables["ComboFill"];
                   lookUpEdit_Dest.Properties.ValueMember = "CODE_DEST";
                   lookUpEdit_Dest.Properties.DisplayMember = "CODE_DEST";
                   LookUpColumnInfoCollection coll_Dest = lookUpEdit_Dest.Properties.Columns;
                   // A column to display the ProductID field s values.
                   coll_Dest.Add(new LookUpColumnInfo("CODE_DEST", 0, "Code Destinataire"));
                   // A column to display the ProductName field s values.
                   coll_Dest.Add(new LookUpColumnInfo("RS_NOM", 0, "Raison Social"));
                   //  Set column widths according to their contents and resize the popup, if required.   
                   lookUpEdit_Dest.Properties.BestFitMode = BestFitMode.BestFitResizePopup;
                   // Enable auto completion search mode.
                   lookUpEdit_Dest.Properties.SearchMode = SearchMode.AutoComplete;
                   // Specify the column against which to perform the search.
                   lookUpEdit_Dest.Properties.AutoSearchColumnIndex = 1;
                   lookUpEdit_Dest.EditValueChanged += new EventHandler(lookUpEdit_Dest_EditValueChanged);
              #endregion
        ...
        }

这是奇怪的,因为当我使用<条码>时,公费_Ordre()就不焚烧<条码>。 活动Handler(lookUpEdit_Dest_EditValueChanged);;但当我使用<代码>时,公共Fiche_Ordre(string OrderID),它确实向活动主管开火。

这是否正常?

第一线主线

 public partial class Le_MainForm : DevExpress.XtraEditors.XtraForm
    {
        public Le_MainForm()
        { 
            InitializeComponent();

            this.Name = "MainUSER";

            if (Program.IsFA) barButtonItem_OrdList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;


        }

 private void barButtonItem_CreatOrdreAller_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Close_AllForm();
            Program.AllerRetour = "Ordre Aller";
            Fiche_Ordre f_Fiche = new Fiche_Ordre();

            f_Fiche.Show();
        }

以及第二位施工者i

public partial class Liste_Ordres : Le_MainForm
    {

     private void Liste_DobleClic(object sender, EventArgs e)
            {
                try
                {
                    Program.OrderId = gridView_Liste_Ordres.GetFocusedRowCellValue("NO_ORDRE").ToString();
                    this.Hide();
                    Fiche_Ordre f_Fiche = new Fiche_Ordre(gridView_Liste_Ordres.GetFocusedRowCellValue("NO_ORDRE").ToString());
                    f_Fiche.Show();
                }
                catch (Exception excThrown)
                {
                    MessageBox.Show(excThrown.Message);
                }
            }

事先感谢你。

PS:第一座建筑商只是制造新的空白页,第二座建筑商是创建NOT New(Edit页面),这样就通过背书并填补了所有控制(文本箱、电传等)。

最佳回答

<代码>EditValueChangedprocesss is ted in the first line of Constuct_Page。 因此,它只为改动发射 > >>>> 编码>Constuct_Page。 该编码在<代码>......>部分中是否有改动? 它就像过度简化的投机一样,但值得双管齐下。

此外,我还可以建议你作出另一项改进:

public Fiche_Ordre(string OrderID) : this.Fiche_Ordre()
{
  // invokes the other constructor first, so they re guaranteed
  // do be equivalent in the first part

  Pers_Ordre oPersOrdr = oOrder_BL.Get_OrdreOne_BL(ClientID,
    Convert.ToInt32(OrderID), false);

  // ...
}
问题回答

当你想对事件处理员具有约束力时,要寻找上调,看看上去,我想这段var的确是初步的,因此,你需要先从第二位施工者增加到第一。

相反,创立了Page(Page)概念;只是放在表_Load()中。





相关问题
Bring window to foreground after Mutex fails

I was wondering if someone can tell me what would be the best way to bring my application to the foreground if a mutex was not able to be created for a new instance. E.g.: Application X is running ...

How to start WinForm app minimized to tray?

I ve successfully created an app that minimizes to the tray using a NotifyIcon. When the form is manually closed it is successfully hidden from the desktop, taskbar, and alt-tab. The problem occurs ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

Handle DataTable.DataRow cell change event

I have a DataTable that has several DataColumns and DataRow. Now i would like to handle an event when cell of this DataRow is changed. How to do this in c#?

Apparent Memory Leak in DataGridView

How do you force a DataGridView to release its reference to a bound DataSet? We have a rather large dataset being displayed in a DataGridView and noticed that resources were not being freed after the ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

WPF-XAML window in Winforms Application

I have a Winforms application coded in VS C# 2008 and want to insert a WPF window into the window pane of Winforms application. Could you explain me how this is done.

热门标签