Error with usercontrol


Author
Message
Rav
Rav
StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)
Group: Forum Members
Posts: 10, Visits: 20
I have a usercontrol with a  BO and some textboxes bound to a businessBindingsource.  When I drag the usercontrol onto a blank strataframe standard form, i get an error "Failed to create component... cannot bind to property or column... Please see screenshot for the full error msg.  If I set the binding property of the textboxes to none, I can drag the control onto the form with no problem.
Attachments
error.jpg (86 views, 63.00 KB)
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
This looks like an instantiation order problem.  Most likely, the BBS's BusinessObject property is not being set within the InitializeComponent of the UserControl before the Binding is added to the textbox's DataBindings collection.  There's not a way to force the textbox to wait until the BO has been set to add the binding.  You can, however, create an inherited BusinessBindingSource and in it's constructor add an instance of the business object that you need.  The business object would be contained within the BBS, so that might cause some problems if you want to handle BO events on the user control (you would just have to add the handlers manually...).   Another option would be to copy the designer code for the creation of the bindings and move the code out off the .designer.* file and into the constructor of your user control after InitializeComponent() is called.  This would force the textboxes to wait until the BusinessObject has been set before binding to the BBS.
Rav
Rav
StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)
Group: Forum Members
Posts: 10, Visits: 20
Ben Chase (04/20/2007)
This looks like an instantiation order problem.  Most likely, the BBS's BusinessObject property is not being set within the InitializeComponent of the UserControl before the Binding is added to the textbox's DataBindings collection.  There's not a way to force the textbox to wait until the BO has been set to add the binding.  You can, however, create an inherited BusinessBindingSource and in it's constructor add an instance of the business object that you need.  The business object would be contained within the BBS, so that might cause some problems if you want to handle BO events on the user control (you would just have to add the handlers manually...).   Another option would be to copy the designer code for the creation of the bindings and move the code out off the .designer.* file and into the constructor of your user control after InitializeComponent() is called.  This would force the textboxes to wait until the BusinessObject has been set before binding to the BBS.

That fixed it.  Thank you.  However, when I try to run my app I now get a "User Authentication" screen asking for a username and password.  I'm haven't experimented with any role based security yet and I'm using windows authentication for sql server.  What password is this asking for?

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Rav.

Have a look at the Help File, under "Defining Security within the Application".

I guess you created your application using the "Strataframe Windows Application w/ Security" template. So, if you have a look at your AppMain.vb (or Program.cs) you will find the code that does the trick, according to the help file.

There are some built in accounts and passwords set in there (InitApplication). You can change them or use as they are.

Hope it helps.

StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yes, if you created your app with the "w/ Security" template, then there will be some code in the ShowLoginAndInitMainForm method of the AppMain.vb (Program.cs) file.  Just comment that code out and it will remove the login form.  There is also some other code that is in there that you'll probably want to comment out as well.  The help topic Ivan mentioned describes each extra piece and what it does.
Rav
Rav
StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)
Group: Forum Members
Posts: 10, Visits: 20
Thank you Ivan and Ben
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