473,809 Members | 2,709 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Global Array Structure

wg
I am new the C# coming from a VB6 world. In VB6 I have serveral applications
where I create a UDT in a module then make an array of the UDT. All modules
and forms could access this. Now I am attempting to do this in C#. I would
like to create a Structure then an array of that, (ex. Variable[0].Name,
Variable[0].Value). But I need several classes to have access to the data.
It must be an array because I update some of the values.

Another possiblity is to have the array of strucuture in a single class that
other classes can have access to the data to update.

Can anyone point me in the right direciton.
Jan 21 '06 #1
2 5274
wg,
I am new the C# coming from a VB6 world. In VB6 I have serveral
applications where I create a UDT in a module then make an array of the
UDT. All modules and forms could access this. Now I am attempting to do
this in C#. I would like to create a Structure then an array of that, (ex.
Variable[0].Name, Variable[0].Value). But I need several classes to have
access to the data. It must be an array because I update some of the
values.

Another possiblity is to have the array of strucuture in a single class
that other classes can have access to the data to update.

Can anyone point me in the right direciton.


Create a namespace that will contain these "utility" classes. In that
namespace, create a public class that exposes public methods (API) that
define all of the UDT behavior that the application needs. Implement
private members (fields and methods) that perform the inner workings of the
class and the API. Once it is working and tested, refactor it to ensure
that all code is expressed once and only once and that the interface is
clear and concise. You can then import the namespace and use the UDT class
and API wherever you need it.

If you need a single instance for the entire application, implement the
class using the "Singleton" design pattern.

To do this, you may have to unlearn some of the VB6 approaches that may be
part of your developer tricks of the trade. Good luck and I hope this
helps.

Regards,

Randy
Jan 21 '06 #2
wg,

You will need to declare the array as public and static in order to have
all other classes access it.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"wg" <wg@hotmail.com > wrote in message
news:Hw******** ********@bignew s4.bellsouth.ne t...
I am new the C# coming from a VB6 world. In VB6 I have serveral
applications where I create a UDT in a module then make an array of the
UDT. All modules and forms could access this. Now I am attempting to do
this in C#. I would like to create a Structure then an array of that, (ex.
Variable[0].Name, Variable[0].Value). But I need several classes to have
access to the data. It must be an array because I update some of the
values.

Another possiblity is to have the array of strucuture in a single class
that other classes can have access to the data to update.

Can anyone point me in the right direciton.

Jan 21 '06 #3

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

Similar topics

33
3059
by: MLH | last post by:
I've read some posts indicating that having tons of GV's in an Access app is a bad idea. Personally, I love GVs and I use them (possibly abuse them) all the time for everything imaginable - have been for years. If the machine has memory to spare and windows can use it - I'm thinking "Why not?" I was wondering what some of you have to say about that, particularly any severe "gotchas" you've had the unfortunate experience to contend with.
104
17027
by: Leszek | last post by:
Hi. Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from that array Could you show me a little example how to do this? Thanks.
7
3170
by: Sam | last post by:
Hello I have a structure called Company. struct Company { char *employee; char *employee_address; }; I want to build an array of this structure but the number of employees will change thorughout the course the programs use so it will need to
4
2351
by: Harry | last post by:
Good Day, I am writing a code for the H.264 Video codec.I am using VC++ compiler,but programming is in c only.I have grouped the related global variables under one structure in a header file called global.h.Like this i have two three structures in global.h. To initialise the structure members in global.h,I declared structure variables in c files wherever the structure members are used.
23
2268
by: David Colliver | last post by:
Hi, using c#, 1.1 I know that we are not supposed to use global variables etc. in c# I am having a problem, but not sure how to resolve. I did have another post here, but may have over confused things, so I will start afresh. An example of what I want to do...
2
5002
by: hankypan1 | last post by:
Hi All, I need a tree data structure for my application. It is the non - cyclic simple tree where i can have any number of children node and each child can recursively become a sub tree like a normal tree. Now the thing is i can popullate my tree at compile time like a global data. Since i know my tree definition at compile time, instead of using pointers to point to siblings or child nodes, i am planning to use the array
4
10913
by: koffee | last post by:
Hi people, I've got a question on global structure initialization. A global variable like int can be explicitly initialized as: int Global = 1; But how can I explicitly initialize a self-defined global structure? like:
1
2594
by: sunil | last post by:
Hi, Am developing one shared library for one application. In that .so am having one global array of structure ( two more different structure pointers in this struct). Once the application is launched, then I am allocating the memory on the heap for the internal structures. To print the log messages I am using the below mentioned global variables and time header functions.
5
3804
by: =?Utf-8?B?QXlrdXQgRXJnaW4=?= | last post by:
Hi Willy, Thank you very much for your work. C++ code doesnot make any serialization. So at runtime C# code gives an serialization error at "msg_file_s sa = (msg_file_s) bf.Deserialize(ms);" I thought that it is very hard to memory map structure array. I need both read and write memory mapped file at both side of C# and C++.
0
9721
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
9602
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
10120
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...
0
9200
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
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...
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
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.