Save UserForm Data
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Save UserForm Data

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
geotis
Guest





Posted: Fri Dec 31, 2004 11:27 pm    Post subject: Save UserForm Data Reply with quote

Is there a way to save the ListBox values entered at run time in the UerForm after it's unloaded?

TIA

Back to top
Paul Richardson
Guest





Posted: Sat Jan 01, 2005 12:50 am    Post subject: Re: Save UserForm Data Reply with quote

Any database[or txt file] will do... Don't think there is anything
built in...gl
"geotis" <nospam@address.withheld> wrote in message
news:4483102.1104517660478.JavaMail.jive@jiveforum1.autodesk.com...
Quote:
Is there a way to save the ListBox values entered at run time in the
UerForm after it's unloaded?

TIA
Back to top
geotis
Guest





Posted: Sat Jan 01, 2005 1:26 am    Post subject: Re: Save UserForm Data Reply with quote

Paul,

Thanks for your reply.

Maybe I need to clarify the question.

I fill in the UserForm ListBoxes with text file data at run time, but after unloading the UserForm, I don't know how to save the text file data in the UserForm.

Back to top
John Goodfellow
Guest





Posted: Sat Jan 01, 2005 2:19 am    Post subject: Re: Save UserForm Data Reply with quote

How are you getting the data from the text file into the listbox? Show us
the code and we can probably show you a reverse process.
--
John Goodfellow
irtfnm
use john at goodfellowassoc dot com


"geotis" <nospam@address.withheld> wrote in message
news:8628937.1104524797381.JavaMail.jive@jiveforum1.autodesk.com...
Quote:
Paul,

Thanks for your reply.

Maybe I need to clarify the question.

I fill in the UserForm ListBoxes with text file data at run time, but
after unloading the UserForm, I don't know how to save the text file data in

the UserForm.
Back to top
geotis
Guest





Posted: Sat Jan 01, 2005 4:24 am    Post subject: Re: Save UserForm Data Reply with quote

Sorry, it's TextBoxes with the data, not ListBoxes.

A 1x70 array of TextBoxes (sBox) is filled with a 10x7 array of Doubles (Soil(I,J)) that are Input from a text file:

Public Soil(1 To 10, 1 To 7) As Double, sBox(1 To 70) As TextBox
Sub SoilDataData(Soil, sBox)

Set sBox(1) = frmSoilData.TextBox1
Set sBox(2) = frmSoilData.TextBox2...
..
..
Set sBox(70) = frmSoilData.TextBox70

N = 0
For I = 1 To 10
For J = 1 To 7
N = N + 1
sBox(N).Value = Soil(I, J)
Next J
Next I

So, how do I save these arrays in the UserForm (frmSoilData) after the form is Unloaded?

Thanks
Back to top
geotis
Guest





Posted: Sat Jan 01, 2005 4:30 am    Post subject: Re: Save UserForm Data Reply with quote

Sorry again...

How do I 'Save' the sBox(1 To 70).Values in frmSoilData?
Back to top
Paul Richardson
Guest





Posted: Sat Jan 01, 2005 4:43 am    Post subject: Re: Save UserForm Data Reply with quote

John's suggenstion will get you a closer response...
but here is the idea...

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Dim nFile1 As Integer: nFile1 = FreeFile
Dim oControl As Control
'Create New file
Open "c:\Temp.txt" For Output As #nFile1
For Each oControl In UserForm1.Controls
Print #nFile1, oControl.Name & vbTab & oControl.Value
Next oControl
Close #nFile1
'Delete original and rename Temp
VBA.Kill ("c:\FileControlsWereLoadedFrom.txt")
Name "c:\Temp.txt" As "C:\FileControlsWereLoadedFrom.txt"
End Sub

gl

Paul

"John Goodfellow" <bitbucket@verizon.net> wrote in message
news:41d5c1e9$1_2@newsprd01...
Quote:
How are you getting the data from the text file into the listbox? Show us
the code and we can probably show you a reverse process.
--
John Goodfellow
irtfnm
use john at goodfellowassoc dot com


"geotis" <nospam@address.withheld> wrote in message
news:8628937.1104524797381.JavaMail.jive@jiveforum1.autodesk.com...
Paul,

Thanks for your reply.

Maybe I need to clarify the question.

I fill in the UserForm ListBoxes with text file data at run time, but
after unloading the UserForm, I don't know how to save the text file data
in
the UserForm.
Back to top
geotis
Guest





Posted: Sat Jan 01, 2005 6:29 pm    Post subject: Re: Save UserForm Data Reply with quote

I have failed to convey my question.

TheTextBox controls in the UserForm contain default data before run time, then are filled with new data at run time... how do I retain the new data in the UserForm controls after the UserForm is Unloaded?

Bruce Smith
Back to top
Paul Richardson
Guest





Posted: Sat Jan 01, 2005 7:45 pm    Post subject: Re: Save UserForm Data Reply with quote

Check out the thread "Can VBA code write to itself"

"geotis" <nospam@address.withheld> wrote in message
news:22073618.1104586172916.JavaMail.jive@jiveforum1.autodesk.com...
Quote:
I have failed to convey my question.

TheTextBox controls in the UserForm contain default data before run time,
then are filled with new data at run time... how do I retain the new data
in the UserForm controls after the UserForm is Unloaded?

Bruce Smith
Back to top
geotis
Guest





Posted: Sat Jan 01, 2005 8:42 pm    Post subject: Re: Save UserForm Data Reply with quote

I will do that, but I did accomplish what I need to do by Hiding the form and not Unloading it, this keeps the data in memory.

Thanks
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB