472,985 Members | 2,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,985 software developers and data experts.

Integer Resources

I want to have a resource file with integers, rather than strings, and
have VS 2008 generate a global object with integer properties, rather
than string properties. Is this possible?

(I know I can convert the values to strings, but I'd like to know if
there's a cleaner solution.)

Thanks

Jul 9 '08 #1
6 5400
Greg,

Add a settings file instead. In that, you can specify the type of the
setting and it will generate the type-safe properties to access the
settings.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Greg Esres" <ge****@boundvortex.comwrote in message
news:91**********************************@b1g2000h sg.googlegroups.com...
>I want to have a resource file with integers, rather than strings, and
have VS 2008 generate a global object with integer properties, rather
than string properties. Is this possible?

(I know I can convert the values to strings, but I'd like to know if
there's a cleaner solution.)

Thanks

Jul 9 '08 #2
Nicholas wrote:

<<Add a settings file instead. *In that, you can specify the type of
the setting and it will generate the type-safe properties to access
the settings.>>

Interesting...I wasn't familiar with this feature. Do you feel this
is an appropriate way to define constants, such as data input field
lengths?

Thanks
Jul 9 '08 #3
Greg,

Well, if they are truly constants, then the value would never change and
you should be defining them in code with const.

For something like data input field lengths, I would think that there is
a better way to do this. I would think that the underlying data store would
have information on the field length which you can query, and not have to
replicate the data (a DB will expose this information, if it is XML, then
you should be able to get it from the schema).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Greg Esres" <ge****@boundvortex.comwrote in message
news:f7**********************************@a70g2000 hsh.googlegroups.com...
Nicholas wrote:

<<Add a settings file instead. In that, you can specify the type of
the setting and it will generate the type-safe properties to access
the settings.>>

Interesting...I wasn't familiar with this feature. Do you feel this
is an appropriate way to define constants, such as data input field
lengths?

Thanks
Jul 9 '08 #4
Nicholas wrote:

<<Well, if they are truly constants, then the value would never change
and
you should be defining them in code with const.>>

Most things in life are constant in the short term, but variable in
the long term. :-)

<<For something like data input field lengths, I would think that
there is
a better way to do this. I would think that the underlying data store
would
have information on the field length which you can query>>

Yes, that can be done, but presents somewhat of an organizational
challenge for a large database. I don't have a paradigm in place for
that. Might be able to use reflection to somewhat automate it, but
I'll have to give it some thought.

Preferable to have the code AND database pull from the same data
dictionary.

Thanks

Jul 9 '08 #5
On Jul 10, 12:19*am, Greg Esres <ges...@boundvortex.comwrote:
Nicholas wrote:

<<Add a settings file instead. *In that, you can specify the type of
the setting and it will generate the type-safe properties to access
the settings.>>

Interesting...I wasn't familiar with this feature. *Do you feel this
is an appropriate way to define constants, such as data input field
lengths?
If they are not truly constants, but rather tweakable parameters,
then, yes, an application-wide settings file is the way to go.
Just keep in mind that user will sufficient privileges to edit
your .config will then be able to change them on his system...
Jul 10 '08 #6
Pavel wrote;
<<If they are not truly constants, but rather tweakable parameters,
then, >>

Field lengths are probably something that no user should be able to
modify. I'd rather have some way to periodically ensure there was a
match between the database and what the application thought the field
length were. I don't like the idea of the program checking on every
execution, but having to change the source code and recompile is a bit
inflexible. Resource files seem to be a good compromise, but the .Net
environment seems to support only strings.

Thanks
Jul 10 '08 #7

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

Similar topics

1
by: Derick Smith | last post by:
Hi! I am just starting to use .NET and need some help! If I create my own DLL for String resouces using this command: C:\WINNT\MICROS~1.NET\Framework\v1.1.4322\Al /t:lib...
8
by: Lash Rambo | last post by:
How does one go about programming in C++ without making assumptions about the size of types? Is it really possible? For instance, even the well-intentioned, portable C++ (and C) code I've seen...
10
by: emmx | last post by:
Hi I am new to c. I am trying to write a simple program which will prompt the user to enter an integer between 1 and 9 and the output will be produced as follows (eg. 5) 1 22 333 4444 55555
3
by: Jesse | last post by:
Hi together, I've a problem with compiling an application with a build-Script and run it after. Several resource-files I compile with resgen.exe and put the files into a folders of the...
1
by: Stefan Turalski \(stic\) | last post by:
Hi, What I need to do is adding some support for resources files to my application. What I did is: MyAppMain <- startup project MyAppHelper <- project which has MyAppResourcesClass (al a...
4
by: Rachel Suddeth | last post by:
What is the difference between a managed/unmanaged resource, and how do you tell which is which? I'm trying to understand how to write some Dispose() methods, and we are supposed to put code that...
4
by: Roy | last post by:
Hi all, How can I assign null to an integer. This doesn't work Dim intMyValue As Integer intMyVal = System.DBNull.Value Thanks in advance, Roy
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
30
by: =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= | last post by:
Let's say we had a simple function for returning the amount of days in a month: unsigned DaysInMonth(unsigned const month) { switch (month) { case 8: case 3: case 5:
20
by: Robbie Hatley | last post by:
I needed a quick program called "random" that gives a random positive integer from n1 to n2. For example, if I type "random 38, 43", I want the program to print a random member of the set {38,...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.