Results 1 to 2 of 2

Thread: [solved for now] c# to vb.net conversion

  1. #1

    Thread Starter
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552

    [solved for now] c# to vb.net conversion

    Code:
    using System;
    
    namespace ConsoleApplication4
    {
    	/// <summary>
    	/// Summary description for Class1.
    	/// </summary>
    	class Class1
    	{
    		/// <summary>
    		/// The main entry point for the application.
    		/// </summary>
    		[STAThread]
    		static void Main(string[] args)
    		{
    			//
    			// TODO: Add code to start application here
    			//
    			string s="BILLGATES";
    			int num=0;
    			for(int i=0;i<s.Length;i++)
    			{
    				num+=(int)s[i];
    			}
    			num+=3; //William Henry III
    			Console.WriteLine(num);
    		}
    	}
    }
    thanx in advance...
    Last edited by brown monkey; Jun 17th, 2004 at 02:38 AM.

  2. #2

    Thread Starter
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    i got it. but is this the efficient way???
    VB Code:
    1. Module Module1
    2.  
    3.     Sub Main()
    4.       Dim s As String = "BILLGATES"
    5.       Dim c() As Char = s.ToCharArray
    6.       Dim i As Integer
    7.       Dim num As Integer = 0
    8.       For i = 0 To c.Length - 1
    9.          num += Asc(c(i))
    10.       Next
    11.       num += 3
    12.       Console.WriteLine(num)
    13.     End Sub
    14.  
    15. End Module
    thanx...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width