I have some conditionals in my InitializeComponent which affect the layout based on some variables. Unfortunately, it seems like whenever I rebuild my application, this code is reverted back to its previous state. Is this code being regenerated based on the Designer interface? Is there a way to prevent it from doing this?
IntializeComponent keeps getting overwritten
320 views Asked by Alec Sanger At
1
There are 1 answers
Related Questions in VB.NET
- how do i stop system stack overflow in visual basic?
- Finding and Using Camera found in “Imaging Devices” in VB.NET
- Finding a specific colour within a bitmap range - VB.net 2022
- Filtering a double value
- How to call late bound extension method from VB.NET (Framework)
- Accessing a variable from a string
- Calling ToString with a nominated format returns Char rather than String
- Monthly attendance report in Crystal Report
- Progress Bar increment while running
- GetValue for Field contains too many arguments
- Icon of Window form application
- vb.net connection string to a regular google drive
- VB.NET how to check if a form already exists?
- How to get paste to work for pasting in text in a textbox?
- How to convert base64 string to image using vb.net
Related Questions in VISUAL-STUDIO-2010
- how do i stop system stack overflow in visual basic?
- How to remove shortcut/alias to a .cpp and .h file from another project in Visual Studio 2019?
- VS2010 Macro/Environment issue causing a HResult: 0x80070057 (E_INVALIDARG) exception
- DevOps 2022 Server not connecting on VS 2012 and VS 2010
- How can i make a prefab instantiate another prefab?
- VS2010 Installer Project Custom Action to run an EXE is failing
- I commit from my Microsoft Visual Studio, however, I am now seeing that i now have two versions of two files
- Is there a way to make AfxMessageBox() take focus from another program?
- in visual studio 2017 was use a model i made but i get the error Read_POLS_Chunk(): Error reading a polygon not 1-3 vertices
- C++ vector subscript out of range : Monotone Interpolation
- c language, When decimal digit of %g in printf equal to 0.5, and length is more than 6, it is not upper ceil, why?
- IloEnv env ; don't work in the dbug and it can access to it
- Create a kml for a Google Earth tree view item through vb-net
- Error in RDLC REPORT in vs2010- An error occurred during local report processing, Object reference not set to an object instance
- This AVD's configuration is missing a kernel file! Visual Studio Code
Related Questions in DESIGNER
- Why can't my Liveshare partner see the XAML Designer on Visual Studio 2022?
- How do you set Visual Studio so that winform Label widget BackColor is transparent rather than "Control"
- Why AlternateContent isn't displayed in Visual Studio WPF Xaml Designer view?
- How to mirror the Form without mirroring the Title Bar (RightToLeftLayout) in WinForms
- I want to save the report to the SQl Server database automatically from the DevExpress report designer interface
- can't convert qt designer .ui to .py
- How to determine the path of a DFM where the custom TComponent is?
- How to train and deploy ml models in azure ml designer, just using components?
- Can't find design view in Visual Studio 2022
- highlight flow step or activity step in the rehosted workflow designer by entering display name
- Designer support for DataAdapters in .net6 Visual Studio 2022
- Set .Caption property of inactive userform label from other userform
- How do I display outcome in my textEdit box from application
- Creating a Custom TabControl in C# WinForms - Issues with Drag-and-Drop in Design-time
- How to detect the dfm/project path from a custom control while in the designer?
Related Questions in INITIALIZECOMPONENT
- How to use Roslyn in wpf application
- When implementing C# Maui XAML popup what can cause error 'InitializeComponent does not exist' or 'Popup could not be found' and what is resolution?
- Handle event or something just before code for Control.ResumeLayout is executed
- How to modify code written in InitializeComponent method (WinForms Designer generated code)?
- Xamarin Forms Tabbed Page Tabs Initializing
- Winforms appearance at 100%,125%,150% Windows scaling modes, and alleviating need to constantly edit Designer.cs class every time I update the GUI
- C# Application crashes on startup at InitializeComponent(), throws CultureNotFoundException
- Getting error: "The name InitializeComponent does not exist in the current context", in every xaml.cs class (Xamarin Forms)
- StackOverflowException - Without Recursion
- Slow performance loading VBNET DLL
- I keep getting an InitializeComponent(); error in my code
- Proper way of initializing components
- UWP crashes at InitializeComponent() [C++]
- How can I catch and elegantly handle exception where database is unavailable in WPF
- UWP Initialize components not recognised after clean System.Xaml could not be found
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Yes,
InitializeComponentis completely IDE-generated; don't even try to mess with it.If you have conditional logic wherein you want to add/remove some controls, do it in your control's constructor after the auto-generated call to
InitializeComponent.Note that if the conditional stuff will depend on features enabled/disabled at design time (e.g., if someone else is using your control and you've provided properties to affect how that control behaves which you intend to be set at design time), using the constructor won't work since the constructor will have already run by the time the user makes his/her choices from the design view; in this case, override the
OnLoadmethod and put your logic in there (or do some variation of this, e.g., handle theLoadevent itself—there are plenty of ways to skin this cat).