Error loading property page in windows forms designer options page & Nullreferenceexception when adding forms to a project

Visual Studio .Net

    Next

  • 1. Positioning Window via macro?
    If you know how far down you want to move the current line then there's an Edit.ScrollLineUp command that could be used to scroll the window to the desired position. For example if you wanted the line currently on the top to be the third line down, if you ran the scroll up command twice, your line would then be the third line shown on the screen instead of the first The code to run the scroll up command is DTE.ExecuteCommand("Edit.ScrollLineUp") --Lance, Visual Studio IDE team This posting is provided AS IS and confers no warrenties or rights. >-----Original Message----- >I have a macro which, when run, inserts a bunch of text >at the bottom of a source file. After it runs, I want >the insertion caret to return to the same line number and >column it was on before the macro was run. I can do that >fine, but I also want the position of the line to return >to the way it was. For example, if I was editing the >third line down in the window, I want the "view" of the >document to return so it is at the third line down >again. The way it works now, when I return to the line >via MoveToLineAndOffset() is always at the top of the >window. I can't seem to find any methods or objects that >let me control the "viewport" of the document. > >Any tips? TIA >. >
  • 2. Can't view resources in VS.NET resource editor
    I had this problem too, and found that the advice offered in the KB 326987 article did not help at all. After some trial and error, I finally found the culprit. It is indeed an include path length limitation, but it is not just Tools.Options.Projects.VC++Directories. If your project's C/C++.General.Additional Include Directories entry is too long, that will also cause the RC1015 ... afxres.h error. The workaround I found was to copy all the /I compile options generated by the C/C++.General.Additional Include Directories entry and move them into the C/C++.Command Line.Additional Options entry. This will allow the project to compile normally without breaking the resource editor. Good luck!
  • 3. Can't debug ASP.NET on Win2K Pro SP4 / .NET 1.0
    When we try to debug we get the some what common... Error trying to start debugging on the web server. Catastrophic failure. .... I have been through several different MS web pages and a Word doc on what needs to be set up. As fas as I can tell everything is set up correctly. Is there any definitive resource on how to fix the problem? Kyle!
  • 4. VS_VERSION_INFO
    In my current program, I have 2 versions of the .rc file. I load one version if I'm building for internal and another if I'm building for external uses. At any one time however there is only one .rc file in my program directory. It seems that the information loaded into the resource editor is loading from somewhere outside of the .rc file. Lets say I grab the external .rc file and place it in the program directory and change the version to B.34. Then I close out of .NET and replace the .rc file with the internal .rc file that has the version as B.04. If I go in and look at the .rc file in a text editor it will have B.04. If I compile, the program will display B.04. All good. However, if I go in and click on the VS_VERSION_INFO tab inside of .NET it displays the B.34 (or whatever I last typed). I can't understand that. If it isn't reading it from the .rc file (which I know if I change it - it is writing it to this file) where is it reading it from. PLEASE HELP.... Thanks, Janet

Error loading property page in windows forms designer options page & Nullreferenceexception when adding forms to a project

Postby Lurker » Sun, 15 Feb 2004 04:49:13 GMT

Well, weird things here. Brand new VS .net 2003 installation, no work done
yet, i try to add a form to a new project, but i get a
"NullReferenceException" error, and the designer comes up with a big red
cross (red x) and white background. And i go to the options menu, try to
open the windows designer -> general options page and i just can see  this
message: "error loading property page". I can't get to work ".net framework
wizards" within administrative tools either.
Fine. I uninstall VS .net 2003 and try to install a previous VS version,
that comes whit .net framework v. 1.03705. Same behaviour.
Can anyone tell me what is this all about? Any known incompatibility whith
software or hardware is known to cause this? Has anyone had this trouble,
too, and has managed to get rid of it? The issue is that I can't use windows
forms designer at all, i can't load old VB6 projects , etc.
(NOTE: the project with a new form -obviously a blank one, as i can't add
any control- compiles fine, and the form is eve displayed -blank, i insist-
on the screen)
Funny, ins't it?



Similar Threads:

1.Error loading property page in windows forms designer options page & Nullreferenceexception when adding forms to a projec

Well, weird things here. Brand new VS .net 2003 installation, no work done
yet, i try to add a form to a new project, but i get a
"NullReferenceException" error, and the designer comes up with a big red
cross (red x) and white background. And i go to the options menu, try to
open the windows designer -> general options page and i just can see  this
message: "error loading property page". I can't get to work ".net framework
wizards" within administrative tools either.
Fine. I uninstall VS .net 2003 and try to install a previous VS version,
that comes whit .net framework v. 1.03705. Same behaviour.
Can anyone tell me what is this all about? Any known incompatibility whith
software or hardware is known to cause this? Has anyone had this trouble,
too, and has managed to get rid of it? The issue is that I can't use windows
forms designer at all, i can't load old VB6 projects , etc.
(NOTE: the project with a new form -obviously a blank one, as i can't add
any control- compiles fine, and the form is eve displayed -blank, i insist-
on the screen)
Funny, ins't it?

As far as I know, some other people have had the same problem. No solution
yet. Hints needed (thanks).

David Gez


