Questions tagged [initializecomponent]

61 questions
484
votes
51 answers

The name 'InitializeComponent' does not exist in the current context

If I create a new project in Visual Studio 2010 SP1 and select "WPF Application" and tries to build the generated application, I get the error The name 'InitializeComponent' does not exist in the current context. I got a similar error this morning…
user876402
  • 4,849
  • 2
  • 15
  • 4
19
votes
3 answers

Excluding Code Analysis rule in source

In a project I'm working on FxCop shows me lots of (and I mean more than 400) errors on the InitializeComponent() methods generated by the Windows Forms designer. Most of those errors are just the assignment of the Text property of labels. I'd like…
13
votes
2 answers

How to provide custom code for InitializeComponent?

When you modify column headers of a ListView at design time, the designer generates code to serialize column headers at run-time: private void InitializeComponent() { this.listView1 = new System.Windows.Forms.ListView(); this.columnHeader1 =…
Ozgur Ozcitak
  • 10,409
  • 8
  • 46
  • 56
11
votes
3 answers

That assembly does not allow partially trusted callers. InitializeComponent()

Scenario: I am in the process of refactoring one of our applications to use Nhibernate and came across this issue a couple weeks back. The issue was originally with Nhibernate and Castle and to solve this they were both recompiled with the…
Gage
  • 7,365
  • 9
  • 47
  • 77
11
votes
1 answer

How can I customize the code generation of InitializeComponent? More specifically, how can I post-process all of the generated code?

I'm trying to customize the Windows Forms Designer's code generation for InitializeComponent. The MSDN article "Customizing Code Generation in the .NET Framework Visual Designers" contains a section "Controlling Code Generation" that explains the…
7
votes
2 answers

Why InitializeComponent is public

Public interface of my WPF user control contains autogenerated InitializeComponent method (which is contained in a partial class). It was a surprise for me as I expected such an internal stuff to be private. Is there any way to remove…
SiberianGuy
  • 24,674
  • 56
  • 152
  • 266
6
votes
1 answer

Optimizing performance of Windows Forms InitializeComponent automatically

I have a program with a full GUI that takes around 750 ms to load thanks to InitializeComponent(). After some research, it seems there are a few techniques to improve the time it takes for .NET to trundle through the InitializeComponent section.…
Dan W
  • 3,520
  • 7
  • 42
  • 69
5
votes
2 answers

Blank screen on Xamarin

I have a Xamarin portable project. The Xaml pages I debug are totally blank and I cannot see any components on the pages on both Android and IOS. How can I fix this? Note: It gets no error messages, the pages are opening and I cannot see anything on…
5
votes
1 answer

Passing constructor parameters to controls created inside InitializeComponent

InitializeComponent sets up the components on the form, however for a Usercontrol that I have created it calls the default constructor but I want to call my own constructor (with parameters) on the usercontrol. The boilerplate code says don't edit…
John Fleming
  • 267
  • 1
  • 3
  • 12
4
votes
3 answers

Make a C# program be able to compile on any operating system

I have started making a C# program on a XP 32bit windows operating system in c# 2008, and now i am trying to open it in Windows 7 64bit operating system. The problem that arises is that i can't run the program in c# 2010 on my 64bit system and it…
4
votes
1 answer

Form.OnResize triggered during InitializeComponent()

I have the same UI code running on my XP English machine and on XP Japanese machine. For some reason - the behavior is different between those two machines: On the Japanese machine the OnResize event is getting triggered during the…
Hila
  • 291
  • 1
  • 2
  • 9
2
votes
6 answers

Application crashes in InitializeComponent()

First off, I'm using Visual Studio 2010, Measurement Studio 2010 plugin, C# and .NET 4.0. My application receives data from a USB device and graphs the data using a WaveformPlot() [which is a part of Measurement Studio]. I'm able to run the…
Praveen
  • 63
  • 1
  • 8
2
votes
0 answers

Slow performance loading VBNET DLL

I have a performance issue for some projects I am developing in VBNET. My projects are DLLs, and they are called by an exe with parameters, that is like a tab manager. The problem is that when I call my first DLL in the exe the InitializeComponent…
2
votes
1 answer

Clean elegant solution to form-class level component collection initializing before Initialize Component?

I am converting an old Vb6 solution to .net 2.0 in vs2010. I've been working in C# for about 3 years now and .net for 5. I don't recall having this problem in C#, but if I want initialize a readonly collection of DerivedControlFoo Is there a clean…
Maslow
  • 18,464
  • 20
  • 106
  • 193
2
votes
1 answer

InitializeComponent() Cannot locate resource based on system language

The application was developed on machines running windows 10, with the system language set to our local language, danish. Now we are at a stage where the software needs to be used in offices in other countries. However, the view crashes on startup…
Niksen
  • 79
  • 1
  • 11
1
2 3 4 5