StrataFrame Forum
Back
Login
Login
Home
»
StrataFrame Application Framework - V1
»
Enhancement Requests
»
SF RichTextbox - Remove RTF metadata when text value is blank or empty...
SF RichTextbox - Remove RTF metadata when text value is blank or empty
Post Reply
Like
1
SF RichTextbox - Remove RTF metadata when text value is blank or empty...
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
Edhy Rijo
E
Edhy Rijo
posted 11 Years Ago
ANSWER
Post Details
Share Post
E
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
Hey Ben,
Thanks, I will add this one to my utility program too.
Edhy Rijo
Reply
Like
1
StrataFrame Team
S
StrataFrame Team
posted 11 Years Ago
ANSWER
Post Details
Share Post
S
Group: StrataFrame Developers
Posts: 3K,
Visits: 2.5K
Yes, Edhy, this is a limitation of basing our RTF on the WinForms RichTextBox. The Rtf property is never empty, you always have to test on the Text. Because of this, we have implemented some utility methods in our other applications like so:
''' <summary>
''' Converts an RTF formatted string into plain text
''' </summary>
Public Shared Function RtfToText(ByVal rtf As String) As String
'-- Establish Locals
Using rtfCtrl As New System.Windows.Forms.RichTextBox()
Dim r As String = ""
'-- Set the text
rtfCtrl.Rtf = rtf
'-- Get the rtf code
r = rtfCtrl.Text
'-- Return the results
Return r
End Using
End Function
This allows us to pass an RTF string and the RichTextBox will convert it to a regular string for us so we can we can view the raw text (and even test if it's empty).
Reply
Like
1
Edhy Rijo
E
Edhy Rijo
posted 11 Years Ago
ANSWER
Topic Details
Share Topic
E
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
Hi all,
When using the SF RichTextbox the control is binded to the Rtf property which is just fine, but if you empty the value in this control, the RTF metadata will be saved with no text and when you need to test if this value is empty, it will fail.
For now what I am doing is testing the RichTextbox1.Text value and saving an empty string if that is the case in the the bo.BeforeSave(), of course if would be nice to have this test be done in this SF RichTextbox class instead.
Private Sub BizCompany1_BeforeSave(ByVal e As MicroFour.StrataFrame.Data.BeforeSaveUndoEventArgs) Handles BizCompany1.BeforeSave
'-- Check if the RTF value is empty, and remove any RTF meta code
If String.IsNullOrWhiteSpace(Me.RichTextbox1.Text) Then
Me.BizCompany1.QuickOrderFooter = String.Empty
End If
End Sub
Edhy Rijo
Reply
Like
1
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Post Reply
Like
1
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search