Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7867223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:39:21+00:00 2026-06-03T00:39:21+00:00

I have 2 constructors in my class: public partial class Fiche_Ordre : Le_MainForm {

  • 0

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
        ...
        }

It is strange, because when I use public Fiche_Ordre() it does not fire new EventHandler(lookUpEdit_Dest_EditValueChanged);; but when I use public Fiche_Ordre(string OrderID), it does fire the event handler.

Is this normal or not?

the first constuctor it call from Main form

 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();
        }

and the second constructor i call it from

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);
                }
            }

Thank you in advance.

PS: the first constructor is just to create the NEW blank page, and the second constructor is to create NOT NEW (Edit page), so i passed the id and fill all control (textbox, memo, etc…)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T00:39:22+00:00Added an answer on June 3, 2026 at 12:39 am

    The EditValueChanged handles is wired in the very last line of Constuct_Page. Therefore it fires only for changes after Constuct_Page. Is it changed in the .................. part of the code? It does sound like an over-simplified speculation, but it’s worth double-checking anyway…

    Besides, may I suggest you another improvement:

    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);
    
      // ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a constructor question for C#. I have this class: public partial class
I have a class with two constructors that look like this: public MyClass(SomeOtherClass source)
I have a varargs constructor like this : public class Sentence { public String[]
I have this code: public partial class App : Application { protected override void
Given I have a class with two constructors: public class TestClass { ObjectOne o1;
I have a class as follows public partial class Configuration : INotifyPropertyChanged { private
I have a product.aspx class public partial class _Products : Product { protected void
I have following code and it is working fine. public partial class MainWindow :
I have a base and derived class. The base class constructors have some static
My motivation for chaining my class constructors here is so that I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.