473,412 Members | 2,304 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,412 software developers and data experts.

Setting variable problem

Rob
I have a public class setup as follows

Public Class Variables

Shared Property FranFormOpen() As Boolean
Get
Return FranFormOpen
End Get
Set(ByVal Value As Boolean)
FranFormOpen = Value
End Set
End Property
End Class

I can pull the franformopen variable no problem but when I try to set the
value it errors out. Here is the code I am using to try to set the value:

If FranFormOpen.Equals(False) Then
mdifrmFranchise.MdiParent = Me
mdifrmFranchise.Show()
mdifrmFranchise.WindowState = FormWindowState.Maximized
'cmdFranchiseForm.Checked = True
Variables.FranFormOpen = True
'Validation.cmdUncheck(sender, e)
Else
mdifrmFranchise.WindowState = FormWindowState.Maximized
End If

When debuging...and trying to set the variable...it shows "value" as being =
to True but when it gets to "FranFormOpen = Value" it never changes value to
"True" it just goes back to the "Set(ByVal Value As Boolean)" statement and
keeps looping untill it errors out.

What am I doing wrong?

Thank you
Nov 22 '05 #1
2 1537
You're trying to set the property again from within the property. That gives
you a infinite loop

you need an instance variable to store the value in instead¨.

Public Class Variables
Private ffo As Boolean

Shared Property FranFormOpen() As Boolean
Get
Return Me.ffo
End Get
Set(ByVal Value As Boolean)
Me.ffo = Value
End Set
End Property
End Class
--
Patrik Löwendahl [C# MVP]
www.cshrp.net - "Elegant code by witty programmers"
"Rob" <Ro*@discussions.microsoft.com> wrote in message
news:EC**********************************@microsof t.com...
I have a public class setup as follows

Public Class Variables

Shared Property FranFormOpen() As Boolean
Get
Return FranFormOpen
End Get
Set(ByVal Value As Boolean)
FranFormOpen = Value
End Set
End Property
End Class

I can pull the franformopen variable no problem but when I try to set the
value it errors out. Here is the code I am using to try to set the value:

If FranFormOpen.Equals(False) Then
mdifrmFranchise.MdiParent = Me
mdifrmFranchise.Show()
mdifrmFranchise.WindowState = FormWindowState.Maximized
'cmdFranchiseForm.Checked = True
Variables.FranFormOpen = True
'Validation.cmdUncheck(sender, e)
Else
mdifrmFranchise.WindowState = FormWindowState.Maximized
End If

When debuging...and trying to set the variable...it shows "value" as being
=
to True but when it gets to "FranFormOpen = Value" it never changes value
to
"True" it just goes back to the "Set(ByVal Value As Boolean)" statement
and
keeps looping untill it errors out.

What am I doing wrong?

Thank you

Nov 22 '05 #2
On Mon, 11 Oct 2004 17:41:41 +0200, Patrik Löwendahl [C# MVP] wrote:

you need an instance variable to store the value in instead¨.


If I'm not mistaken, a shared property connot access an instance variable.
The variable must be declared Shared as well.
--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 22 '05 #3

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

Similar topics

5
by: Aamer Nazir | last post by:
Hi, I am having problems setting the value of a variable in a SQL String that I have to create dynamically in my procedure. The code that I currently have is as follows: set...
2
by: TF | last post by:
hi, i am using a ListBox control on a windows form using VB.Net. when i set the DataSource property of the control to an ArrayList it fires following events in this order: SelectedIndexChanged...
2
by: lawrence | last post by:
I thought I was fighting a PHP problem, so I asked about this on a PHP list, but they felt it was a Javascript problem, so I'm reposting a bit of the debate here. Could this Javascript, below,...
6
by: Niyazi | last post by:
Hi, We have and IBM AS400 and I belive the reional setting is Turkish. The IBM Client-Access for Windows that install in our PC (WIN XP SP2) set to Turkish characters. Now my PC has English...
1
by: Darrel | last post by:
I've figured out how to read a variable in one ASCX file from another. Works great. I now would like to have one ASCX file set a variable in its parent ASPX or another ASCX file. Can that be...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
2
by: Martin Gregersen | last post by:
Hi Looking for a way to bind a readonly property on a textbox to a parameter, not having to cycle through all controls, but rather setting <textbox id="myTextbox" readonly="<%# SetReadOnly...
2
by: vbLeo | last post by:
Hello Guys, I'm trying to dynamically create forms and add controls to them. I'm specifically having a problem with establishing a data source for my textbox. I am able to add a remote data...
1
by: Thelma Roslyn Lubkin | last post by:
I have a form with several comboboxes whose contents I'm trying to initialize from a table. The table, ComboSelections, has 3 fields, an autonumber ID and two text fields, ListCode and ListEntry....
6
by: DippyDog | last post by:
This is an old old post that I'm referencing regarding what happens when you set an integer variable to Nothing. It gets set to zero, not "Nothing." ...
0
BarryA
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...
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
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
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...
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
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
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...

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.