Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

convert function

Posted on 2012-04-10
2
Medium Priority
?
234 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:Seven price
2 Comments
 
LVL 38

Accepted Solution

by:
Tom Beck earned 2000 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:Seven price
ID: 37830886
I did that in the converter but the string still came up error until I compliled it. Wonder why ?
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

782 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