LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default Extract text from a "textbox"

Validations should be in the userform - I'll give you that. The
external approach I used was more like a demonstration of code
possibilities rather than thougth-through methodology.

At the end of the day it's a matter of preference - the way i see it -
i don't like code with too many global variables - they get my head
spin. In addition to that in the setup one still ends up with the
global variable being tightly bound to the userform - so why not to
have it encapuslated in it to begin with.
I used to write codes with multiple global variables but along the way
i realized that it wasn't for me.

I recon the "Otherwise, wouldn't InputBox suffice?" wasn't really a
question.


On Dec 30, 7:13*pm, GS wrote:
AB submitted this idea :





The reason i do it this way (and - as per the code - i terminate the
form and don't keep it in memory longer than necessary) is otherwise
there is way big of a chance (for me anyway) that the global variables
would have retained the value from previous user entry and not the
current one - as that's the whole point - you give it a value, it
keeps it as long as in compile state.
But when a code grabs that public varialbe - how would it know whether
that is an entry that the user typed into the form just now or 60mins
ago? To manage that aspect strict controls need to be in place and i
find the
form.hide
read control value
unload form
method more convenient and safer especially it's not such a big of a
drag onto the pc's memory anyway.
Just my 0.02 of worth.


You cite a good point. This is precisely why I used a function to load
the userform. That function clears any previous values in the vars
before it opens the userform, ensuring that any values in the vars will
be new to the current input.

Note that I suggest the input values should be validated by the
userform. This is so the userform purpose can be encapsulated and thus
reusable. The procedure that processes the data doesn't need (nor
shouldn't IMO) to know anything about how the data was collected in
order to do its task, which only happens if the function was
successful. This, in turn, depends on what happens in the userform as
far as validation of input goes OR if the user cancels. Again, this
should be handled in the userform.

<FWIW
Seems that popular opinion regarding userforms that collect data/input
is that the userform should handle all validations and where the valid
data goes. Our procedures that use/process the data should not be
'tied' to the userform in any way.

Otherwise, wouldn't InputBox suffice?

--
Garry

Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc- Hide quoted text -

- Show quoted text -


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Text "comparison" operator for "contains" used in an "IF" Function Pawaso Excel Worksheet Functions 4 April 4th 23 11:35 AM
Extract text plus "n" characters or date on partial match FabZ Excel Programming 11 March 23rd 07 12:05 AM
Can you Click the "Enter" key to go to the next line in a Textbox without Exiting the Textbox ? Corey Excel Programming 1 February 22nd 07 05:09 AM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM
How do I split "A1B2" into "A1" and "B2" using text to column fun. Jennifer Excel Programming 1 February 2nd 05 10:01 PM


All times are GMT +1. The time now is 12:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"