473,387 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Strings won't concat?

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
4 1224
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Joe | last post by:
I've got 3 columns in a mysql database that I am trying to join. I'm using CONCAT(), but it's giving me NULL results. This has worked for me before ... What am I doing wrong? Here's a straight...
20
by: Trevor | last post by:
I have a couple of questions regarding C# strings. 1) Sometimes I see a string in someone else's code like: string foo = @"bar"; What does the '@' do for you? 2) Is there a performance...
10
by: Nick Z. | last post by:
I do some logging like so: Log.Error("The song was not found. Artist - " + artist + ", Title - " + title + "\n" + exception.ToString()); Now I know that building strings in that way is...
16
by: Boni | last post by:
Dear all, Is there any perfomance difference in string concatination using "+" vs "&"? I think, that compiler produces the same code for both. Am I right? Thank you, Boni
89
by: scroopy | last post by:
Hi, I've always used std::string but I'm having to use a 3rd party library that returns const char*s. Given: char* pString1 = "Blah "; const char* pString2 = "Blah Blah"; How do I append...
3
by: mathewda | last post by:
I'm currently work'n on a project where I'm dynamically generating some HTML as text into a string builder. My ASP page has a <span> tag on it and after I gernerate HTML to my string builder I...
2
by: Kamjah Kogumah | last post by:
A Dev Opera article suggest using code 2 instead of code 1 in performance-critical functions. code 1: a += 'x' + 'y'; code 2: a += 'x'; a += 'y';
5
by: Diego Martins | last post by:
Since C++ (and STL) have many ways to do string concatenation, I want to hear (read) from you how you do to concatenate strings with other strings and other types. The approaches I know are: --...
26
by: machineghost | last post by:
First off, let me just say that as someone with no DBA training whatsoever, any help I can get with this issue will be very, very much appreciated. My company recently migrated our database from...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.