473,666 Members | 2,105 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Best way to access the variable in C#

3 New Member
I have 3 classes

Class A & Class B and Class C

CLASS A is a main class and it has a "seqno" static variable.

Class A has a method with FOR LOOP which calls CLASS B method. CLASS B calls CLASS C method.

Class C Method has a code to generate a sequence number.

I would like to keep the same sequence number if there was any expection in the FOR loop in CLASS A from the previous call.

I am accessing this variable in class C as Class A.seqno.

Are there any other ways to achieve this functionality? What is the best way?(using object oriented)


Thanks in advance
Nov 9 '07 #1
2 881
Plater
7,872 Recognized Expert Expert
What?
That seems like workable way to go about it?
Nov 9 '07 #2
kenobewan
4,871 Recognized Expert Specialist
I assume that you want a try catch block to deal with exceptions. HTH.
Nov 10 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
4656
by: JStrummer | last post by:
I have a question regarding paths and the include() statement in PHP. I develop in a Windows environment and will be publishing to a Linux server. I would like to do the following: 1. Setup my include references in such a way that I don't have to change them all every time I have to publish to the production server 2. Setup above in such a way that won't involve php.ini (& LInux equivalent), as I have access to edit this file...
4
4888
by: David | last post by:
Hello. I am looking for advice on what is "best practice" regarding looping through a form to check its checkboxes and associated data fields. Here is what I am trying to do (Here is the page I am working on: http://www3.telus.net/thothworks/LinLeastSqPoly4.html). I provide a form for a user to enter up to twenty (M = 20) data pairs. The user need not enter data for all twenty pairs, but the user must indicate that data is present by...
9
3263
by: Frances | last post by:
Hi All, * PREMISE * I'm creating an Access form with 150 items subdivided into 20 categories. Multiple categories (and items) can be selected so my user wants checkboxes. All of the options need to be visible at the same time so no dropdowns (combo boxes) and no scrolling lists (list boxes). I will use tabbed sheets with logically grouped categories (and their respective items).
5
2142
by: Joe Kasta | last post by:
Hi, I'm trying to determine what the proper way to create objects would be in C# (or any language, practically). There are two different ways of implementing objects that I can see, and I hope someone can give their two cents as to which is more preferred. Object 1: Have a Class with readonly properties and mutate all of the private variables directly within the class. Any function within the class may directly modify any private...
2
2717
by: Duncan Welch | last post by:
Good morning, I have a classic ASP app that I'm converting to .NET. In the existing app when accessing infrequntly changed data, it reads a database once a day, and saves the results in an application variable. I'm trying to replicate this in .NET, but I'm using a data access layer (DAL) that's in a seperate project. Obviously, the DAL can't see the application variables. I was thinking of passing the application state in the...
2
1742
by: bnob | last post by:
I have to keep a variable (integer) during the navigation of my asp.net project (vb.net code behind). So actually I use a module where I declare a global variable Public MyGlobalVariable as integer In all my form I refer to this variable with MyGlobalVariable . Is this method the best way to use global variable ? Or is session
17
5523
by: Woody Splawn | last post by:
I am finding that time after time I have instances where I need to access information in a variable that is public. At the same time, the books I read say that one should not use public variables too much - that it's bad programming practice. Is there an easy way to deal with this? I would like to do things in the "Best Practices" way but at the same time I don't want to make a federal case out of it. This comes up over and over...
10
2982
by: Ren | last post by:
Hi All, I'm still rather new at vb.net and would like to know the proper way to access private varibables in a class. Do I access the variable directly or do I use the public property? public class MyClass private _variableName as integer public property VariableName as integer
1
2312
by: Jarle Aase | last post by:
Hi, I wrote a multilanguage cms system a few years ago. Different languages are handled by loading php-files where each language-specific string is assigned to a normal php-variable ($LNG array). This loading takes place for each request. Now I'm developing a backend server in C++ that will allow some better security-checking, session management and caching. The backend server has a
41
2861
by: Jim | last post by:
Hi guys, I have an object which represents an "item" in a CMS "component" where an "item" in the most basic form just a field, and a "component" is effectively a table. "item" objects can be created and then added to "component" objects to build up the component definition. My dilemma comes in deciding how to read/write data to the "item"
0
8449
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8360
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
8876
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...
0
8642
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
6198
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
4198
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
4371
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1777
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.