473,405 Members | 2,310 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,405 software developers and data experts.

Convert VFP line to CSharp

J
Hello,

I'm trying to translate the following line (extracted from VFP code) to
CSharp code, but for the moment I've not been able. Could anybody give me a
hand ?

I need to convert it as string :
string
cmd=char(33)+char(35)+char(49)+substr(this.parent. Dsp.MessageOut(),1,20)+chr
(13);

Thanks ;)
Nov 17 '05 #1
3 2192
Hi ,
you may try this with a little change

byte [] a = new byte[5];

a[0] = 33;

a[1] = 35 ;

a[2] = 49 ;

string cmd = Encoding.ASCII.GetString(a);

"J" <co**@hotmail.com> wrote in message
news:O1**************@TK2MSFTNGP09.phx.gbl...
Hello,

I'm trying to translate the following line (extracted from VFP code) to
CSharp code, but for the moment I've not been able. Could anybody give me
a
hand ?

I need to convert it as string :
string
cmd=char(33)+char(35)+char(49)+substr(this.parent. Dsp.MessageOut(),1,20)+chr
(13);

Thanks ;)

Nov 17 '05 #2
Hi,

No idea if 33, 35 or 49 are printables, if so:

StringBuilder sb = new StringBuilder( "ABC" );

if not:
StringBuilder sb = new StringBuilder( );
sb.Append ( (char)33 );
...

then in either case:

sb.Append( this.parent.Dsp.MessageOut().SubString( 1, 20 ) );
sb.Append( Environment.NewLine );
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"J" <co**@hotmail.com> wrote in message
news:O1**************@TK2MSFTNGP09.phx.gbl...
Hello,

I'm trying to translate the following line (extracted from VFP code) to
CSharp code, but for the moment I've not been able. Could anybody give me
a
hand ?

I need to convert it as string :
string
cmd=char(33)+char(35)+char(49)+substr(this.parent. Dsp.MessageOut(),1,20)+chr
(13);

Thanks ;)

Nov 17 '05 #3
J
Many thanks to both...
Using the Hasan solution has solved my problems...

byte [] a = new byte[5];
a[0] = 33;
a[1] = 35 ;
a[2] = 49 ;
string cmd = Encoding.ASCII.GetString(a);

Cheers !
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:OT*************@TK2MSFTNGP10.phx.gbl...
Hi,

No idea if 33, 35 or 49 are printables, if so:

StringBuilder sb = new StringBuilder( "ABC" );

if not:
StringBuilder sb = new StringBuilder( );
sb.Append ( (char)33 );
...

then in either case:

sb.Append( this.parent.Dsp.MessageOut().SubString( 1, 20 ) );
sb.Append( Environment.NewLine );
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"J" <co**@hotmail.com> wrote in message
news:O1**************@TK2MSFTNGP09.phx.gbl...
Hello,

I'm trying to translate the following line (extracted from VFP code) to
CSharp code, but for the moment I've not been able. Could anybody give me a
hand ?

I need to convert it as string :
string
cmd=char(33)+char(35)+char(49)+substr(this.parent. Dsp.MessageOut(),1,20)+chr (13);

Thanks ;)


Nov 17 '05 #4

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

Similar topics

3
by: hunterb | last post by:
I have a file which has no BOM and contains mostly single byte chars. There are numerous double byte chars (Japanese) which appear throughout. I need to take the resulting Unicode and store it in a...
11
by: Ken Varn | last post by:
I want to be able to determine my current line, file, and function in my C# application. I know that C++ has the __LINE__, __FUNCTION__, and __FILE___ macros for getting this, but I cannot find a...
1
by: Tamir Khason | last post by:
Somebody knows how to convert Bounds to Point ??? Thnx
4
by: L.Peter | last post by:
Dear Group, I have the following code for vb.net *** Dim objFaxServer As New FAXCOMEXLib.FaxServer Dim collFaxIncomingJobs As FaxIncomingJobs Dim objFaxIncomingJob As FaxIncomingJob
3
by: Mike | last post by:
Hi, Does anyone know of reliable programs that convert C# to Java and viceversa? Thanks Mike
7
by: Peter Smirnov | last post by:
Sorry for this newbie question but as far as I heard one need at least VisualStudio to develop CSharp applications. Is this correct? Are there otherwise some command line tools like javac.exe and...
1
by: dongxm | last post by:
Is there a function can convert "abc" to "\u0097\u0098\u0099" in dotnet(c#)
5
by: moondaddy | last post by:
How do I get the string representation of an int? for example int var1 = 2; string var2 = var1.ToString; I'm wanting var2 to be "2" I get the compile error: Error 1 Cannot convert...
1
by: shapper | last post by:
Hello, I am having problems in converting the following code line to VB.NET: Control list = MyFun(myControl, delegate(Control ctl) { ctl.ID == "MyControl"; }); Could someone please help me...
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: 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
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.