Results 1 to 6 of 6

Thread: [2.0] Sockets question

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    [2.0] Sockets question

    Hey guys, before my chat application went on the web, I used this to transfer my bolded, colored, styled font to the message log:

    Code:
                    txtMessages.AppendText(userName);
                    txtMessages.SelectedRtf = txtYourMessage.Rtf;
    However, now, since it needs to go to other users, I need to do this instead

    Code:
                    DisplayText(userName + txtYourMessage.Text + (char)13 + (char)10);
                    SendData("CHAT|" + txtYourMessage.Text);
    However, in that way, it loses it's formatting. Do any of you know a way to still send the message to all connected clients but keep the formatting? Thanks.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2.0] Sockets question

    Are you sending the text or the rtf text?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    Re: [2.0] Sockets question

    Well, I got the formatted text to show up on your screen when you send the message. But the whole sending messages thing works like this. You send the message to all attached clients, and to yourself. They are two different processes. I got the sending it to yourself working by just doing this:


    Code:
                    txtMessages.AppendText(userName);
                    txtMessages.SelectedRtf = txtYourMessage.Rtf;
    That ONLY shows up on your screen. The SendData with "CHAT|" sends it to all attached clients. However, if I send the text, then it loses it's formatting, if I send the string, it, also loses it's formatting. So, I'll send the .Rtf. However, when I do that, it shows up to all attached clients with no formatting, but it has formatting codes.

    The solution to this predicament may be handling the message recieved event and set the selected rtf to their rtf. So, I suppose I would, convert all the rtf codes from the message to the format without codes when the message is recieved. I think I know how to do this. I'll reply with my status in a few.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2.0] Sockets question

    Thats probably because your receiving rtf textbox is being set with the .Text property instead of the .RTF property.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    Re: [2.0] Sockets question

    Yea, I think I know how to solve this. The user sends the message with all the Rtf codes. Then, when the user recieves it, the SelectedRtf property of the messagelog is set to the rtf codes of the message.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2.0] Sockets question

    Yes, sending and receiving the rtf should produce what you want.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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