[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
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.
Re: Defining large string name in vb 6
Quote:
Originally Posted by
sajib
& then using it for further operation....
What is that "further operation"?
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.
Re: Defining large string name in vb 6
Quote:
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?
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
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
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..