473,669 Members | 2,385 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Visual Studio forgets about variable declarations

Hi,

I'm not sure where to post this - but I'll try here. I'm encountering
some really weird behaviour in visual studio and I can't work out where it
is coming from.

In various files, seemingly at random, the compiler seems to "forget" about
references declared in the code behind file. So when I build I get a whole
string of errors like "dgdSearchResul ts is not defined", but if I right
click -> goto definition it goes straight to the declaration in the code
behind file.

Sometimes rebuilding the solution solves the problem, but at other times I
have to delete the declaration and paste it in again somewhere else.

Has anyone encountered this? It seems to be on just one machine (mine) and
not on any of the other developers. It seems to only occur in the one
project.

Nick
Nov 19 '05 #1
2 1344
1. check whether the proctection level of the declared variables is at least
Protected.
2. This problem may also occur if you manually delete the control from the
code behind file and do some operation and again paste the declaration so in
this case, just check whether you have proper event handler in the
InitializeCompo nent() method.

If still you face the problem then please give some more details, like the
exact Page attribute that you are having in your aspx page.
Whether you are creating control by dragging them from the toolbox or you
are adding them in code.
and at what point of time you are getting this error.
Hope this Helps!

"Nick Stansbury" wrote:
Hi,

I'm not sure where to post this - but I'll try here. I'm encountering
some really weird behaviour in visual studio and I can't work out where it
is coming from.

In various files, seemingly at random, the compiler seems to "forget" about
references declared in the code behind file. So when I build I get a whole
string of errors like "dgdSearchResul ts is not defined", but if I right
click -> goto definition it goes straight to the declaration in the code
behind file.

Sometimes rebuilding the solution solves the problem, but at other times I
have to delete the declaration and paste it in again somewhere else.

Has anyone encountered this? It seems to be on just one machine (mine) and
not on any of the other developers. It seems to only occur in the one
project.

Nick

Nov 19 '05 #2
Hi,
1. check whether the proctection level of the declared variables is at least Protected. At least protected - in fact I never change these (I've found
changing it to public is never a good idea because it changes it back to
protected sometimes!) - so I use public properties to get references outside
the page.
2. This problem may also occur if you manually delete the control from the
code behind file and do some operation and again paste the declaration so in this case, just check whether you have proper event handler in the
InitializeCompo nent() method.
This doesn't apply. This happens to a number of controls - some of
which haven't been touched in months.
If still you face the problem then please give some more details, like the
exact Page attribute that you are having in your aspx page.
Whether you are creating control by dragging them from the toolbox or you
are adding them in code.
and at what point of time you are getting this error.


The error occurs at compile time - it's a build error i.e.
"DataGrid1 is not defined"

Here is the control attribute : Control Language="vb"
AutoEventWireup ="false" Codebehind="Rel TypesList.ascx. vb"
Inherits="iirfn ew.RelTypesList "
TargetSchema="h ttp://schemas.microso ft.com/intellisense/ie5"

Here is an example of a problem control:

Public Class RelTypesList
Inherits GlobalLeague.UI .EntryEditContr ols.InLineListB ase
Implements GlobalLeague.UI .EntryEditContr ols.ISetupObjec t
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()
End Sub
Protected WithEvents RelTypeAdd1 As RelTypeAdd
Protected WithEvents AddEditPanel1 As System.Web.UI.W ebControls.Pane l
Protected WithEvents AddNewButton1 As
iirfnew.GlobalL eague.UI.EntryE ditControls.Add NewButton
Protected WithEvents DataGrid1 As System.Web.UI.W ebControls.Data Grid
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceho lderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub
#End Region

Nov 19 '05 #3

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

Similar topics

0
2586
by: gerd | last post by:
Hello, I want to port an MFC Application from Visual Studio 6 MFC application to Visual C++ 2005 express edition beta. While building i get following error: ------ Build started: Project: OSTDLL, Configuration: Debug Win32 ------ Compiling... StdAfx.cpp
0
774
by: gerd | last post by:
Hello, I want to port an MFC Application from Visual Studio 6 MFC application to Visual C++ 2005 express edition beta. While building i get following error: ------ Build started: Project: OSTDLL, Configuration: Debug Win32 ------ Compiling... StdAfx.cpp
65
19022
by: xuanbai98 | last post by:
I want to know the current support status of c99 on Microsoft Visual Studio. Anyone know whether Microsoft has any plan to support c99 on Visual Studio? Thanks, Xuan
4
1785
by: Steve Richter | last post by:
using visual studio 2003 for my asp.net projects ... Once I undock the property window to get a better look at things, I cant dock it back where it came from. Can someone tell me how to redock the property window? When I copy HTML snippets from another page the code behind class is not automatically updated with the new controls. For example, the Web Controls are not added to the group of stmts at the start of the page class which...
8
2203
by: HELLO $$$ | last post by:
To those who are familiar to MS Visual studio : I have recently Visual Studio 2005. Please can any body tells me , when I write a code: How can I separate the files of such code from the Studio program and operate it away from mother program (Studio). Thank you. =============================
4
6532
by: kurt.kurtsmith | last post by:
I am trying to import a tlb from a COM server(exe) I wrote with the following statement: #import "C:\\em2\\EM\\src\\core\\UMOSEFax\\Debug\\UMOSEFax.tlb" no_namespace auto_search the tlh and tli are generated in the debug directory but I get the following error: Error 1 error LNK2019: unresolved external symbol "long __cdecl
4
2642
by: Goran Djuranovic | last post by:
Hi all, I am experiencing a strange thing happening with a "designer.vb" page. Controls I manually declare in this page are automatically deleted after I drop another control on a ".aspx" page. - Why is this happening? - Can I disable automatic declaration and have everything be declared manually? - Any other options to fix this? Thanks in advance. Goran Djuranovic
4
1839
by: Juha Nieminen | last post by:
Unknownmat wrote: VS2005 has a bug related to this. When you use size_t, it internally converts it to 'unsigned int'. In some situations it forgets that the type was actually size_t and only sees it's an 'unsigned int', so when you eg. assign a size_t value to such a "unsigned int which was a size_t but VS2005 has forgotten about it", it will give you a warning about possible data loss (because it only sees that a size_t is being...
0
7324
jwwicks
by: jwwicks | last post by:
Introduction This tutorial describes how to use Visual Studio to create a new C++ program, compile/run a program, resume work on an existing program and debug a program. It is aimed at the beginning CIS student who is struggling to get their programs working. I work in the computer lab at the college I'm attending and I see many students who don't know how to use the IDE for best results. Visual Studio automatically creates a number of...
0
8383
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8894
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8587
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8658
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6210
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5682
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4206
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4384
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2792
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.