LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 125
Default Retaining value of a string from a textbox on a form ??

I am working with a form which has a textbox that I am entering text into and
than passing the the string value entered into the text box on my form to a
string variable.
for example...

Sub test()
Dim MyTxtString as String
MyForm.Show
MyTxtString = MyForm.Mytextbox.value
MyForm.Hide
MsgBox (MyTxTString)
End Sub()

The problem is that the string from the textbox on MyForm does get assigned
to MyTxtString variable, however as soon as the form his hidden the variable
MyTxtString looses the value entered into the textbox and the value of
MyTxtString becomes "" (nothing).
How do I maintain the scope of MyTxtString to keep the value assigned to it
even when the form is hidden ?

I have already tried declaring MyTxtString as a Public Global variable but
the scope and life of MyTxtString still is not maintained.
What am I doing wrong ?

Dan.
 
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
Set Textbox on a Form to Deafault John Calder New Users to Excel 7 July 28th 09 01:39 AM
text boxes retaining their last value on form close and restart NDBC Excel Discussion (Misc queries) 3 July 1st 09 12:55 PM
textbox on form Glenn Robertson Excel Programming 1 March 4th 04 11:29 AM
Separate String into string + value form Johnny[_6_] Excel Programming 3 February 27th 04 02:38 PM
Retaining text formatting in TextBox Tom Ogilvy Excel Programming 0 September 9th 03 08:05 PM


All times are GMT +1. The time now is 08:08 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"