473,396 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Help: User control dim changes RIGHT UNDER MY NOSE!

I changed a usercontrol dim from:
Protected WithEvents ddlView As System.Web.UI.WebControls.DropDownList
to:
Public Shared ddlView As System.Web.UI.WebControls.DropDownList

I saved it SEVERAL times. It was working for about a day then, as I'm
programming today, I notice that it's changed back to the original. Any
ideas? This happened several times and each time I fix it it works fine.

Thanks in advace.
Nov 17 '05 #1
4 1689
this declaration was likely done by the vs.net (in other words, this is
generated code). vs.net could be the one changing it back, so you need
to find a better way to work with this control. why is it shared? maybe
using public properties to access the protected control would be better

VB Programmer wrote:
I changed a usercontrol dim from:
Protected WithEvents ddlView As System.Web.UI.WebControls.DropDownList
to:
Public Shared ddlView As System.Web.UI.WebControls.DropDownList

I saved it SEVERAL times. It was working for about a day then, as I'm
programming today, I notice that it's changed back to the original. Any
ideas? This happened several times and each time I fix it it works fine.

Thanks in advace.


Nov 17 '05 #2
if the property is shared, the other item has to be shared. why is the
property shared? i dont get that part.

VB Programmer wrote:
Thanks. I tried this:

Public Shared Property ddlMyView() As DropDownList
Get
Return ddlView
End Get
Set(ByVal Value As DropDownList)
ddlView = Value
End Set
End Property

But, I get a squiggly under the ddlView and it says 'Cannot refer to an
instance member of a class from within a shared method or a shared member
initialize without an explicit instance of the class'.

Any more ideas? Thanks!

"Kairi Zikpin" <zikkai.nospam.@netscape.net> wrote in message
news:3F**************@netscape.net...
think of a usercontrol as a class/object. it has a public interface and
a non-public interface. that dropdown list is not accesible publicly.
create a read/write property of type dropdownlist as shown below (or
something to that effect)

Public Property xxx() As DropDownList
Get
return ddlView
End Get
Set(ByVal Value As DropDownList)
ddlView = value
End Set
End Property

then you go
ucMenu.xxx.Items.FindByText("AC").Selected = True

in that way ddlView can remain protected or private and its still ok

VB Programmer wrote:
On a webform that uses the usercontrol, I am trying to set the value of

a
dropdownlist that is located IN the usercontrol.

Ex: ucMenu.ddlView.Items.FindByText("AC").Selected = True

Is there a better way to do this?

Thanks!

"Kairi Zikpin" <zikkai.nospam.@netscape.net> wrote in message
news:3F**************@netscape.net...
this declaration was likely done by the vs.net (in other words, this is
generated code). vs.net could be the one changing it back, so you need
to find a better way to work with this control. why is it shared? maybe
using public properties to access the protected control would be better

VB Programmer wrote:
>I changed a usercontrol dim from:
> Protected WithEvents ddlView As

System.Web.UI.WebControls.DropDownList
>to:
> Public Shared ddlView As System.Web.UI.WebControls.DropDownList
>
>I saved it SEVERAL times. It was working for about a day then, as I'm
>programming today, I notice that it's changed back to the original. Any
>ideas? This happened several times and each time I fix it it works
fine.
Thanks in advace.
>
>



Nov 17 '05 #3
I'm not the original poster, but I'm having the same problem. If I don't
make the property shared, I get the error "Reference to a non-shared member
requires an object reference" when trying to access the property from the
parent page.

Chris
"Kairi Zikpin" <zikkai.nospam.@netscape.net> wrote in message
news:3F**************@netscape.net...
if the property is shared, the other item has to be shared. why is the
property shared? i dont get that part.

VB Programmer wrote:
Thanks. I tried this:

Public Shared Property ddlMyView() As DropDownList
Get
Return ddlView
End Get
Set(ByVal Value As DropDownList)
ddlView = Value
End Set
End Property

But, I get a squiggly under the ddlView and it says 'Cannot refer to an
instance member of a class from within a shared method or a shared member initialize without an explicit instance of the class'.

Any more ideas? Thanks!

"Kairi Zikpin" <zikkai.nospam.@netscape.net> wrote in message
news:3F**************@netscape.net...
think of a usercontrol as a class/object. it has a public interface and
a non-public interface. that dropdown list is not accesible publicly.
create a read/write property of type dropdownlist as shown below (or
something to that effect)

Public Property xxx() As DropDownList
Get
return ddlView
End Get
Set(ByVal Value As DropDownList)
ddlView = value
End Set
End Property

then you go
ucMenu.xxx.Items.FindByText("AC").Selected = True

in that way ddlView can remain protected or private and its still ok

VB Programmer wrote:

On a webform that uses the usercontrol, I am trying to set the value of

