I'm moving some code from an old language and rewriting it in .Net.  I have
come across an odd situation where I will have to go in and rework a great
deal of code and I'm looking for a less complex and time consuming solution.
Here's the basic idea...

In the old language they are using a string constant such as:

        Const c1FullAddr as String = "1 Colonial Drive  Parma  Ohio 21321"

Then they follow that up with another constant:

        Const   c1FaLen as String = c2FullAddr.length

In VB.Net you cannot do this.  Is there a way to do this without having to
count the length of c1FullAddr and hard coding the value or without changing
it from a constant?  I can ceratianly go through and count the lengths and
hardcode the values, or I could do through and change all of the "const" to
"dim" and it would work, but it would like to keep it as a constant in the
new version as well, if I can.

Of course the most obvious solution would be to simply make it a string
variable and not a string constant.  I will do that if I need to, but I
thought there might be a trick here to get this to work as a constant, but I
certainly cannot see any way to make it work as a constant.

I think the real issue here is that if it is defined at runtime and not
design time, then it's not really a constant.  So maybe there is no way to
do this in VB.Net, as a constant and just simply changing it to a string
variable is the correct approach.

Any thoughts or suggestions would be very much appreciated.

Best regards,
Jon

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to