Results 1 to 25 of 25

Thread: [PARTIALLY RESOLVED] RichTextBox

  1. #1

    Thread Starter
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Resolved [PARTIALLY RESOLVED] RichTextBox

    Hi

    I am sure there must be a very simple solution for this but guess what? I am stuck... I have tried to explain my problems in detail but if you still have a query, do ask.

    Lets say a RTB has the following text...

    johny went for a walk
    Today is monday
    Yesterday was sunday
    day after tomorrow will be Wednesday
    1) How do I loop through every line in the RTB and display the text in a messagebox? For example, it should first display "johny went for a walk" and then "Today is monday" and so on till the end of RTB is reached.

    2) How do I put a "#" sign before every sentence so that I get something like the below at a click of a button. If this is not possible which I doubt, an alternative for this would be what I have in mind (see Question 4)

    #johny went for a walk
    #Today is monday
    #Yesterday was sunday
    #day after tomorrow will be Wednesday
    3) How do I disable pasting of Ole objects in RTB? If a user copies text+image and presses Ctrl + V in the RTB, only the text should be copied. I know how to do it for simple text but I want to block Ole objects... In short I want selective "Paste" to happen

    and lastly,

    4) RichTextBox1.SelBullet = True will enable the bullet in RTB. Is there any way that I can change the type of bullet from the "Dot" to say a "#"?

    Sidz
    Last edited by Siddharth Rout; Feb 10th, 2009 at 02:50 AM.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: RichTextBox

    For 1 & 2 can't you simply use Split for the text of the RTB?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3

    Thread Starter
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: RichTextBox

    split with vbrclf? how would you insert the "#" sign after using split?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  4. #4
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: RichTextBox

    A quick test, does this work for you?

    Code:
    Private Sub Command1_Click()
        Dim s As String
        s = "johny went for a walk" & vbNewLine & _
            "Today is monday" & vbNewLine & _
            "Yesterday was sunday" & vbNewLine & _
            "day after tomorrow will be Wednesday"
        
        RichTextBox1 = s
        MsgBox "stop!"
            
        Dim data() As String
        Dim y As Long
        data = Split(s, vbNewLine)
        For y = LBound(data) To UBound(data)
            data(y) = "#" & data(y)
        Next
        s = Join(data, vbNewLine)
        
        RichTextBox1 = s
    End Sub
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  5. #5
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: RichTextBox

    This also works.

    Code:
    s = "#" & Replace$(s, vbNewLine, vbNewLine & "#")
        RichTextBox1 = s
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  6. #6

    Thread Starter
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: RichTextBox

    Yeah I understood the method by split. Do we have something in RTB like

    RTB.lineno.text <- I know this doesn't exist but I was thinking of something like looping thru every line and displaying the text?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  7. #7
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: RichTextBox

    No, but you could enumerate the result of split, is there something that I am missing?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  8. #8
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: RichTextBox

    Upon investigating, I think you could also use EM_GETLINE to read a specific line, have a search for it. When I have more time I will try to make a sample code.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  9. #9

    Thread Starter
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: RichTextBox

    Quote Originally Posted by dee-u
    No, but you could enumerate the result of split, is there something that I am missing?
    No you are not missing anything... Well let me try it and come back on this... Probably on monday now... I guess. I will keep this post updated....

    Regarding replace, I was again thinking of looping thru every line, extract text, add "#" at the begining and then put it back, instead of spliting the text in the RTB.... something like this can be done?

    BTW thanks for staying with this thread...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  10. #10

    Thread Starter
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: RichTextBox

    After struggling with "sendmessage" since the last time I posted, I got the answer to the 1st and the 2nd question....

    Now all I am looking for is the 3rd and the 4th question.

    Code:
    Private Declare Function SendMessage Lib "user32" _
    Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
    ByVal wParam As Long, lParam As Any) As Long
        
    Private Const EM_GETLINECOUNT = &HBA
    Private Const EM_GETSEL = &HB0
    Private Const EM_LINEINDEX = &HBB
    Private Const EM_LINELENGTH = &HC1
    Private Const EM_LINEFROMCHAR = &HC9
    Private Const EM_GETLINE = &HC4
    
    Dim RTBLineCount As Long, Charindex As Long
    Dim FirstChar As Long, RowLength As Long, CursorPos As Long, nLine As Long
    Dim Buffer() As Byte, LineText As String, goptions
    
    Private Sub Command1_Click()
        '-- Get the Linecount of RTB
        RTBLineCount = SendMessage(Rich3.hwnd, EM_GETLINECOUNT, 0, 0)
    
        '-- loop tru the RTB
        For i = 0 To RTBLineCount - 1
            Charindex = SendMessage(Rich3.hwnd, EM_LINEINDEX, ByVal i, ByVal CLng(0))
        
            '-- Move to the respective line
            Rich3.SelStart = Charindex
        
            CursorPos = SendMessage(Rich3.hwnd, EM_GETSEL, 0, ByVal 0&) \ 65536
            nLine = SendMessage(Rich3.hwnd, EM_LINEFROMCHAR, CursorPos, ByVal 0&)
            FirstChar = SendMessage(Rich3.hwnd, EM_LINEINDEX, nLine, ByVal 0&)
            RowLength = SendMessage(Rich3.hwnd, EM_LINELENGTH, FirstChar, ByVal 0&)
            ReDim Buffer(RowLength + 1)
            Buffer(0) = RowLength + 1
    
            SendMessage Rich3.hwnd, EM_GETLINE, nLine, Buffer(0)
            LineText = Left$(StrConv(Buffer, vbUnicode), RowLength)
            
            '-- ANSWERS MY FIRST QUESTION <=================================
            MsgBox LineText
            
            '-- THE BELOW ANSWERS MY SECOND QUESTION <======================
            If Left(Trim(LineText), 1) <> "#" Then
                '-- Set the options
                goptions = rtfWholeWord + rtfMatchCase
                '-- Loop Thru RTB
                Do
                    '-- Search for the line text
                    If Rich3.Find(LineText, Rich3.SelStart + Rich3.SelLength, , goptions) = -1 Then
                        Exit Do
                    Else
                        '-- Replace the selected text with the replace text
                        Rich3.SelText = "#" & LineText
                    End If
                Loop
            End If
        Next i
    End Sub
    edit: changing the tags. so it is easier to copy
    Last edited by Siddharth Rout; Feb 15th, 2009 at 12:23 PM.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  11. #11

    Thread Starter
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: RichTextBox

    I searched the web for the last 2 days but couldn't find an answer for Q3 and Q4...

    So is that it? It is not possible?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  12. #12
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: RichTextBox

    Perhaps it is not possible. That could probably the intrinsic behaviour or the RichTextBox control.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  13. #13

    Thread Starter
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: RichTextBox

    Perhaps it is not possible.
    :Fuming:

    I don't like that phrase but then guess i will have to live with it for the time being...

    Dee-U thanks for all the help till now
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  14. #14
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: [PARTIALLY RESOLVED] RichTextBox

    No problem. =)
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  15. #15
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: [PARTIALLY RESOLVED] RichTextBox

    i am sure you can monitor the clipboard data to enable or disable pasting to the richtextbox

    try like this for control V, only allows pasting of text, but you would need to have code for other pasting method, tested with text and image, text pasted, but no image
    vb Code:
    1. Private Sub Rtb_KeyDown(KeyCode As Integer, Shift As Integer)
    2. If KeyCode = vbKeyV And Not Clipboard.GetFormat(vbCFText) Then KeyCode = 0
    3. End Sub
    you would also need to check the shift property, for it to work properly for normal typing
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  16. #16

    Thread Starter
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: [PARTIALLY RESOLVED] RichTextBox

    ok pete, I'll give it a try
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  17. #17
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [PARTIALLY RESOLVED] RichTextBox

    Following up on westconn1's idea. The following appears to work well. I rem'd out the RTF format because it can contain embedded objects, which also means you lose RTF formatting.
    Code:
    Private Sub RichTextBox1_KeyDown(KeyCode As Integer, Shift As Integer)
        If KeyCode = vbKeyV Then
            If (Shift And vbCtrlMask) Then
    '            If Clipboard.GetFormat(vbCFRTF) Then
    '                RichTextBox1.SelText = Clipboard.GetText(vbCFRTF)
                If Clipboard.GetFormat(vbCFText) Then
                    RichTextBox1.SelText = Clipboard.GetText(vbCFText)
                End If
                KeyCode = 0&
            End If
        End If
    End Sub
    As a side note. If RTF formatting is desired but embedded objects/images, etc are not then maybe pasting the info to a hidden RTF control, processing the lines from that and copying those lines only to the main control? Just an idea.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  18. #18
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: [PARTIALLY RESOLVED] RichTextBox

    still need to trap for pasting from context or other menu, also drag drop
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  19. #19
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [PARTIALLY RESOLVED] RichTextBox

    Quote Originally Posted by westconn1
    still need to trap for pasting from context or other menu, also drag drop
    Probably trap for drag/drop, but the rtb doesn't have a context menu. Not for me, thought that was strange. Any one have a context menu for their RTB, SP6?
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  20. #20
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: [PARTIALLY RESOLVED] RichTextBox

    it's a property setting. Enablecontextmenu or some such. Gives you cut and paste commands.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  21. #21
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: [PARTIALLY RESOLVED] RichTextBox

    For your #4 question I use something similar where a floating forms insert symbols into the rtb. For th pound sign(#)
    rtb.SelText = Space(3) & Chr$(35)
    Its not a bullet ,but could be used as such
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  22. #22

    Thread Starter
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: [PARTIALLY RESOLVED] RichTextBox

    @ Keith: I am speechless I had almost lost hope on this one. I copied the picture and text as shown in the picture and pasted it in the RTB. It works as I wanted it. It still needs a slight modification which I will be able to take care of. If you see the picture, it creates a gap where the picture was.

    @ Keith/Pete/Lord Orwell: I am not too much worried about blocking the Menu because the user in my application will not have access to that.

    @ isnoend07: No this is not what I want. I'll explain where it is coming from... In the Code generator addin which I created (See the link in my signature), the RTB's are coded in such a way that your codes get automatically formatted as they would in VB6 Editor. So In the Description RTB I wanted to use ' as a bullet so that every line could be commented. I achieved what I wanted but with a different technique... Thanks to Keith, he pointed out that you could change the bullets to only 6 different styles by pressing Ctrl+Shift+L (The single quote is not one of them, wish it was... it would have saved me some coding )

    So now only the last question i.e. Qno 4, remains unsolved….

    Edit: Keith, seems like I recently rated you... It is not allowing me to do it again. Let me spread some reputation and then I will come back to this thread... It is a promise Thanks once again for your help
    Attached Images Attached Images  
    Last edited by Siddharth Rout; Feb 16th, 2009 at 01:21 AM.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  23. #23
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: [PARTIALLY RESOLVED] RichTextBox

    you should be able to replace any bullet character within the textrtf with some other character, but i am not sure what other repercussions there maybe to doing that

    can you change the bullets in a richtext document in word or wordpad, the richtextbox only supports a limited range of the richtext specification, but other features can be directly inserted into the richtext string, the problem with this is the richtextbox does not know how to display anything extra
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  24. #24

    Thread Starter
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: [PARTIALLY RESOLVED] RichTextBox

    Hi Pete, can you give me an example.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  25. #25
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: [PARTIALLY RESOLVED] RichTextBox

    i never tried for bullets, but i was able to do to insert decimal tabs, before shell printing with wordpad,
    open the file for input, replace the rtf tags with the desired ones, then save the file again

    all wrong works fine, see image
    Code:
    {\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f2\fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}
    {\f3\froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f14\fnil\fcharset2\fprq2{\*\panose 05000000000000000000}Wingdings;}{\f28\froman\fcharset238\fprq2 Times New Roman CE;}{\f29\froman\fcharset204\fprq2 Times New Roman Cyr;}
    {\f31\froman\fcharset161\fprq2 Times New Roman Greek;}{\f32\froman\fcharset162\fprq2 Times New Roman Tur;}{\f33\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f34\froman\fcharset178\fprq2 Times New Roman (Arabic);}
    {\f35\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f44\fmodern\fcharset238\fprq1 Courier New CE;}{\f45\fmodern\fcharset204\fprq1 Courier New Cyr;}{\f47\fmodern\fcharset161\fprq1 Courier New Greek;}{\f48\fmodern\fcharset162\fprq1 Courier New Tur;}
    {\f49\fmodern\fcharset177\fprq1 Courier New (Hebrew);}{\f50\fmodern\fcharset178\fprq1 Courier New (Arabic);}{\f51\fmodern\fcharset186\fprq1 Courier New Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;
    \red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;
    \red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang3081\langfe1033\cgrid\langnp3081\langfenp1033 \snext0 Normal;}{\*\cs10 \additive Default Paragraph Font;}}
    {\*\listtable{\list\listtemplateid67698703\listsimple{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;}\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1 
    \fi-360\li720\jclisttab\tx720 }{\listname ;}\listid1126236972}{\list\listtemplateid841522974\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace1080\levelindent0{\leveltext\leveltemplateid1759122602
    \'01\u-3913 ?;}{\levelnumbers;}\f3\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li1440\jclisttab\tx1440 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace1080\levelindent0{\leveltext
    \leveltemplateid67698691\'01o;}{\levelnumbers;}\f2\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li1440\jclisttab\tx1440 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace1080\levelindent0
    {\leveltext\leveltemplateid67698693\'01\u-3929 ?;}{\levelnumbers;}\f14\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li2160\jclisttab\tx2160 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1
    \levelspace1080\levelindent0{\leveltext\leveltemplateid67698689\'01\u-3913 ?;}{\levelnumbers;}\f3\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li2880\jclisttab\tx2880 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0
    \levelfollow0\levelstartat1\levelspace1080\levelindent0{\leveltext\leveltemplateid67698691\'01o;}{\levelnumbers;}\f2\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li3600\jclisttab\tx3600 }{\listlevel\levelnfc23\levelnfcn23\leveljc0
    \leveljcn0\levelfollow0\levelstartat1\levelspace1080\levelindent0{\leveltext\leveltemplateid67698693\'01\u-3929 ?;}{\levelnumbers;}\f14\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li4320\jclisttab\tx4320 }{\listlevel\levelnfc23
    \levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace1080\levelindent0{\leveltext\leveltemplateid67698689\'01\u-3913 ?;}{\levelnumbers;}\f3\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li5040\jclisttab\tx5040 }
    {\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace1080\levelindent0{\leveltext\leveltemplateid67698691\'01o;}{\levelnumbers;}\f2\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li5760
    \jclisttab\tx5760 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace1080\levelindent0{\leveltext\leveltemplateid67698693\'01\u-3929 ?;}{\levelnumbers;}\f14\chbrdr\brdrnone\brdrcf1 
    \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li6480\jclisttab\tx6480 }{\listname ;}\listid1178622011}{\list\listtemplateid841522974\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace1080\levelindent0
    {\leveltext\leveltemplateid67698695\'01\u-3983 ?;}{\levelnumbers;}\f14\fs16\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li1440\jclisttab\tx1440 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1
    \levelspace1080\levelindent0{\leveltext\leveltemplateid67698691\'01o;}{\levelnumbers;}\f2\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li1440\jclisttab\tx1440 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0
    \levelstartat1\levelspace1080\levelindent0{\leveltext\leveltemplateid67698693\'01\u-3929 ?;}{\levelnumbers;}\f14\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li2160\jclisttab\tx2160 }{\listlevel\levelnfc23\levelnfcn23\leveljc0
    \leveljcn0\levelfollow0\levelstartat1\levelspace1080\levelindent0{\leveltext\leveltemplateid67698689\'01\u-3913 ?;}{\levelnumbers;}\f3\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li2880\jclisttab\tx2880 }{\listlevel\levelnfc23
    \levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace1080\levelindent0{\leveltext\leveltemplateid67698691\'01o;}{\levelnumbers;}\f2\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li3600\jclisttab\tx3600 }{\listlevel
    \levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace1080\levelindent0{\leveltext\leveltemplateid67698693\'01\u-3929 ?;}{\levelnumbers;}\f14\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li4320
    \jclisttab\tx4320 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace1080\levelindent0{\leveltext\leveltemplateid67698689\'01\u-3913 ?;}{\levelnumbers;}\f3\chbrdr\brdrnone\brdrcf1 
    \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li5040\jclisttab\tx5040 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace1080\levelindent0{\leveltext\leveltemplateid67698691\'01o;}{\levelnumbers;}\f2\chbrdr
    \brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li5760\jclisttab\tx5760 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace1080\levelindent0{\leveltext\leveltemplateid67698693
    \'01\u-3929 ?;}{\levelnumbers;}\f14\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li6480\jclisttab\tx6480 }{\listname ;}\listid1482885489}}{\*\listoverridetable{\listoverride\listid1126236972\listoverridecount0\ls1}
    {\listoverride\listid1178622011\listoverridecount0\ls2}{\listoverride\listid1482885489\listoverridecount0\ls3}}{\info{\title q}{\author peter hall}{\operator peter hall}{\creatim\yr2009\mo2\dy16\hr21\min54}{\revtim\yr2009\mo2\dy16\hr21\min55}{\version1}
    {\edmins1}{\nofpages1}{\nofwords0}{\nofchars0}{\*\company  }{\nofcharsws0}{\vern8247}}\paperw11906\paperh16838 \widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180
    \dghorigin1800\dgvorigin1440\dghshow1\dgvshow1\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule \fet0\sectd 
    \linex0\headery708\footery708\colsx708\endnhere\sectlinegrid360\sectdefaultcl {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang
    {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7
    \pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\listtext\pard\plain
    \f14\fs16\lang3081\langfe1033\langnp3081 \loch\af14\dbch\af0\hich\f14 \'71\tab}\pard\plain \ql \fi-360\li1440\ri0\widctlpar\jclisttab\tx1440\aspalpha\aspnum\faauto\ls3\adjustright\rin0\lin1440\itap0 \fs24\lang3081\langfe1033\cgrid\langnp3081\langfenp1033 
    {Gg
    \par {\listtext\pard\plain\f14\fs16\lang3081\langfe1033\langnp3081 \loch\af14\dbch\af0\hich\f14 \'71\tab}Gg
    \par {\listtext\pard\plain\f14\fs16\lang3081\langfe1033\langnp3081 \loch\af14\dbch\af0\hich\f14 \'71\tab}Ggyyh
    \par {\listtext\pard\plain\f14\fs16\lang3081\langfe1033\langnp3081 \loch\af14\dbch\af0\hich\f14 \'71\tab}Qwerty
    \par {\listtext\pard\plain\f14\fs16\lang3081\langfe1033\langnp3081 \loch\af14\dbch\af0\hich\f14 \'71\tab}Tony
    \par }\pard \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {
    \par 
    \par }}
    looks like a lot of text for 4 lines of garbage, most of which you don't need

    i would create 2 rtf in word, just with different bullets then should be able to find what part represents the bullet character, my guess is it will be in the last 20 lines

    i saved a rtf in word with different bullets, then opened in a richtextbox, open in notepad to see as above
    Attached Images Attached Images  
    Last edited by westconn1; Feb 16th, 2009 at 06:13 AM.
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width