I have a multi-line richtextbox which I want to filter between a min and max number of characters.
The fields would be:
txtMin
txtMax
rtbMyTextToFilter
txtOutput
cmdFilter
What is the best way to do this?
Thanks,
Jon
Printable View
I have a multi-line richtextbox which I want to filter between a min and max number of characters.
The fields would be:
txtMin
txtMax
rtbMyTextToFilter
txtOutput
cmdFilter
What is the best way to do this?
Thanks,
Jon
Can you be a bit more specific why cmdFilter and txtOutput are for?
Min field is for minimum number of characters.
Max field is for maximum number of characters.
rtbMyTextToFilter is richtextbox with the data in it.
txtOutput will be a richtextbox field which will show the filtered data.
cmdFilter is my command button, which when clicked will trigger the filter.
Have I got my naming convention a bit wrong?
I am trying a simplified version of my previous request but its not working. My code is below:
VB Code:
Dim strFiltered As String Dim strCurrentRow As String Dim strFullData As String strFullData = Text4.Text For i = 1 To 10 strCurrentRow = Split(Text4, vbCrLf) If Len(strCurrentRow) > 5 Or Len(strCurrentRow) < 10 Then strFiltered = strFiltered & strCurrentRow MsgBox strFiltered End If Next i MsgBox i
When I try to read in the richtextbox data (Text4) it doesn't just read in the text but all the rich text format data too. Hence, I think this is causing the problems.
How can I read in just the text and not the rich text data?
Are you looking for something like:?VB Code:
Dim N As Long Dim row As String, rowes() As String, filtered As String rowes = Split(Text4.Text, vbCrLf) For N = 0 To UBound(rowes) If Len(rowes(N)) > 5 And Len(rowes(N)) < 10 Then filtered = filtered & rowes(N) & vbCrLf End If Next N If Len(filtered) Then filtered = Left(filtered, Len(filtered) - 2) MsgBox filtered
That's it! Thanks gavio.
Np! :wave: