Results 1 to 10 of 10

Thread: [RESOLVED] Placeing Quotations inside Quotations

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    24

    Resolved [RESOLVED] Placeing Quotations inside Quotations

    Is it possible to place quotations in a sentence thats in quotations

    For example:
    Code:
    TextBox2.Text = "My name is "Sunshine" today"
    What is the proper way to place quotations inside quotations

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

    Re: Placeing Quotations inside Quotations

    Code:
    TextBox2.Text = "My name is ""Sunshine"" today"
    There are a few methods to do this like using hte Chr(34) instead of the actual double quote character or whatever but they are all just preferences as not much difference in resource useage.

    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
    Junior Member
    Join Date
    Mar 2007
    Posts
    24

    Re: Placeing Quotations inside Quotations

    Hey Rob can you give me a Code example

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

    Re: Placeing Quotations inside Quotations

    Another would be...
    Code:
    TextBox2.Text = "My name is " & Chr(34) & "Sunshine" & Chr(34) & " today"
    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
    Junior Member
    Join Date
    Mar 2007
    Posts
    24

    Re: Placeing Quotations inside Quotations

    Okay that worked but

    Is there a way i can just place one "

    Because for that code it requires me to use both on "Sunshine" and i just need to have one.

    Example:
    Code:
    "My name is " & Chr(34) & "Sunshine & Chr(34) & " today"
    But if i don't close the name sunshine it will keep quoting until the next ".

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

    Re: Placeing Quotations inside Quotations

    Your missing a double quote after sunshine.
    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

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    24

    Re: Placeing Quotations inside Quotations

    Quote Originally Posted by RobDog888
    Your missing a double quote after sunshine.
    Thats how i need it to be because after "Sunshine" there will be a number added to it. from another textbox in the same quotation.

    Example:
    Code:
    TextBox2.Text = "My name is " & Chr(34) & "Sunshine" & Chr(34)  & Textbox1.Text & Chr(34) & " & Chr(34)
    Resulting in this:

    My name is "Sunshine27" today



    Basically my question would be: Can i have a single " in a & Chr(34) & Like this:

    Code:
    & Chr(34)  "  Chr(34) &
    Last edited by helio2; Aug 12th, 2007 at 02:46 PM.

  8. #8
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Placeing Quotations inside Quotations

    When in a string, either " & Chr(34) & " or "" produce a single quotation character (Chr(34) returns a string containing just a single quotation character, and "" is a built-in 'trick' to allow you to use the character within a string).

    To have two quotation characters in your string, you can use either " & Chr(34) & Chr(34) & " or """"

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

    Re: Placeing Quotations inside Quotations

    Just place a variable to contain the number you want to concatenate with Sunshine.

    Code:
    TextBox2.Text = "My name is " & Chr(34) & "Sunshine" & SomeVar & Chr(34)  & Textbox1.Text & Chr(34) & " & Chr(34)
    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

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    24

    Re: Placeing Quotations inside Quotations

    Awesome! Thanks again RobDog888 and si_the_geek !!
    This worked

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