Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

saving Richtextbox text dilemma

Status
Not open for further replies.

Terence

Technical User
Feb 22, 2001
30
US
Okay i can save the richtextbox text like so:

Private Sub DAYSHIFT()

Dim DAYSHIFT As String
Dim Filenum As Integer

Filenum = FreeFile


DAYSHIFT = "filename" & Format$(Now, "_dd_mm_yy.txt")


Open DAYSHIFT For Output As Filenum
Write #Filenum, RichTextBox1.Text, RichTextBox1.SelText
Close Filenum

End Sub

this works fine if i call this from a command button or the like. The problem is that when i call this from inside a timer1_timer sub , then i don't get any of the text saved.
Any Idea's..... #-)
 
Did you set the timer1.Enable = True? And the Timer1.Interval > 0?
 
yes the timer works, i can call the dayshift sub from the timer when requested and it will save the file and put it on the hard drive, the only problem is that the "text" is missing if i call the sub from the timer function.
I have one other interesting note, i had added two other forms to the project and since i added these, this is when the trouble seem to start. The other forms are not calling this sub, but when these forms were removed then this function worked again.
:cool:
 
Before I asked you questions on my last post, I had copied your code, add a command button and a timer. It works, both from the command1_click or Timer1_Timer event. The DayShift procedure is OK.

I think you need to check line by line on the 2 other forms that raise this trouble.

 
yes, i have done this as well and got the same results. i have brought the form home and redid it. i got it work here and then at work. I did remove the "richtextbox1.seltext"
part and it still worked and i also changed the "write " to "print" as the book sugested.
i complied the program and ran it, then it didn't save a thing, but i know it ran because i delete the text when it is saved. Still losing hair over this one .....

X-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top