I am thinking that maybe you can use CultureInfo for what you are trying to do, either by settings directly the properties on the current culture, or creating a new one and setting it as current. That way, you can control what is the default format for numbers, dates, etc. Just another way to look at the problem ...
Sébastien On 8/12/08, Greg Rothlander <[EMAIL PROTECTED]> wrote: > > Thanks for all of the suggestions of using extension for this. That really > helps but it leaves one issue still remaining. I can use the extensions to > apply the format. That works well using extensions. But now I need to > pull > in the format string as well from somewhere. I have stored them in a > little > array, but now I need to pull the back out. > > If extensions would allow me to actual extend the datatypes so that I could > have something like: > Dim int1 as integer = 0 > Int1.FormatString = "0000000" > Then that would work well for what I am doing. However, I don't see how > you > could do this using extensions, at least not in the examples that I saw. > What I can do is Int1.FormatString() and the extension will apply the > format > for me, but I still have to tell it what format to apply. What I would > like > to do is when I declare the variable, also declare the format, which could > actually just be its declared length... not its current length. > > To pull the length or format I can store the format string or the length in > a little array. But I would need to pull the value back out when the > extension is used so that the format string could be applied. Here's a > simple example: > > Dim int1 as integer = 79 > > Public Sub DoSomething(byVal var as integer) > 'How do I know what the declared name of var actually is so I can > look it up in the array and see what the format string value is? > Sub Function > > I need to be able to ask var what the passed in variable's name is. Can I > do that? I do not need to know that the value is 79, but I need to know > that the original integer that was passed in was declared as "int1". Is > there a way to do that? I can pass it in as byref. > > Basically, I just want to add another property to the datatypes. I want to > add either .declaredlength or .formatstring to a variable. Extensions will > allow me to execute the format, but I don't see a way to have it store the > format or decalred length. Either of these would solve my problem. > > Any thoughts? Any suggestions? > > Any comments are appreciated. > > Best regards... > > > =================================== > This list is hosted by DevelopMentor(R) http://www.develop.com > > View archives and manage your subscription(s) at > http://discuss.develop.com > -- Sébastien www.sebastienlorion.com =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com