Check if Richtextbox saved?
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
ok before we start,
im using a tabcontrol and generating the richtextbox.
rtb = richtextbox
so how would i check if the tab's rtb has saved?
and have it save every 5 minutes or so?
im using a tabcontrol and generating the richtextbox.
rtb = richtextbox
so how would i check if the tab's rtb has saved?
and have it save every 5 minutes or so?
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that 

EDIT: Do you want auto-save too?
Under Public Class Form1,
(add this alongside your new tab functions)
For i = 0 To UBound(rtbCount)
then add "- 1" after the closing parenthesis.
If I helped, +rep please
Under Public Class Form1,
Code: Select all
In a save event,Public rtbArray() As Boolean
Public tabCount As Integer
Code: Select all
In the new tab event,Dim tabInt As Integer
tabInt = TabControl1.SelectedIndex
rtbArray(tabInt) = True
(add this alongside your new tab functions)
Code: Select all
In a timer with it's interval at 300000,tabCount += 1
ReDim Preserve rtbArray(tabCount)
Code: Select all
NOTE FOR TIMER: Change path to the path you want it to save to, and if you want to save it as a specific file type, put a comma after the path. If you get an error on this line:For i = 0 To UBound(rtbCount)
If rtbCount(i) = False Then
CType(TabControl1.TabPages.Item(i).Controls(0), RichTextBox).SaveFile(path)
End If
Next i
For i = 0 To UBound(rtbCount)
then add "- 1" after the closing parenthesis.
If I helped, +rep please

ok, the autosave seems to work, ill try the other things now.
EDIT:
i get an error in this sub
Error2: Count is not declared.
EDIT:
i get an error in this sub
Code: Select all
Error1: rtbCount is not declared.Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
For i = 0 To UBound(rtbCount)
If Count(i) = False Then
CType(TabControl1.TabPages.Item(i).Controls(0), RichTextBox).SaveFile(path)
End If
Next i
End Sub
Error2: Count is not declared.
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that 

Code: Select all
Fixed. Make sure rtbCount() is declared under Public Class Form1.Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
For i = 0 To UBound(rtbCount)
If rtbCount(i) = False Then
CType(TabControl1.TabPages.Item(i).Controls(0), RichTextBox).SaveFile(path)
End If
Next i
End Sub
you can make it save the path when the user saves it and then on exit make it open the file and compare it
Huh, i got banned for reporting a bug. The admin thought i had exploited it when i haven't, there isn't even evidence i had exploited it, but when i tried explaining that i hadn't they didn't understand me. After the ban i also lost 107 credits to make it more "fun".
GoodGuy17 wrote:Im not the brightest with declaring.Code: Select allFixed. Make sure rtbCount() is declared under Public Class Form1.Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick For i = 0 To UBound(rtbCount) If rtbCount(i) = False Then CType(TabControl1.TabPages.Item(i).Controls(0), RichTextBox).SaveFile(path) End If Next i End Sub
I declared it as
Code: Select all
is this what i was supposed to declare as?Dim rtbCount() As Boolean
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that 

Hmm...
Redo my steps above and see if you missed something. I cannot see why it would tell you rtbCount is not declared unless you didn't put it under Public Class Form1.
Redo my steps above and see if you missed something. I cannot see why it would tell you rtbCount is not declared unless you didn't put it under Public Class Form1.
GoodGuy17 wrote:Hmm...in your steps above rtbCount is not mentioned.
Redo my steps above and see if you missed something. I cannot see why it would tell you rtbCount is not declared unless you didn't put it under Public Class Form1.
and i did rtbCount as Boolean
and i got this error when opening the debugging the form
Code i got Error From:
Code: Select all
Error i got from this code:
For i = 0 To UBound(rtbcount)
Code: Select all
Value cannot be null.
Parameter name: Argument 'Array' is Nothing.
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that 

Ooohh ouch lol. I got scrambled up and put rtbCount instead of rtbArray. Replace the timer's code with this:
Code: Select all
For i = 0 To UBound(rtbArray)
If rtbArray(i) = False Then
CType(TabControl1.TabPages.Item(i).Controls(0), RichTextBox).SaveFile(path)
End If
Next i
ooh lol 
EDIT:
Does Vb2010 have a autosave function like office 2007-2010?
because i was just working on this project and had a lot of work done and it crashed cryer;
and it hasn't seemed to have saved an autorecovery like word.

EDIT:
Does Vb2010 have a autosave function like office 2007-2010?
because i was just working on this project and had a lot of work done and it crashed cryer;
and it hasn't seemed to have saved an autorecovery like word.
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that 

Copyright Information
Copyright © Codenstuff.com 2020 - 2023