Results 1 to 8 of 8

Thread: [RESOLVED] Defining large string name in vb 6

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2010
    Posts
    20

    Resolved [RESOLVED] Defining large string name in vb 6

    Hi,

    Can anyone tell me how to define a long string name in a variable?

    For example my file name is cb.21c.2010092382343476.
    When i am defining as

    Dim s as string
    & then using it for further operation, it fails & a sound from RAM generates. How to define this long file name in s


    Thnkx

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

    Re: Defining large string name in vb 6

    Dim s As String should never produce any error I can think of, unless you are using s for something else.
    You will need to provide more information, including the error and the related code causing that error. You are not giving us enough information to help you out. Spend a few minutes and read the short hitchhikers guide, linked in my signature below. It will help you help us to help you.
    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}

  3. #3
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Defining large string name in vb 6

    Quote Originally Posted by sajib View Post
    & then using it for further operation....
    What is that "further operation"?
    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

    Thread Starter
    Junior Member
    Join Date
    Aug 2010
    Posts
    20

    Re: Defining large string name in vb 6

    LaVolpe, my code is like this,
    Dim s as string

    s = CommonDialog1.FileTitle

    Actually I m trying to get the file title cb.21c.2010092382343476 into s . With this s (filename) I will do some operation, but failed to do it.

    Is there any way that from this large file name [cb.21c.2010092382343476] I can get only cb & put it into string s.

    Thnkx.

  5. #5
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Defining large string name in vb 6

    With this s (filename) I will do some operation, but failed to do it.
    Yes, but are you trying to do... Can you show us the exact code that your are using?
    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

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Defining large string name in vb 6

    Code:
    Private Sub Command1_Click()
    Dim s As String
    s = "cb.21c.2010092382343476"
    s = Left(s, 2)
    MsgBox s
    End Sub

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Defining large string name in vb 6

    CommonDialog1.FileTitle <-- Try FileName ... you're getting just the title... which isn't the same as the filename (if I'm remembering correctly).... What you want is the full filename.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Aug 2010
    Posts
    20

    Re: Defining large string name in vb 6

    @techgnome,

    Filename is different from Filetitle. when we define as Filename it interprets the complete path of the file but Filetitle means only name of the file...

    nyways I got my problem solved by hack's method... thankx buddy.........now its only taking the 1st 2 characters from left..

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