Difference between user control and form


Author
Message
David Daragon
David Daragon
StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)
Group: Forum Members
Posts: 54, Visits: 249
Hi,

I'm still making tests.

I put a list view in a Micro Four User Control which is contained in a Micro Four Form and the time of loading is 2800 ms.

When I put directly the same list in a Micro Four Form, the time is about 450 ms.

What are the reasons of this difference ?

Best regards

David

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
To be honest, I am not sure.  This sounds as though it may be more specific to your code versus using a User Control and Form.  We actually use a lot of User Controls within our applications for reusability purposes.  You are welcome to post your sample here on the forum, but when it comes to timings like this, there is really no way for me to give you any type of straight answer without actually being able to see, test, and execute the code so a determination can be made.  But I can assure you that 2800ms is a very poor performance indeed and is not typical of this type of setup.
David Daragon
David Daragon
StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)
Group: Forum Members
Posts: 54, Visits: 249
Hi Trent,

I put my BO in my user control and I raise the ParentFormLoading event in userControl_Load event.

I saw that there is no PrimaryBusinessObject property in a user control.

Should I put a BO in the form which contains the user control ? I don't think so.

Could you help me by telling me the procedure to follow.

Thanks in advance

David

David Daragon
David Daragon
StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)
Group: Forum Members
Posts: 54, Visits: 249
Hi,

I retried this afternoon and I found the same result. I can't succeed to find where the problem is.

I need your help.

David

David Daragon
David Daragon
StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)
Group: Forum Members
Posts: 54, Visits: 249
Hi,

I succeed to have the same time of loading when I put a list directly in a form and when I put a list in user control contained in a form.

The problem seems to come from the parameters of the BOTranslation I did.

So, now, I have a time of loading equals to 520 ms in a user control. It's better Smile

But, I'm trying to do this by code but my list doesn't load Crying

I have this code in my form_load:

            ucClient _ucClient = new ucClient();

            _ucClient.Dock = DockStyle.Fill;

            _ucClient.Visible = true;

            _ucClient.OnFermerFenetre += new EventHandler(_ucClient_OnFermerFenetre);

            this.Controls.Add(_ucClient);

            BusinessObjectTranslationItem _BOTranslationItem1 = new BusinessObjectTranslationItem();

            _BOTranslationItem1.SourceBusinessObject = "Form1.clientBO1";

            _BOTranslationItem1.DestinationBusinessObject = "_ucClient.clientBO1";

            _ucClient.BOTranslations.AddRange(new BusinessObjectTranslationItem[] { _BOTranslationItem1 });

            _ucClient.BOTranslations.Add(_BOTranslationItem1);

            _ucClient.TranslationObject = this;

What's wrong ?

Thanks for your help.

David

David Daragon
David Daragon
StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)
Group: Forum Members
Posts: 54, Visits: 249
Just one more thing, there is an error in my code.

The line "_ucClient.BOTranslations.Add(_BOTranslationItem1);" isn't not in my code.

David

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
David,

First, I think that you are making this harder than you need to in regards to the user control.  Just for a little background, we have a large number of user controls that are used within dialogs and forms which in turn use the BO translations between the two.  Here is how a user control is intended to work:

  1. Drop your BOs on a user control and bind to them just as though they were on a form
  2. Once the user control is written, drop that user control on a form or dialog
  3. Drop on the BOs of the same type that were dropped on the user control
  4. Then build the project
  5. Stay within the designer, and select the user control
  6. Go the BO Translations of the user control and click the "..." button
  7. This will then bring up a translations dialog.  Add a translation for each BO that needs to be translated from the dialog into the user control...they will have to be of the same BO type on each translation (one for one).
  8. Now populate the BOs on the form (or the user control can populate them if this is how you intend your app to work, but just for arguments sake, lets populate the Bos on the dialog here)
  9. Now when you run, you should be able to populate the BOs on the form and you will see them reflected within the user control

David Daragon
David Daragon
StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)
Group: Forum Members
Posts: 54, Visits: 249
Thanks for your help Trent,

I follow your method and it's work.

But if I want to do the same by code and not by the designer, I don't manage to laod my list.

Do I forget something in the code I posted before ?

David

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Gotcha....yes, you can do this in code, but you will have to do it in the OnLoad prior to the MyBase.OnLoad gets called so that the translations take place in the natural or expected order.  This is actually something that we do a bit ourselves.
David Daragon
David Daragon
StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)
Group: Forum Members
Posts: 54, Visits: 249
In which OnLoad ? In the form or in the user control ?
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search