473,394 Members | 1,797 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,394 software developers and data experts.

strange c# - vb difference

I'm using 1.1/vs.net 2003 ...

C#example..............

string myPath = Server.MapPath(".\\Data\\" + (string)
Session["LogoFileName"]);

Produces this value in myPath

?myPath
@"c:\inetpub\wwwroot\CSharpCustomers\Data\GaryRock s.jpg"

VB example.............

Dim myPath As String = Server.MapPath(".\Data\" + Session("LogoFileName"))

?myPath
"C:\Inetpub\wwwroot\CPCustomers\Data\GaryRocks.jpg "

the vb example works. the c# does not work. I notice that @ preceding the
string in the c# example. Could that be the difference? What am I doing
wrong in the C# example?

thanks,
T
Jun 1 '06 #1
7 1403

"Tina" <ti**********@nospammeexcite.com> wrote in message
news:ej****************@TK2MSFTNGP02.phx.gbl...
I'm using 1.1/vs.net 2003 ...

C#example..............

string myPath = Server.MapPath(".\\Data\\" + (string)
Session["LogoFileName"]);

Produces this value in myPath

?myPath
@"c:\inetpub\wwwroot\CSharpCustomers\Data\GaryRock s.jpg"

VB example.............

Dim myPath As String = Server.MapPath(".\Data\" + Session("LogoFileName"))

?myPath
"C:\Inetpub\wwwroot\CPCustomers\Data\GaryRocks.jpg "

the vb example works. the c# does not work. I notice that @ preceding
the string in the c# example. Could that be the difference? What am I
doing wrong in the C# example?


The only difference I see here is CSharpCustomers vs. CPCustomers, which I
hope is a typing error on your part, or else it makes no sense at all.

In C#, the @ means that backslashes in the string are not to be given
special interpretation.

So @"\" and "\\" in C# are both the same as "\" in Basic.
Jun 1 '06 #2
The backward slash (\) character can be used in a format string to turn off
the special meaning of
the character that follows it. For example, "\{" will cause a literal "{" to
be displayed, and "\\" will
display a literal "\". The at sign (@) character can be used to represent an
entire string verbatim. For
example, @"\\server\share" will be processed as \\server\share.

chanmm
"Tina" <ti**********@nospammeexcite.com> wrote in message
news:ej****************@TK2MSFTNGP02.phx.gbl...
I'm using 1.1/vs.net 2003 ...

C#example..............

string myPath = Server.MapPath(".\\Data\\" + (string)
Session["LogoFileName"]);

Produces this value in myPath

?myPath
@"c:\inetpub\wwwroot\CSharpCustomers\Data\GaryRock s.jpg"

VB example.............

Dim myPath As String = Server.MapPath(".\Data\" + Session("LogoFileName"))

?myPath
"C:\Inetpub\wwwroot\CPCustomers\Data\GaryRocks.jpg "

the vb example works. the c# does not work. I notice that @ preceding
the string in the c# example. Could that be the difference? What am I
doing wrong in the C# example?

thanks,
T

Jun 1 '06 #3
Yes, I know that. That's why I put the extra back slashes in the c#
version. Have you any idea why the C# version canot find the jpg?
T

"chanmm" <ch*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
The backward slash (\) character can be used in a format string to turn
off the special meaning of
the character that follows it. For example, "\{" will cause a literal "{"
to be displayed, and "\\" will
display a literal "\". The at sign (@) character can be used to represent
an entire string verbatim. For
example, @"\\server\share" will be processed as \\server\share.

chanmm
"Tina" <ti**********@nospammeexcite.com> wrote in message
news:ej****************@TK2MSFTNGP02.phx.gbl...
I'm using 1.1/vs.net 2003 ...

C#example..............

string myPath = Server.MapPath(".\\Data\\" + (string)
Session["LogoFileName"]);

Produces this value in myPath

?myPath
@"c:\inetpub\wwwroot\CSharpCustomers\Data\GaryRock s.jpg"

VB example.............

Dim myPath As String = Server.MapPath(".\Data\" +
Session("LogoFileName"))

?myPath
"C:\Inetpub\wwwroot\CPCustomers\Data\GaryRocks.jpg "

the vb example works. the c# does not work. I notice that @ preceding
the string in the c# example. Could that be the difference? What am I
doing wrong in the C# example?

thanks,
T


Jun 1 '06 #4
I'm coverting a vb project to a c# project so those are the names of the two
projects.

Thanks for telling me what the @ means. Your explanation tells me the two
strings are identical (albiet the diff in project names). My mystery
remains as to why the c# version cannot find the jpg.
T
"Michael A. Covington" <lo**@ai.uga.edu.for.address> wrote in message
news:e5**************@TK2MSFTNGP05.phx.gbl...

"Tina" <ti**********@nospammeexcite.com> wrote in message
news:ej****************@TK2MSFTNGP02.phx.gbl...
I'm using 1.1/vs.net 2003 ...

C#example..............

string myPath = Server.MapPath(".\\Data\\" + (string)
Session["LogoFileName"]);

Produces this value in myPath

?myPath
@"c:\inetpub\wwwroot\CSharpCustomers\Data\GaryRock s.jpg"

VB example.............

Dim myPath As String = Server.MapPath(".\Data\" +
Session("LogoFileName"))

?myPath
"C:\Inetpub\wwwroot\CPCustomers\Data\GaryRocks.jpg "

the vb example works. the c# does not work. I notice that @ preceding
the string in the c# example. Could that be the difference? What am I
doing wrong in the C# example?


The only difference I see here is CSharpCustomers vs. CPCustomers, which I
hope is a typing error on your part, or else it makes no sense at all.

In C#, the @ means that backslashes in the string are not to be given
special interpretation.

So @"\" and "\\" in C# are both the same as "\" in Basic.

Jun 1 '06 #5
I have no idea why it cannot find the jpg. You are sure the jpg is in
BOTH folders?

Tina wrote:
Yes, I know that. That's why I put the extra back slashes in the c#
version. Have you any idea why the C# version canot find the jpg?
T


Jun 1 '06 #6
At the risk of pointing the obvious (which might not help anyway)...is your
VB project located in the same folder as your C# folder? The path returned by
MapPath will return the path under which it is run and the image must be
located in the data folder under that.

"Tina" wrote:
Yes, I know that. That's why I put the extra back slashes in the c#
version. Have you any idea why the C# version canot find the jpg?
T

"chanmm" <ch*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
The backward slash (\) character can be used in a format string to turn
off the special meaning of
the character that follows it. For example, "\{" will cause a literal "{"
to be displayed, and "\\" will
display a literal "\". The at sign (@) character can be used to represent
an entire string verbatim. For
example, @"\\server\share" will be processed as \\server\share.

chanmm
"Tina" <ti**********@nospammeexcite.com> wrote in message
news:ej****************@TK2MSFTNGP02.phx.gbl...
I'm using 1.1/vs.net 2003 ...

C#example..............

string myPath = Server.MapPath(".\\Data\\" + (string)
Session["LogoFileName"]);

Produces this value in myPath

?myPath
@"c:\inetpub\wwwroot\CSharpCustomers\Data\GaryRock s.jpg"

VB example.............

Dim myPath As String = Server.MapPath(".\Data\" +
Session("LogoFileName"))

?myPath
"C:\Inetpub\wwwroot\CPCustomers\Data\GaryRocks.jpg "

the vb example works. the c# does not work. I notice that @ preceding
the string in the c# example. Could that be the difference? What am I
doing wrong in the C# example?

thanks,
T



Jun 1 '06 #7
no. I found the problem to be something else and reposted "A strange c# -
vb difference"
sorry
T
"Mike Collins" <Mi*********@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
At the risk of pointing the obvious (which might not help anyway)...is
your
VB project located in the same folder as your C# folder? The path returned
by
MapPath will return the path under which it is run and the image must be
located in the data folder under that.

"Tina" wrote:
Yes, I know that. That's why I put the extra back slashes in the c#
version. Have you any idea why the C# version canot find the jpg?
T

"chanmm" <ch*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
> The backward slash (\) character can be used in a format string to turn
> off the special meaning of
> the character that follows it. For example, "\{" will cause a literal
> "{"
> to be displayed, and "\\" will
> display a literal "\". The at sign (@) character can be used to
> represent
> an entire string verbatim. For
> example, @"\\server\share" will be processed as \\server\share.
>
> chanmm
>
>
> "Tina" <ti**********@nospammeexcite.com> wrote in message
> news:ej****************@TK2MSFTNGP02.phx.gbl...
>> I'm using 1.1/vs.net 2003 ...
>>
>> C#example..............
>>
>> string myPath = Server.MapPath(".\\Data\\" + (string)
>> Session["LogoFileName"]);
>>
>> Produces this value in myPath
>>
>> ?myPath
>> @"c:\inetpub\wwwroot\CSharpCustomers\Data\GaryRock s.jpg"
>>
>>
>>
>> VB example.............
>>
>> Dim myPath As String = Server.MapPath(".\Data\" +
>> Session("LogoFileName"))
>>
>> ?myPath
>> "C:\Inetpub\wwwroot\CPCustomers\Data\GaryRocks.jpg "
>>
>> the vb example works. the c# does not work. I notice that @
>> preceding
>> the string in the c# example. Could that be the difference? What am
>> I
>> doing wrong in the C# example?
>>
>> thanks,
>> T
>>
>>
>
>


Jun 1 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: cournape | last post by:
Hi there, I have some scientific application written in python. There is a good deal of list processing, but also some "simple" computation such as basic linear algebra involved. I would like to...
3
by: Bill C. | last post by:
Hi, I've got a simple console app that just reads an XML file into a DataSet then prints out a description of each table in the DataSet, including column names and row values for each column. ...
25
by: Neil Ginsberg | last post by:
I have a strange situation with my Access 2000 database. I have code in the database which has worked fine for years, and now all of a sudden doesn't work fine on one or two of my client's...
31
by: Bjørn Augestad | last post by:
Below is a program which converts a double to an integer in two different ways, giving me two different values for the int. The basic expression is 1.0 / (1.0 * 365.0) which should be 365, but one...
5
by: cody | last post by:
I have a very funny/strange effect here. if I let the delegate do "return prop.GetGetMethod().Invoke(info.AudioHeader, null);" then I get wrong results, that is, a wrong method is called and I...
1
by: Kepler | last post by:
I'm fighting a really strange bug that involves both a DataGrid and a Repeater disappearing on postback. The strange thing is that I've distilled the problem down to a simple program, that...
1
by: Martin Feuersteiner | last post by:
Dear Group I'm having a very weird problem. Any hints are greatly appreciated. I'm returning two values from a MS SQL Server 2000 stored procedure to my Webapplication and store them in...
3
by: skOOb | last post by:
I am having an issue right now of displaying the 'Age' of an item, but only on 1 computer. I can take my app and install it on multiple win98, winNT, and other winXP machines and have no problem. ...
4
by: kj | last post by:
I'm running into a strange seg fault with the module cjson. The strange part is that it does not occur when I run the code under Emacs' Pydb. Here's an example: import sys, cjson d1 =...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.