2.adding DesignerActionLists to form when designer host has loaded the form

Hello,

my Visual Studio install refuse to load any addins, nothing shows up in the addin manager. I tried wizard created addins and some I found in the internet. Apart from reinstalling Visual Studio is there anything I can try? I think I've used addins before so it got broke somehow.

Normally I prefer macros but it's problematic with the design time because the macro IDE runs in another process, what I want to do is adding a DesignerActionList to any control after the designer host has loaded a form or control. Maybe anybody with deep knowledge about extensibility, automation, design time, AppDomain etc. can give me some hints, my knowledge about all this is only sketchy. My macro code where I'm stuck looks like this:

Sub WindowEvents_WindowCreated(ByVal Window As EnvDTE.Window) Handles WindowEvents.WindowCreated
     MsgBox(1)
     Dim h As IDesignerHost = Window.Object
     Dim s As IServiceProvider = h.GetService(GetType(IServiceProvider))
     MsgBox(2)
End Sub

the second message box isn't displayed so it terminates silently

My current why to setup my DesignerActionLists is putting a custom control on my form which overrides OnParentChanged to iterate then over all controls to retrieve the designer of the control to add the DesignerActionList to the designer. What I don't like about that approach is I have to put a dummy control on every form only to get my design time code running.

Some things I don't understand, when I override the Text property of a form, it doesn't ever get called when the designer host loads the form.

thx
stax

Public Class DesignModeDummyControl
     Inherits Label

     'when the designer puts this control on a form a init method is called
     Protected Overrides Sub OnParentChanged(ByVal e As EventArgs)
         MyBase.OnParentChanged(e)
         InitSmartTags()
     End Sub

     Private DesignerActionUIService As DesignerActionUIService

     'the init method puts a the DesignerActionLists on all controls
     'and creates a event handler to add the lists to controls that are added to the form later
     Public Sub InitSmartTags()
         Dim s As IComponentChangeService = DirectCast(GetService(GetType(IComponentChangeService)), IComponentChangeService)

         If Not s Is Nothing Then
             AddHandler s.ComponentAdded, AddressOf OnComponentAdded
             AddLists(Me)
         End If
     End Sub

     'add the list to newly added controls
     Private Sub OnComponentAdded(ByVal sender As Object, ByVal e As ComponentEventArgs)
         AddLists(e.Component)
     End Sub

     'check if the list was already added to the designer
     Private Function ContainsList(ByVal designer As ControlDesigner, ByVal type As Type) As Boolean
         For Each i As DesignerActionList In designer.ActionLists
             If i.GetType Is type Then
                 Return True
             End If
         Next
     End Function

     'add the lists to the designer
     Private Sub AddLists(ByVal c As IComponent)
         Dim host As IDesignerHost = DirectCast(c.Site.GetService(GetType(IDesignerHost)), IDesignerHost)

         If TypeOf host.RootComponent Is Form Then
             Dim cd As ControlDesigner = DirectCast(host.GetDesigner(host.RootComponent), ControlDesigner)

             If Not ContainsList(cd, GetType(FormActionList)) Then
                 cd.ActionLists.Add(New FormActionList(host.RootComponent))
             End If
         End If

         For Each i As Component In host.RootComponent.Site.Container.Components
             If TypeOf i Is Control Then
                 If TypeOf host.GetDesigner(i) Is ControlDesigner Then
                     Dim cd As ControlDesigner = DirectCast(host.GetDesigner(i), ControlDesigner)

                     If TypeOf i Is TextBox OrElse TypeOf i Is Label OrElse _
                         TypeOf i Is ComboBox OrElse TypeOf i Is CheckBox OrElse _
                         TypeOf i Is GroupBox Then

                         If Not ContainsList(cd, GetType(CommonActionList)) Then
                             cd.ActionLists.Clear()
                             cd.ActionLists.Add(New CommonActionList(i))
                         End If
                     End If
                 End If
             End If
         Next
     End Sub
End Class

