Possible fix for "Setup Error: Failed to load resources from resource file"


04-02-2007, 11:28 AM
Was seeing this message upon exiting a program when using SharpUI
and a Style Manager:

"Setup Error: Failed to load resources from resource file"

Turns out that during the "Form Load" process that a Zero Byte
Style Sheet ".XML" file was getting loaded into a UImanager
object when the "LoadCurrentFormStyle" logic was called... this
in turn caused the color scheme to be messed up and the buttons
that use that manager to seemingly not work properly.

---
- Private Sub LoadCurrentFormStyle()
-
-    Dim path As String = System.AppDomain.CurrentDomain.BaseDirectory()
-    If Microsoft.VisualBasic.Right(path, 1) <> "\" Then
-       path = path & "\"
-    End If
-
-    Dim XmlStyleFilename As String = path & "StyleSheets\MyStyleSheet.xml"
-
-    Try
-       UiStyleManager.Load(XmlStyleFilename)
-       Refresh()
-    Catch ex As Exception
-       ' "Error loading selected style"
-    End Try
-
- End Sub
---

Removing the Zero Byte Style Sheet ".XML" File then adding the
"If... End If" below to the above code will help resolve the issue:

---
-       If Dir(XmlStyleFilename) <> "" then
-          UiStyleManager.Load(XmlStyleFilename)
-          Refresh()
-       End If
---

Hope this helps someone else quickly resolve this error.

:)

Re: Possible fix for "Setup Error: Failed to load resources from resource file"


04-02-2007, 2:45 PM
BillNew,
    Thank you for your question. Unfortunately, I have been unable to reproduce the described behavior. Would it be possible for you to provide me with the style sheet your experiencing this behavior with after loading? Could you provide me with a screen shot or example of what is meant by the buttons being messed up / not working properly? Could you please explain how you expect them to look / act verses what you are encountering?

Also, im happy to hear you have found a resolution to the behavior encountered.

I look forward to hearing from you. Thank you!
    Eric