By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,642 Members | 1,098 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,642 IT Pros & Developers. It's quick & easy.

Strings won't concat?

P: n/a
KSC
In the following function, after adding the filename to the path, the
filename is not there. Even if I try to add the filename in the calling sub
or function, the filename is not there.

While debugging, I notice that the tooltip that shows the value for "out"
does not have a trailing quotation mark. I don't know why and I can't figure
out how to successfully concat the path and the filename!!

Can anyone help???

Thanks in advance!

Public Declare Function WNetGetConnection Lib "mpr.dll" Alias _
"WNetGetConnectionA" (ByVal lpszLocalName As String, _
ByVal lpszRemoteName As String, ByRef cbRemoteName As Integer)
As Integer

Private Function GetUNCPathFromMappedDriveLetter(ByVal MappedLetter As
String, ByVal Filename As String) As String
Try
'MappedLetter arg must be of form "C:"

'get the UNC path and return it
Dim ret As Integer
Dim out As String = New String(" "c, 260)
Dim len As Integer = 260

ret = WNetGetConnection(MappedLetter, out, len)

out = out.TrimEnd(" "c)

Return out & Filename '<--------------Filename is not returned!!??
'Return String.Concat(out,filename) 'also does not work
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Function
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies

P: n/a
KSC.

It can be that Out has a 00 character in it. Everything behind that is not
showed.

Just an idea

Cor
Nov 21 '05 #2

P: n/a
KSC
That was it Cor. Thank you.

Changed line "out = out.TrimEnd(" "c)"

to

"out = out.TrimEnd(" "c).TrimEnd(Chr(0))"

"Cor Ligthert [MVP]" wrote:
KSC.

It can be that Out has a 00 character in it. Everything behind that is not
showed.

Just an idea

Cor

Nov 21 '05 #3

P: n/a
KSC,
I would recommend:

out = out.TrimEnd(" "c, Chr(0))

Hope this helps
Jay

"KSC" <KS*@discussions.microsoft.com> wrote in message
news:D9**********************************@microsof t.com...
| That was it Cor. Thank you.
|
| Changed line "out = out.TrimEnd(" "c)"
|
| to
|
| "out = out.TrimEnd(" "c).TrimEnd(Chr(0))"
|
|
|
| "Cor Ligthert [MVP]" wrote:
|
| > KSC.
| >
| > It can be that Out has a 00 character in it. Everything behind that is
not
| > showed.
| >
| > Just an idea
| >
| > Cor
| >
| >
| >
Nov 21 '05 #4

P: n/a
KSC
Gotcha

"Jay B. Harlow [MVP - Outlook]" wrote:
KSC,
I would recommend:

out = out.TrimEnd(" "c, Chr(0))

Hope this helps
Jay

"KSC" <KS*@discussions.microsoft.com> wrote in message
news:D9**********************************@microsof t.com...
| That was it Cor. Thank you.
|
| Changed line "out = out.TrimEnd(" "c)"
|
| to
|
| "out = out.TrimEnd(" "c).TrimEnd(Chr(0))"
|
|
|
| "Cor Ligthert [MVP]" wrote:
|
| > KSC.
| >
| > It can be that Out has a 00 character in it. Everything behind that is
not
| > showed.
| >
| > Just an idea
| >
| > Cor
| >
| >
| >

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.