'I wish DesignerActionList would support ICustomTypeDescriptor like the PropertyGrid
Public Class CommonActionList
         Inherits DesignerActionList

         Private Items As New DesignerActionItemCollection()
         Private DesignerActionService As DesignerActionService

         Public Sub New(ByVal component As IComponent)
             MyBase.New(component)
             DesignerActionService = DirectCast(GetService(GetType(DesignerActionService)), DesignerActionService)
         End Sub

         Protected Function FixControlName(ByVal value As String) As String
             Dim ret As String = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(value)

             For Each i As Char In value
                 If Not Char.IsLetterOrDigit(i) Then
                     ret = ret.Replace(i, "")
                 End If
             Next

             Return ret
         End Function

         Protected Sub RefreshComponent()
             DirectCast(GetService(GetType(DesignerActionUIService)), DesignerActionUIService).Refresh(Component)
         End Sub

         Public Sub SetValue(ByVal propertyName As String, ByVal value As Object)
             Dim pd As PropertyDescriptor = TypeDescriptor.GetProperties(Component)(propertyName)
             pd.SetValue(Component, value)
         End Sub

         Public Function GetValue(Of T)(ByVal propertyName As String) As T
             Dim pd As PropertyDescriptor = TypeDescriptor.GetProperties(Component)(propertyName)
             Return DirectCast(pd.GetValue(Component), T)
         End Function

         Private Function GetPrefix() As String
             Dim ret As String = ""

             For Each i As Char In GetComponent.GetType.Name
                 If Char.IsUpper(i) Then
                     ret += i
                 End If
             Next

             Return ret.ToLower
         End Function

         Private Function GetComponent() As Component
             Return DirectCast(Component, Component)
         End Function

         Public Property Text() As String
             Get
                 Return GetValue(Of String)("Text")
             End Get
             Set(ByVal Value As String)
                 SetValue("Text", Value)
                 SetValue("Name", GetPrefix() + FixControlName(Value))
                 RefreshComponent()
             End Set
         End Property

         Public Property Name() As String
             Get
                 Return GetValue(Of String)("Name")
             End Get
             Set(ByVal value As String)
                 SetValue("Name", value)
             End Set
         End Property

         Public Property Multiline() As Boolean
             Get
                 Return GetValue(Of Boolean)("Multiline")
             End Get
             Set(ByVal value As Boolean)
                 SetValue("Multiline", value)
             End Set
         End Property

         Public Property Anchor() As AnchorStyles
             Get
                 Return GetValue(Of AnchorStyles)("Anchor")
             End Get
             Set(ByVal Value As AnchorStyles)
                 SetValue("Anchor", Value)
             End Set
         End Property

         Public Property TextAlign() As ContentAlignment
             Get
                 Return GetValue(Of ContentAlignment)("TextAlign")
             End Get
             Set(ByVal Value As ContentAlignment)
                 SetValue("TextAlign", Value)
             End Set
         End Property

         Public Property AutoSize() As Boolean
             Get
                 Return GetValue(Of Boolean)("AutoSize")
             End Get
             Set(ByVal Value As Boolean)
                 SetValue("AutoSize", Value)
             End Set
         End Property

         Public Property DropDownStyle() As ComboBoxStyle
             Get
                 Return GetValue(Of ComboBoxStyle)("DropDownStyle")
             End Get
             Set(ByVal value As ComboBoxStyle)
                 SetValue("DropDownStyle", value)
             End Set
         End Property

         Public Sub AddPropertyItem(ByVal name As String, ByVal ParamArray t As Type())
             For Each i As Type In t

                 If GetComponent.GetType Is i OrElse _
                     GetComponent.GetType.IsSubclassOf(i) Then

                     Items.Add(New DesignerActionPropertyItem(name, name))
                 End If
             Next
         End Sub

         Public Overrides Function GetSortedActionItems() As DesignerActionItemCollection
             items.Clear()

             AddPropertyItem("Text", _
                 GetType(TextBox), _
                 GetType(GroupBox), _
                 GetType(Label), _
                 GetType(CheckBox))

             AddPropertyItem("Name", GetType(Control))
             AddPropertyItem("TextAlign", GetType(Label))
             AddPropertyItem("AutoSize", GetType(Label))
             AddPropertyItem("Multiline", GetType(TextBox))
             AddPropertyItem("DropDownStyle", GetType(ComboBox))
             AddPropertyItem("Anchor", GetType(Control))

             Return items
         End Function
     End Class

3.Question on debugging Windows Forms Designer loading a form

4.Load Web Page via Windows Form or Service

I want to write a simple class that loads a requested url and reports
success or failure. I plan to use this to monitor web sites on the web.

I would like to implement the class in a windows form and a service.

Any help would be appreciated.

scott


5.Illegal characters in path error in web form designer and windows component designer

Hi all,

About two weeks ago VS.NET 2003 started to report the following error
message whenever I tried to open an .aspx or .ascx file in c# web project:

Microsoft Development Environment
The file could not be loaded into the Web Forms designer. Please correct the
following error and then try loading it again:
Illegal characters in path.

This was followed by some advice about making sure the project was build
properly etc etc

At first it didn't bother me - I thought that one of my websettings was a
bit out or something like that (since I had upgraded the project from vs.net
2002). Anyways when I could load the project and files without any problems
from other development machines I started to wonder why. Then on the weekend
I noticed that I got the same error when I tried to open a file from a new
webproject that I had created that was hosted locally.

So I tried to repair the installation to no avail. I then uninstalled the
software, rebooted and then reinstalled the software and still no success.

So I resolved to soldier on until I tried to create a Windows Service
component. Low and behold the same error appeared in the actual designer.
This obviously is completely unrelated to the web forms designer so I really
don't know where the problem lies.

Basically the system im running is

Windows XP SP1
VS.NET 2003 Ver 7.1.3088 Pro
VS.NET 2002 Ver 7.0.9466

Another thing worth noting is that there are no such problems with my VS.NET
2002 installation.

Anyways if someone can help I would greatly appreciate it.


6. Project Property pages and misc options MISSING

7. error: Form1---The base class 'System.Windows.Forms.Form' could not be loaded

8. Options | Windows Forms Designer ShowGrid and SnapToGrid works??



Return to Visual Studio .Net

 

Who is online

Users browsing this forum: No registered users and 7 guest