473,322 Members | 1,307 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,322 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 1532
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
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.