473,509 Members | 3,009 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

vb equivalent in cs

hey all,
the following snippet works in vb but i'm missing the syntax in csharp:

String val1 = values.Split(",")(1);

i'm getting this error:

Argument '1': cannot convert from 'string' to 'char[]'

thanks,
rodchar
Feb 14 '07 #1
6 2905
"rodchar" <ro*****@discussions.microsoft.comwrote in message
news:4D**********************************@microsof t.com...
String val1 = values.Split(",")(1);
string val1 = values.Split(',')[1];
Feb 14 '07 #2
don't c# array subscripts start at zero rather than one in VB?

so, the equivalant would be:

string val1 = values.Split(',')[0];

Jack

Mark Rae wrote:
"rodchar" <ro*****@discussions.microsoft.comwrote in message
news:4D**********************************@microsof t.com...
>String val1 = values.Split(",")(1);
string val1 = values.Split(',')[1];

Feb 14 '07 #3
thanks everyone for the great feedback, this has helped. rodchar.

"rodchar" wrote:
hey all,
the following snippet works in vb but i'm missing the syntax in csharp:

String val1 = values.Split(",")(1);

i'm getting this error:

Argument '1': cannot convert from 'string' to 'char[]'

thanks,
rodchar
Feb 14 '07 #4
In both VB and C#, arrays start at 0. The only difference is that in VB you
declare an array size by specifying the upper bound, which is the size less
one.
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
Instant Python: C#/VB to Python converter
"Jack Hughes" wrote:
don't c# array subscripts start at zero rather than one in VB?

so, the equivalant would be:

string val1 = values.Split(',')[0];

Jack

Mark Rae wrote:
"rodchar" <ro*****@discussions.microsoft.comwrote in message
news:4D**********************************@microsof t.com...
String val1 = values.Split(",")(1);
string val1 = values.Split(',')[1];
Feb 14 '07 #5
Try this one,

String val1 = values.Split(",")[1];

Cause we obtain indexed elements value(index) at Visual Basic
but in C# value[index] gives correct result.

rodchar yazdi:
hey all,
the following snippet works in vb but i'm missing the syntax in csharp:

String val1 = values.Split(",")(1);

i'm getting this error:

Argument '1': cannot convert from 'string' to 'char[]'

thanks,
rodchar
Feb 22 '07 #6
No!!!!!!!

It's the "," parameter to the Split method. That is a string but it needs a
char, change it to ','. The single quotes indicates that it is a char
literal instead of a string literal.

string val1 = values.Split(',')[1];
"dursun caglar" <du**********@gmail.comwrote in message
news:11**********************@t69g2000cwt.googlegr oups.com...
Try this one,

String val1 = values.Split(",")[1];

Cause we obtain indexed elements value(index) at Visual Basic
but in C# value[index] gives correct result.

rodchar yazdi:
>hey all,
the following snippet works in vb but i'm missing the syntax in csharp:

String val1 = values.Split(",")(1);

i'm getting this error:

Argument '1': cannot convert from 'string' to 'char[]'

thanks,
rodchar
Feb 22 '07 #7

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

Similar topics

14
7214
by: John | last post by:
Is there an equivalent of COM on Linux that I can get through Python. My need is to have some sort of language independent component framework. I can think of CORBA but I have to have a server...
2
3268
by: Michael Foord | last post by:
Please pardon my ignorance on this one - but I'm not certain how the sign bt is treated in python bitwise operators. I've trying to convert a javascript DES encryption routine into python. ...
3
2272
by: Robert Dodier | last post by:
Hello, Here's a thought that I'm sure has already occurred to someone else, I just can't find any record of it yet. An XML document is just a more verbose and clumsy representation of an...
1
3772
by: Vannela | last post by:
Is there any equivalent control in .NET for the Power builder DataWindow control? I am explaining the Datawindow architecture to some extent. Power Builder DataWindow Control has got different...
6
5144
by: Frank Rachel | last post by:
So I can focus on the correct areas of research, I was wondering if someone could give me the .NET equivelents for this J2EE architecture: JSP's make calls to local JavaBean Controls. The...
3
3128
by: Marty | last post by:
Hi, What is the VB.NET equivalent of the VB6 ADODB.Connector and ADODB.Recordset? Thanks Marty
7
3712
by: Tim Conner | last post by:
Hi, I am an ex-delphi programmer, and I having a real hard time with the following simple code (example ): Which is the equivalent to the following code ? var chars : PChar; sBack, s :...
10
7305
by: karch | last post by:
How would this C# contruct be represented in C++/CLI? Or is it even possible? PolicyLevel level = (enumerator->Current) as PolicyLevel; Thanks, Karch
9
4030
by: Alan Silver | last post by:
Hello, I'm converting some old VB6 code to use with ASP.NET and have come unstuck with the Asc() function. This was used in the old VB6 code to convert a character to its ASCII numeric...
14
2521
by: grid | last post by:
Hi, I have a certain situation where a particular piece of code works on a particular compiler but fails on another proprietary compiler.It seems to have been fixed but I just want to confirm if...
0
7234
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
7136
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
7344
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
7412
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...
0
7505
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...
0
3203
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
441
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.