Solved

convert function

Posted on 2012-04-10
2
225 Views
Last Modified: 2012-04-10
trying to convert this function to c#
trying to move from vb to c#

 Function MakeByte(ByVal text As String) As Byte()

        Dim i As Integer
        Dim ba(text.Length - 1) As Byte
        For i = 1 To Len(text)
            ba(i - 1) = Asc(Mid(text, i, 1))
        Next

        Return ba

    End Function
0
Comment
Question by:sevensnake77
2 Comments
 
LVL 38

Accepted Solution

by:
Tom Beck earned 500 total points
ID: 37830855
public byte[] MakeByte(string text)
{

	int i = 0;
	byte[] ba = new byte[text.Length];
	for (i = 1; i <= Strings.Len(text); i++) {
		ba(i - 1) = Strings.Asc(Strings.Mid(text, i, 1));
	}

	return ba;

}

Open in new window


From converter.telerik.com

No guarantee it will work however.
0
 
LVL 9

Author Closing Comment

by:sevensnake77
ID: 37830886
I did that in the converter but the string still came up error until I compliled it. Wonder why ?
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now