New Posts New Posts RSS Feed: VS2008 UserControl
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

VS2008 UserControl

 Post Reply Post Reply
Author
pucsoftware View Drop Down
Groupie
Groupie
Avatar

Joined: 15-Apr-2008
Location: United States
Posts: 46
Post Options Post Options   Quote pucsoftware Quote  Post ReplyReply Direct Link To This Post Topic: VS2008 UserControl
    Posted: 11-Jun-2008 at 11:24am
Thanks for your response. This worked.
 
Darren
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jun-2008 at 8:22am
Darren,
 
I have helped many customers with this problem.  For example, this is a typical response:

 
We have resolved your problem.

You will need to change the load handler for your User Control.

Change this code:

 

#Region "UserControl Events"

    Private Sub UserControl_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

            mPersMgr = PersistenceManager.DefaultManager

    End Sub

 

To this code:

 

#Region "UserControl Events"

    Private Sub UserControl_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Not Me.DesignMode Then

            mPersMgr = PersistenceManager.DefaultManager

        End If

    End Sub

The reason for this code change is that the Visual Studio Designer will blow up if it executes any PersistenceManager code.  Apparently, the Load event occurs in the Designer.  By checking whether your code is executing in the Designer (by testing whether DesignMode is true), you stop the assignment of your private PersistenceManager.

 



Edited by davidklitzke - 06-Jun-2008 at 8:23am
Back to Top
pucsoftware View Drop Down
Groupie
Groupie
Avatar

Joined: 15-Apr-2008
Location: United States
Posts: 46
Post Options Post Options   Quote pucsoftware Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jun-2008 at 8:00am
After messing with this some, I figure that this issue has something to do with deployment of the necessary files. Even though I have all these projects in one solution, and the second project with the user control works correctly, the third project with the windows form is missing something. I made sure that the windows form project had references to all the same devexpress and devforce assemblies that the project with the user control has. This helped but didn't fix the problem. I'm getting a similar message but with different errors. Here is another picture of what I'm getting.
 
Darren
Back to Top
pucsoftware View Drop Down
Groupie
Groupie
Avatar

Joined: 15-Apr-2008
Location: United States
Posts: 46
Post Options Post Options   Quote pucsoftware Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jun-2008 at 7:21am
I have created three projects. One is the DevExpress objects for my data, the second is a user control that uses the first project where I have created a Windows user control to access the data. The third project is a test form that references the first two projects. When I place the user control from the second project on the form I get an error message that a valid configuration file can not be found. This was working but as I continued to build the user control I started getting this error and the user control can't be displayed on my Windows form. I'm including a picture of the error I am getting. Can you tell me what is wrong?
 
Darren
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down