a
dropdownlist that is located IN the usercontrol.

Ex: ucMenu.ddlView.Items.FindByText("AC").Selected = True

Is there a better way to do this?

Thanks!

"Kairi Zikpin" <zikkai.nospam.@netscape.net> wrote in message
news:3F**************@netscape.net...
>this declaration was likely done by the vs.net (in other words, this is>generated code). vs.net could be the one changing it back, so you need
>to find a better way to work with this control. why is it shared? maybe>using public properties to access the protected control would be better>
>VB Programmer wrote:
>
>
>>I changed a usercontrol dim from:
>> Protected WithEvents ddlView As
>
System.Web.UI.WebControls.DropDownList
>>to:
>> Public Shared ddlView As System.Web.UI.WebControls.DropDownList
>>
>>I saved it SEVERAL times. It was working for about a day then, as I'm
>>programming today, I notice that it's changed back to the original. Any>>ideas? This happened several times and each time I fix it it works
>

fine.
>>Thanks in advace.
>>
>>
>


Nov 17 '05 #4
I'm not the original poster, but I'm having the same problem. If I don't
make the property shared, I get the error "Reference to a non-shared member
requires an object reference" when trying to access the property from the
parent page.

Chris
"Kairi Zikpin" <zikkai.nospam.@netscape.net> wrote in message
news:3F**************@netscape.net...
if the property is shared, the other item has to be shared. why is the
property shared? i dont get that part.

VB Programmer wrote:
Thanks. I tried this:

Public Shared Property ddlMyView() As DropDownList
Get
Return ddlView
End Get
Set(ByVal Value As DropDownList)
ddlView = Value
End Set
End Property

But, I get a squiggly under the ddlView and it says 'Cannot refer to an
instance member of a class from within a shared method or a shared member initialize without an explicit instance of the class'.

Any more ideas? Thanks!

"Kairi Zikpin" <zikkai.nospam.@netscape.net> wrote in message
news:3F**************@netscape.net...
think of a usercontrol as a class/object. it has a public interface and
a non-public interface. that dropdown list is not accesible publicly.
create a read/write property of type dropdownlist as shown below (or
something to that effect)

Public Property xxx() As DropDownList
Get
return ddlView
End Get
Set(ByVal Value As DropDownList)
ddlView = value
End Set
End Property

then you go
ucMenu.xxx.Items.FindByText("AC").Selected = True

in that way ddlView can remain protected or private and its still ok

VB Programmer wrote:

On a webform that uses the usercontrol, I am trying to set the value of

a
dropdownlist that is located IN the usercontrol.

Ex: ucMenu.ddlView.Items.FindByText("AC").Selected = True

Is there a better way to do this?

Thanks!

"Kairi Zikpin" <zikkai.nospam.@netscape.net> wrote in message
news:3F**************@netscape.net...
>this declaration was likely done by the vs.net (in other words, this is>generated code). vs.net could be the one changing it back, so you need
>to find a better way to work with this control. why is it shared? maybe>using public properties to access the protected control would be better>
>VB Programmer wrote:
>
>
>>I changed a usercontrol dim from:
>> Protected WithEvents ddlView As
>
System.Web.UI.WebControls.DropDownList
>>to:
>> Public Shared ddlView As System.Web.UI.WebControls.DropDownList
>>
>>I saved it SEVERAL times. It was working for about a day then, as I'm
>>programming today, I notice that it's changed back to the original. Any>>ideas? This happened several times and each time I fix it it works
>

fine.
>>Thanks in advace.
>>
>>
>


Nov 17 '05 #5

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

Similar topics

8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
1
by: VINAY | last post by:
Dear All, The subject line could be bit confusing. So let me explain in details, please have patience. I have developed an ActiveX Control(Combo Box Control) in VB6 for a touch screen...
0
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a...
4
by: Guadala Harry | last post by:
Is there any way for one Session to remove and update objects in another Session? I seriously doubt it, but thought I'd ask. Here's why: I have some data that is unique per user (or per session -...
2
by: cryon.b | last post by:
Hi To All, I took up the IBM sample testfor Exam 700 today and I have the test tomorrow,I have some questions for which Iam not sure about the right answer,can anyone please guide me as to what is...
11
by: John J. Hughes II | last post by:
I have a DataGridView displaying data from a DataSet. To the right of that I have a custom user control which displays one of the data set fields. The custom user control is bound to the data set...
53
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code,...
3
by: monicaw811 | last post by:
I can't figure out what is a constant. How do you start this? Below is info I was given and what I started (not much I know). ...
11
by: Brad Baker | last post by:
I'm building a small web application - I started out placing all my code in one file (config.aspx). As I continue to add code though it was becoming very unwieldy. After doing some searching...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...
0
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,...

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.