Why does this work:
***********************
Public Class WebForm2
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code ".....
Private y As String = "Hello"
Property Prop() As String
Get
Return y
End Get
Set(ByVal Value As String)
y = Value
End Set
End Property
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Prop = "GoodBye"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Label1.Text = Prop
End Sub
End Class
***********************
....and not this?
***********************
Public Class WebForm2
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code ".....
Private y As String = "Hello"
Property Prop() As String
Get
Return y
End Get
Set(ByVal Value As String)
y = Value
End Set
End Property
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Label1.Text = Prop
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
Prop = "GoodBye"
End Sub
End Class
***********************
Thanks in advance for your help
Mike 5 1264
Can I presume in the 2nd example, you let the form open, click button 2 and
then button 1?
What do you get to suggest it "doesn't work"?
"Mike" <mi***********@ca.gi-de.com> wrote in message
news:c8**************************@posting.google.c om... Why does this work: *********************** Public Class WebForm2 Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code ".....
Private y As String = "Hello"
Property Prop() As String Get Return y End Get Set(ByVal Value As String) y = Value End Set End Property
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Prop = "GoodBye" End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Text = Prop End Sub
End Class *********************** ...and not this? *********************** Public Class WebForm2 Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code ".....
Private y As String = "Hello"
Property Prop() As String Get Return y End Get Set(ByVal Value As String) y = Value End Set End Property
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Text = Prop End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Prop = "GoodBye" End Sub
End Class *********************** Thanks in advance for your help Mike
Change to
Private Shared Y As String = "Hello"
Then Change to
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
Y = "GoodBye"
End Sub
You now have a static value that is updated and can be set to the Label when
you click. Not the best design, but it solves the problem.
---
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"Mike" wrote: Why does this work: *********************** Public Class WebForm2 Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code ".....
Private y As String = "Hello"
Property Prop() As String Get Return y End Get Set(ByVal Value As String) y = Value End Set End Property
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Prop = "GoodBye" End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Text = Prop End Sub
End Class *********************** ....and not this? *********************** Public Class WebForm2 Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code ".....
Private y As String = "Hello"
Property Prop() As String Get Return y End Get Set(ByVal Value As String) y = Value End Set End Property
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Text = Prop End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Prop = "GoodBye" End Sub
End Class *********************** Thanks in advance for your help Mike
Mike,
Does it completly not show a page, strange
Cor
Yes John, your presumption is accurate.
Sorry, I should have been more clear.
Once the webform is open, I press button2, then button1!
Therefore, why does the value 'y' still post "Hello"? I set the value
to "Goodbye" by pressing button2. No?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Hello Cowboy,
thanks, that's better!
If you don't mind me asking, what is a better design you're refering
too?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Rick Austin |
last post by:
I recently had to perform a reinstalltion of Windows XP (my registry seems to have become corrupt). After this completed I had to reinstall all applications since most use the registry for settings,...
|
by: Lyn |
last post by:
Hi,
This question may seem a bit academic...
To learn more about Access VBA, I have been enumerating the properties of
various form controls. This was mostly successful and I have learned a lot...
|
by: Sunny |
last post by:
Hi,
I have an old problem which I couldn't solve so far. Now I have found a post
in that group that gave me an idea, but I can not fully understand it.
The problem is: I'm trying to use a...
|
by: JerryP |
last post by:
Hello,
is there a way to launch the property dialogue for a directory from my c#
app ?
I would also like to launch the User Account Properties from Active
Directory Users and Computers, and the...
|
by: Martin Montgomery |
last post by:
I have, for example, a property called myProperty. I would like, when using a property grid to display the property name as "My Property". Is this possible. Is there an attribute etc
Thank
...
|
by: Donald Grove |
last post by:
Is it possible to retrieve field properties from a table in access2000
using code?
I have tried:
"
dim dbs as dao.database
dim tbl as dao.tabledef
dim fld as dao.field
dim prop as...
|
by: Christophe Peillet |
last post by:
I have a CompositeControl with two types of properties:
1.) Mapped Properties that map directly to a child control's properties
(ex.: this.TextboxText = m_txt.Text). These properties are handled...
|
by: Anderskj |
last post by:
Hi!
I am developing a c# application. I have a interface (which can change
therefore my problem)
If i do like this:
List<PropertyInfoproperties = new List<PropertyInfo>();...
|
by: =?Utf-8?B?UmljayBHbG9z?= |
last post by:
For some unknown reason (user error?), I cannot get a NameValueCollection to
persist in the app.config file.
Unlike other settings, I cannot get the String Collection Editor GUI to
allow my to...
|
by: FullBandwidth |
last post by:
I have been perusing various blogs and MSDN pages discussing the use
of event properties and the EventHandlerList class. I don't believe
there's anything special about the EventHandlerList class in...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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...
| |