-
Sep 6th, 2013, 07:57 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] saving all textboxes
hi
on my form it creates some html pages in a textbox at runtime
this looks on forms and lists all known textboxes
i just need to save them all
its finding them ok
Code:
Dim lines() As String, i As Integer
Dim txt_Name As String
Dim Txt As Control
For Each Txt In Controls
If TypeOf Txt Is TextBox Then
Open App.Path & "\SvrHtml\" & Txt.Name & ".html" For Output As #1
lines() = Split(Txt.Name , vbCrLf) ''' wont work but any other textbox "name" without the .text will
For i = 0 To UBound(lines)
Print #1, lines(i)
Next
Close #1
End If
Next
if i change the Txt.Name to Text1 etc it saves that box ok
a bit confused where im going wrong
-
Sep 6th, 2013, 08:14 PM
#2
Hyperactive Member
Re: saving all textboxes
Text1 defaults to Text1.Text. a quick look makes me think you should change the code to lines() = Split(Txt.Text , vbCrLf)
and i see you declared txt_Name, but you dont seem to use it.
-
Sep 6th, 2013, 08:18 PM
#3
Re: saving all textboxes
You should not be using txt.Name there as all that would return would be the name of the textbox not the content of it.
You should use either just txt or txt.text there, assuming of course you want the text from the textbox.
-
Sep 6th, 2013, 08:22 PM
#4
Thread Starter
Hyperactive Member
Re: saving all textboxes
thanks for that its been anoying me for ages
works as
Code:
lines() = Split(Txt.Text, vbCrLf)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|