473,508 Members | 2,369 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Subject: about automatic execute code in design time

Hi,
I'm new to vb.net.
How to prevent vb.net to automatic execute code in design time?

When I open a form design view in VS2005, vs pop up an error message: "Could
not load file or assembly "xxx" or one of its dependencies....". But there's
no build error, and can run normally.The renferenced assembly(not strongly
named) do exist, but not in GAC.

I wonder there's any way to disable the error check when I open the form?
And why the result can run, but VS2005 throw error in design time.

Thanks a lot.

Nov 5 '07 #1
2 3475
On Nov 4, 7:44 pm, Freeman <Free...@discussions.microsoft.comwrote:
Hi,
I'm new to vb.net.
How to prevent vb.net to automatic execute code in design time?

When I open a form design view in VS2005, vs pop up an error message: "Could
not load file or assembly "xxx" or one of its dependencies....". But there's
no build error, and can run normally.The renferenced assembly(not strongly
named) do exist, but not in GAC.

I wonder there's any way to disable the error check when I open the form?
And why the result can run, but VS2005 throw error in design time.

Thanks a lot.
You can't do it in the constructor - but, if you move this
initialization stuff to form_load, then you can test for design mode
before you attempt to access those resources:

Public Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
Handles Form1.Load
If Not Me.DesignMode Then
' Access Your Resources
End If
End Sub

--
Tom Shelton

Nov 5 '07 #2
Thanks for you answer.

I'm sorry I did say clearly.
I do initialization in form_load. But the form contains several user
control, and it seems that the control_load would be execute
automaticly(called by InitializeComponent()). How to prevent this? Remove
auto generated code in InitializeComponent() related to user controls?

"Tom Shelton" wrote:
On Nov 4, 7:44 pm, Freeman <Free...@discussions.microsoft.comwrote:
Hi,
I'm new to vb.net.
How to prevent vb.net to automatic execute code in design time?

When I open a form design view in VS2005, vs pop up an error message: "Could
not load file or assembly "xxx" or one of its dependencies....". But there's
no build error, and can run normally.The renferenced assembly(not strongly
named) do exist, but not in GAC.

I wonder there's any way to disable the error check when I open the form?
And why the result can run, but VS2005 throw error in design time.

Thanks a lot.

You can't do it in the constructor - but, if you move this
initialization stuff to form_load, then you can test for design mode
before you attempt to access those resources:

Public Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
Handles Form1.Load
If Not Me.DesignMode Then
' Access Your Resources
End If
End Sub

--
Tom Shelton

Nov 5 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
822
by: jackson | last post by:
In an ongoing effort to reduce the flood of emails I receive every day, I've initiated this automatic response email. If your email was concerning any of the following subjects, then this...
0
1369
by: AMDIRT | last post by:
I have a few questions about IssueVision (from WindowsForms) concerning its scalability and performance. Rather, if I were to implement techniques described here into another application, how...
6
10223
by: Matt | last post by:
I have begun designing and programming in C++ after a several years away from software engineering/programming. I am looking for an "automatic C++ header generator." I have what seems to be...
5
2350
by: Shane | last post by:
I wonder if someone has any ideas about the following. I am currently producing some reports for a manufacturing company who work with metal. A finished part can contain multiple sub-parts to...
7
1758
by: Lucas Sain | last post by:
Hi, How can I make a code in an event not execute in design time. I have a Baseform that has X code in the event "VisibleChanged". All my forms inherit from this form. The code in this event...
75
5541
by: Sathyaish | last post by:
Can every problem that has an iterative solution also be expressed in terms of a recursive solution? I tried one example, and am in the process of trying out more examples, increasing their...
4
2520
by: Petterson Mikael | last post by:
Hi, Anyone out there that knows of a automatic test generation tool for cpp? Another requirement is that the test results should be presented in xml. All hints appreciated. cheers, ...
0
312
by: JoshforRefugee | last post by:
heard that we can do automatic code generation using macros, but not sure how can I pursue this. Here is my problem. In my env, I have class A,B and C. All of them has constructors, and few...
58
4608
by: Jorge Peixoto de Morais Neto | last post by:
I was reading the code of FFmpeg and it seems that they use malloc just too much. The problems and dangers of malloc are widely known. Malloc also has some overhead (although I don't know what is...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7115
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7321
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7377
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5624
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4705
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.