How to change vb.net code to C#.Net ?...

Hi,

Earlier i had a class  that i got it from this Forum, it in vb.net and i am trying it to convert it in c#.net but i am unable to covert properly to work.

the functionality of this class is to convert number value to words. i am putting both of code c#.net and VB.net please rectify it.

Public Class NumberToWords
    Dim Character As String

    Public Function ConvertNumber(ByVal A As Double) As String
        On Error Resume Next
        Dim MM
        Dim IM
        ConvertNumber = ""
        MM = Microsoft.VisualBasic.Len(A)
        IM = Microsoft.VisualBasic.Left(A, Microsoft.VisualBasic.Len(A))
        If Microsoft.VisualBasic.Len(IM) = 9 Then
            ConvertNumber = GetNumberInWords(Microsoft.VisualBasic.Left(IM, 2), " Crore ") & GetNumberInWords(Microsoft.VisualBasic.Right(Microsoft.VisualBasic.Left(IM, 4), 2), " Lack ") & GetNumberInWords(Microsoft.VisualBasic.Right(Microsoft.VisualBasic.Left(IM, 6), 2), " Thousand ") & GetNumberInWords(Microsoft.VisualBasic.Right(Microsoft.VisualBasic.Left(IM, 7), 1), " Hundred ") & GetNumberInWords(Microsoft.VisualBasic.Right(Microsoft.VisualBasic.Left(IM, 9), 2), "")
        ElseIf Microsoft.VisualBasic.Len(IM) = 8 Then
            ConvertNumber = GetNumberInWords(Microsoft.VisualBasic.Left(IM, 1), " Crore ") & GetNumberInWords(Microsoft.VisualBasic.Right(Microsoft.VisualBasic.Left(IM, 3), 2), " Lack ") & GetNumberInWords(Microsoft.VisualBasic.Right(Microsoft.VisualBasic.Left(IM, 5), 2), " Thousand ") & GetNumberInWords(Microsoft.VisualBasic.Right(Microsoft.VisualBasic.Left(IM, 6), 1), " Hundred ") & GetNumberInWords(Microsoft.VisualBasic.Right(Microsoft.VisualBasic.Left(IM, 8), 2), "")
        ElseIf Microsoft.VisualBasic.Len(IM) = 7 Then
            ConvertNumber = GetNumberInWords(Microsoft.VisualBasic.Left(IM, 2), " Lack ") & GetNumberInWords(Microsoft.VisualBasic.Right(Microsoft.VisualBasic.Left(IM, 4), 2), " Thousand ") & GetNumberInWords(Microsoft.VisualBasic.Right(Microsoft.VisualBasic.Left(IM, 5), 1), " Hundred ") & GetNumberInWords(Microsoft.VisualBasic.Right(Microsoft.VisualBasic.Left(IM, 7), 2), "")
        ElseIf Microsoft.VisualBasic.Len(IM) = 6 Then
            ConvertNumber = GetNumberInWords(Microsoft.VisualBasic.Left(IM, 1), " Lack ") & GetNumberInWords(Microsoft.VisualBasic.Right(Microsoft.VisualBasic.Left(IM, 3), 2), " Thousand ") & GetNumberInWords(Microsoft.VisualBasic.Right(Microsoft.VisualBasic.Left(IM, 4), 1), " Hundred ") & GetNumberInWords(Microsoft.VisualBasic.Right(Microsoft.VisualBasic.Left(IM, 6), 2), "")
        ElseIf Microsoft.VisualBasic.Len(IM) = 5 Then
            ConvertNumber = GetNumberInWords(Microsoft.VisualBasic.Left(IM, 2), " Thousand ") & GetNumberInWords(Microsoft.VisualBasic.Right(Microsoft.VisualBasic.Left(IM, 3), 1), " Hundred ") & GetNumberInWords(Microsoft.VisualBasic.Right(Microsoft.VisualBasic.Left(IM, 5), 2), "")
        ElseIf Microsoft.VisualBasic.Len(IM) = 4 Then
            ConvertNumber = GetNumberInWords(Microsoft.VisualBasic.Left(IM, 1), " Thousand ") & GetNumberInWords(Microsoft.VisualBasic.Right(Microsoft.VisualBasic.Left(IM, 2), 1), " Hundred ") & GetNumberInWords(Microsoft.VisualBasic.Right(Microsoft.VisualBasic.Left(IM, 4), 2), "")
        ElseIf Microsoft.VisualBasic.Len(IM) = 3 Then
            ConvertNumber = GetNumberInWords(Microsoft.VisualBasic.Left(IM, 1), "Hundred ") & GetNumberInWords(Microsoft.VisualBasic.Right(Microsoft.VisualBasic.Left(IM, 3), 2), "")
        ElseIf Microsoft.VisualBasic.Len(IM) <= 2 Then
            ConvertNumber = GetNumberInWords(Microsoft.VisualBasic.Left(IM, Microsoft.VisualBasic.Len(IM)), "")
        End If
        Return ConvertNumber

    End Function

    Public Function GetNumberInWords(ByVal co As Integer, ByVal sSTR As String) As String
        On Error Resume Next
        Dim Am As Integer
        Character = ""
        'If co = 0 Then CharacteR = " Zero"
        If co = 1 Then Character = " One" & sSTR
        If co = 2 Then Character = " Two" & sSTR
        If co = 3 Then Character = " Three" & sSTR
        If co = 4 Then Character = " Four" & sSTR
        If co = 5 Then Character = " Five" & sSTR
        If co = 6 Then Character = " Six" & sSTR
        If co = 7 Then Character = " Seven" & sSTR
        If co = 8 Then Character = " Eight" & sSTR
        If co = 9 Then Character = " Nine" & sSTR
        If co = 10 Then Character = " Ten" & sSTR
        If co = 11 Then Character = " Eleven" & sSTR
        If co = 12 Then Character = " Twelve" & sSTR
        If co = 13 Then Character = " Thirteen" & sSTR
        If co = 14 Then Character = " Fourteen" & sSTR
        If co = 15 Then Character = " Fifteen" & sSTR
        If co = 16 Then Character = " Sixteen" & sSTR
        If co = 17 Then Character = " Seventeen" & sSTR
        If co = 18 Then Character = " Eighteen" & sSTR
        If co = 19 Then Character = " Nineteen" & sSTR
        If Character <> "" Then
            GoTo 10
        End If
        If Microsoft.VisualBasic.Len(CStr(co)) = 2 Then
            Am = Left(co, 1)
            If Am = 2 Then
                Character = "Twenty"
                Am = Right(co, 1)
                GetWords(Am, sSTR)
                GoTo 10
            End If

            If Am = 3 Then
                Character = "Thirty"
                Am = Right(co, 1)
                GetWords(Am, sSTR)
                GoTo 10
            End If

            If Am = 4 Then
                Character = "Fourty"
                Am = Right(co, 1)
                GetWords(Am, sSTR)
                GoTo 10
            End If

            If Am = 5 Then
                Character = "Fifty"
                Am = Right(co, 1)
                GetWords(Am, sSTR)
                GoTo 10
            End If

            If Am = 6 Then
                Character = "Sixty"
                Am = Right(co, 1)
                GetWords(Am, sSTR)
                GoTo 10
            End If

            If Am = 7 Then
                Character = "Sevnety"
                Am = Right(co, 1)
                GetWords(Am, sSTR)
                GoTo 10
            End If

            If Am = 8 Then
                Character = "Eighty"
                Am = Right(co, 1)
                GetWords(Am, sSTR)
                GoTo 10
            End If

            If Am = 9 Then
                Character = "Ninty"
                Am = Right(co, 1)
                GetWords(Am, sSTR)
                GoTo 10
            End If
        End If

10:     GetNumberInWords = Character

    End Function

    Private Sub GetWords(ByVal AM As Integer, ByVal sSTR As String)
        If AM = 1 Then Character = Character & " One" & sSTR
        If AM = 2 Then Character = Character & " Two" & sSTR
        If AM = 3 Then Character = Character & " Three" & sSTR
        If AM = 4 Then Character = Character & " Four" & sSTR
        If AM = 5 Then Character = Character & " Five" & sSTR
        If AM = 6 Then Character = Character & " Six" & sSTR
        If AM = 7 Then Character = Character & " Seven" & sSTR
        If AM = 8 Then Character = Character & " Eight" & sSTR
        If AM = 9 Then Character = Character & " Nine" & sSTR
    End Sub

End Class

 

and Here is the code that i was trying to convert

public class NumberToWords 
	{ 
		string Character; 

		public string ConvertNumber(double A) 
		{ 
			// TODO: NotImplemented statement: ICSharpCode.SharpRefactory.Parser.AST.VB.OnErrorStatement 
			object MM; 
			object IM; 
			ConvertNumber(0) = ""; 
			MM = Microsoft.CSharp.Len(A);			
			IM = Microsoft.CSharp.Left(A, Microsoft.CSharp.Len(A)); 
			if (Microsoft.CSharp.Len(IM) == 9) 
			{ 
				ConvertNumber = GetNumberInWords(Microsoft.CSharp.Left(IM, 2), " Crore ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 4), 2), " Lack ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 6), 2), " Thousand ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 7), 1), " Hundred ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 9), 2), ""); 
			} 
			else if (Microsoft.CSharp.Len(IM) == 8) 
			{ 
				ConvertNumber = GetNumberInWords(Microsoft.CSharp.Left(IM, 1), " Crore ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 3), 2), " Lack ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 5), 2), " Thousand ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 6), 1), " Hundred ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 8), 2), ""); 
			} 
			else if (Microsoft.CSharp.Len(IM) == 7) 
			{ 
				ConvertNumber = GetNumberInWords(Microsoft.CSharp.Left(IM, 2), " Lack ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 4), 2), " Thousand ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 5), 1), " Hundred ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 7), 2), ""); 
			} 
			else if (Microsoft.CSharp.Len(IM) == 6) 
			{ 
				ConvertNumber = GetNumberInWords(Microsoft.CSharp.Left(IM, 1), " Lack ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 3), 2), " Thousand ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 4), 1), " Hundred ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 6), 2), ""); 
			} 
			else if (Microsoft.CSharp.Len(IM) == 5) 
			{ 
				ConvertNumber = GetNumberInWords(Microsoft.CSharp.Left(IM, 2), " Thousand ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 3), 1), " Hundred ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 5), 2), ""); 
			} 
			else if (Microsoft.CSharp.Len(IM) == 4) 
			{ 
				ConvertNumber = GetNumberInWords(Microsoft.CSharp.Left(IM, 1), " Thousand ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 2), 1), " Hundred ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 4), 2), ""); 
			} 
			else if (Microsoft.CSharp.Len(IM) == 3) 
			{ 
				ConvertNumber = GetNumberInWords(Microsoft.CSharp.Left(IM, 1), "Hundred ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 3), 2), ""); 
			} 
			else if (Microsoft.CSharp.Len(IM) <= 2) 
			{ 
				ConvertNumber = GetNumberInWords(Microsoft.CSharp.Left(IM, Microsoft.CSharp.Len(IM)), ""); 
			} 
			return ConvertNumber; 
		} 

		public string GetNumberInWords(int co, string sSTR) 
		{ 
			// TODO: NotImplemented statement: ICSharpCode.SharpRefactory.Parser.AST.VB.OnErrorStatement 
			int Am; 
			Character = ""; 
			if (co == 1) 
			{ 
				Character = " One" + sSTR; 
			} 
			if (co == 2) 
			{ 
				Character = " Two" + sSTR; 
			} 
			if (co == 3) 
			{ 
				Character = " Three" + sSTR; 
			} 
			if (co == 4) 
			{ 
				Character = " Four" + sSTR; 
			} 
			if (co == 5) 
			{ 
				Character = " Five" + sSTR; 
			} 
			if (co == 6) 
			{ 
				Character = " Six" + sSTR; 
			} 
			if (co == 7) 
			{ 
				Character = " Seven" + sSTR; 
			} 
			if (co == 8) 
			{ 
				Character = " Eight" + sSTR; 
			} 
			if (co == 9) 
			{ 
				Character = " Nine" + sSTR; 
			} 
			if (co == 10) 
			{ 
				Character = " Ten" + sSTR; 
			} 
			if (co == 11) 
			{ 
				Character = " Eleven" + sSTR; 
			} 
			if (co == 12) 
			{ 
				Character = " Twelve" + sSTR; 
			} 
			if (co == 13) 
			{ 
				Character = " Thirteen" + sSTR; 
			} 
			if (co == 14) 
			{ 
				Character = " Fourteen" + sSTR; 
			} 
			if (co == 15) 
			{ 
				Character = " Fifteen" + sSTR; 
			} 
			if (co == 16) 
			{ 
				Character = " Sixteen" + sSTR; 
			} 
			if (co == 17) 
			{ 
				Character = " Seventeen" + sSTR; 
			} 
			if (co == 18) 
			{ 
				Character = " Eighteen" + sSTR; 
			} 
			if (co == 19) 
			{ 
				Character = " Nineteen" + sSTR; 
			} 
			if (Character != "") 
			{ 
				goto x; 
			} 
			if (Microsoft.CSharp.Len(System.Convert.ToString(co)) == 2) 
			{ 
				Am = Left(co, 1); 
				if (Am == 2) 
				{ 
					Character = "Twenty"; 
					Am = Right(co, 1); 
					GetWords(Am, sSTR); 
					goto x; 
				} 
				if (Am == 3) 
				{ 
					Character = "Thirty"; 
					Am = Right(co, 1); 
					GetWords(Am, sSTR); 
					goto x; 
				} 
				if (Am == 4) 
				 { 
					Character = "Fourty"; 
					Am = Right(co, 1); 
					GetWords(Am, sSTR); 
					goto x; 
				} 
				if (Am == 5) 
				{ 
					Character = "Fifty"; 
					Am = Right(co, 1); 
					GetWords(Am, sSTR); 
					goto x; 
				} 
				if (Am == 6) 
				{ 
					Character = "Sixty"; 
					Am = Right(co, 1); 
					GetWords(Am, sSTR); 
					goto x; 
				} 
				if (Am == 7) 
				{ 
					Character = "Sevnety"; 
					Am = Right(co, 1); 
					GetWords(Am, sSTR); 
					goto x; 
				} 
				if (Am == 8) 
				{ 
					Character = "Eighty"; 
					Am = Right(co, 1); 
					GetWords(Am, sSTR); 
					goto x; 
				} 
				if (Am == 9) 
				{ 
					Character = "Ninty"; 
					Am = Right(co, 1); 
					GetWords(Am, sSTR); 
					goto x; 
				} 
			} 
			x:  
				  GetNumberInWords = Character; 
		} 

		private void GetWords(int AM, stringsSTR) 
		{ 
			if (AM == 1) 
			{ 
				Character = Character + " One" + sSTR; 
			} 
			if (AM == 2) 
			{ 
				Character = Character + " Two" + sSTR; 
			} 
			if (AM == 3) 
			{ 
				Character = Character + " Three" + sSTR; 
			} 
			if (AM == 4) 
			{ 
				Character = Character + " Four" + sSTR; 
			} 
			if (AM == 5) 
			{ 
				Character = Character + " Five" + sSTR; 
			} 
			if (AM == 6) 
			{ 
				Character = Character + " Six" + sSTR; 
			} 
			if (AM == 7) 
			{ 
				Character = Character + " Seven" + sSTR; 
			} 
			if (AM == 8) 
			{ 
				Character = Character + " Eight" + sSTR; 
			} 
			if (AM == 9) 
			{ 
				Character = Character + " Nine" + sSTR; 
			} 
		} 
	}

 I hope you will reply better.


Please remember to click “Mark as Answer” on the post that helps you

Jasim Akhtar
New Delhi ( INDIA )
0
miazaidi
4/19/2007 4:31:59 AM
asp.net.web-forms 93655 articles. 5 followers. Follow

5 Replies
1375 Views

Similar Articles

[PageSpeed] 7

Hi,

there are several interesting Code convertors online to be found that you can use in your effort.

Grz, Kris.


Read my blog. Handy Firefox plugins for web developers.


Workaround for non working Mark as answer buttons.
0
XIII
4/19/2007 7:02:32 AM

hi,

you may use following url for conversion http://www.developerfusion.co.uk/

hope it works

0
chandrayvr
4/19/2007 8:53:53 AM
chandrayvr:

hi,

you may use following url for conversion http://www.developerfusion.co.uk/

hope it works

The Converted code to C# that is mentioned above is converted with this http://www.developerfusion.co.uk/

but after converting i need to chage more of codes. but as a beginner i am unable to rectify it.

plz give me some hints.


Please remember to click “Mark as Answer” on the post that helps you

Jasim Akhtar
New Delhi ( INDIA )
0
miazaidi
4/19/2007 9:49:59 AM

Hi,

miazaidi:
but after converting i need to chage more of codes. but as a beginner i am unable to rectify it.

plz give me some hints.

Could you provide some pieces of code that you're having problems with? Did you also take a look at the new convertor of Telerik?

Grz, Kris.


Read my blog. Handy Firefox plugins for web developers.


Workaround for non working Mark as answer buttons.
0
XIII
4/19/2007 10:55:51 AM
chandrayvr:

hi,

you may use following url for conversion http://www.developerfusion.co.uk/

hope it works

I am putting whole Class and making underline syntax error that i am getting.

 
1    using System;
2    
3    
4    namespace Libreary
5    {
6    	/// <summary>
7    	/// Summary description for NumberToWords.
8    	/// </summary>
9    	public class NumberToWords
10   	{
11   		public NumberToWords()
12   		{
13   			//
14   			// TODO: Add constructor logic here
15   			//
16   		}
17   
18   		string Character; 
19   
20   		public string ConvertNumber(double A) 
21   		{ 
22   			// TODO: NotImplemented statement: ICSharpCode.SharpRefactory.Parser.AST.VB.OnErrorStatement 
23   			object MM; 
24   			object IM; 
25   			ConvertNumber = ""; 
26   			MM = Microsoft.CSharp.Len(A);			
27   			IM = Microsoft.CSharp.Left(A, Microsoft.CSharp.Len(A)); 
28   			if (Microsoft.CSharp.Len(IM) == 9) 
29   			{ 
30   				ConvertNumber = GetNumberInWords(Microsoft.CSharp.Left(IM, 2), " Crore ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 4), 2), " Lack ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 6), 2), " Thousand ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 7), 1), " Hundred ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 9), 2), ""); 
31   			} 
32   			else if (Microsoft.CSharp.Len(IM) == 8) 
33   			{ 
34   				ConvertNumber = GetNumberInWords(Microsoft.CSharp.Left(IM, 1), " Crore ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 3), 2), " Lack ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 5), 2), " Thousand ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 6), 1), " Hundred ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 8), 2), ""); 
35   			} 
36   			else if (Microsoft.CSharp.Len(IM) == 7) 
37   			{ 
38   				ConvertNumber = GetNumberInWords(Microsoft.CSharp.Left(IM, 2), " Lack ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 4), 2), " Thousand ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 5), 1), " Hundred ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 7), 2), ""); 
39   			} 
40   			else if (Microsoft.CSharp.Len(IM) == 6) 
41   			{ 
42   				ConvertNumber = GetNumberInWords(Microsoft.CSharp.Left(IM, 1), " Lack ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 3), 2), " Thousand ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 4), 1), " Hundred ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 6), 2), ""); 
43   			} 
44   			else if (Microsoft.CSharp.Len(IM) == 5) 
45   			{ 
46   				ConvertNumber = GetNumberInWords(Microsoft.CSharp.Left(IM, 2), " Thousand ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 3), 1), " Hundred ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 5), 2), ""); 
47   			} 
48   			else if (Microsoft.CSharp.Len(IM) == 4) 
49   			{ 
50   				ConvertNumber = GetNumberInWords(Microsoft.CSharp.Left(IM, 1), " Thousand ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 2), 1), " Hundred ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 4), 2), ""); 
51   			} 
52   			else if (Microsoft.CSharp.Len(IM) == 3) 
53   			{ 
54   				ConvertNumber = GetNumberInWords(Microsoft.CSharp.Left(IM, 1), "Hundred ") + GetNumberInWords(Microsoft.CSharp.Right(Microsoft.CSharp.Left(IM, 3), 2), ""); 
55   			} 
56   			else if (Microsoft.CSharp.Len(IM) <= 2) 
57   			{ 
58   				ConvertNumber = GetNumberInWords(Microsoft.CSharp.Left(IM, Microsoft.CSharp.Len(IM)), ""); 
59   			} 
60   			return ConvertNumber; 
61   		} 
62   
63   		public string GetNumberInWords(int co, string sSTR) 
64   		{ 
65   			// TODO: NotImplemented statement: ICSharpCode.SharpRefactory.Parser.AST.VB.OnErrorStatement 
66   			int Am; 
67   			Character = ""; 
68   			if (co == 1) 
69   			{ 
70   				Character = " One" + sSTR; 
71   			} 
72   			if (co == 2) 
73   			{ 
74   				Character = " Two" + sSTR; 
75   			} 
76   			if (co == 3) 
77   			{ 
78   				Character = " Three" + sSTR; 
79   			} 
80   			if (co == 4) 
81   			{ 
82   				Character = " Four" + sSTR; 
83   			} 
84   			if (co == 5) 
85   			{ 
86   				Character = " Five" + sSTR; 
87   			} 
88   			if (co == 6) 
89   			{ 
90   				Character = " Six" + sSTR; 
91   			} 
92   			if (co == 7) 
93   			{ 
94   				Character = " Seven" + sSTR; 
95   			} 
96   			if (co == 8) 
97   			{ 
98   				Character = " Eight" + sSTR; 
99   			} 
100  			if (co == 9) 
101  			{ 
102  				Character = " Nine" + sSTR; 
103  			} 
104  			if (co == 10) 
105  			{ 
106  				Character = " Ten" + sSTR; 
107  			} 
108  			if (co == 11) 
109  			{ 
110  				Character = " Eleven" + sSTR; 
111  			} 
112  			if (co == 12) 
113  			{ 
114  				Character = " Twelve" + sSTR; 
115  			} 
116  			if (co == 13) 
117  			{ 
118  				Character = " Thirteen" + sSTR; 
119  			} 
120  			if (co == 14) 
121  			{ 
122  				Character = " Fourteen" + sSTR; 
123  			} 
124  			if (co == 15) 
125  			{ 
126  				Character = " Fifteen" + sSTR; 
127  			} 
128  			if (co == 16) 
129  			{ 
130  				Character = " Sixteen" + sSTR; 
131  			} 
132  			if (co == 17) 
133  			{ 
134  				Character = " Seventeen" + sSTR; 
135  			} 
136  			if (co == 18) 
137  			{ 
138  				Character = " Eighteen" + sSTR; 
139  			} 
140  			if (co == 19) 
141  			{ 
142  				Character = " Nineteen" + sSTR; 
143  			} 
144  			if (Character != "") 
145  			{ 
146  				goto10; 
147  			} 
148  			if (Microsoft.CSharp.Len(System.Convert.ToString(co)) == 2) 
149  			{ 
150  				Am = Left(co, 1); 
151  				if (Am == 2) 
152  				{ 
153  					Character = "Twenty"; 
154  					Am = Right(co, 1); 
155  					GetWords(Am, sSTR); 
156  					goto10; 
157  				} 
158  				if (Am == 3) 
159  				{ 
160  					Character = "Thirty"; 
161  					Am = Right(co, 1); 
162  					GetWords(Am, sSTR); 
163  					goto10; 
164  				} 
165  				if (Am == 4) 
166  				{ 
167  					Character = "Fourty"; 
168  					Am = Right(co, 1); 
169  					GetWords(Am, sSTR); 
170  					goto10; 
171  				} 
172  				if (Am == 5) 
173  				{ 
174  					Character = "Fifty"; 
175  					Am = Right(co, 1); 
176  					GetWords(Am, sSTR); 
177  					goto10; 
178  				} 
179  				if (Am == 6) 
180  				{ 
181  					Character = "Sixty"; 
182  					Am = Right(co, 1); 
183  					GetWords(Am, sSTR); 
184  					goto10; 
185  				} 
186  				if (Am == 7) 
187  				{ 
188  					Character = "Sevnety"; 
189  					Am = Right(co, 1); 
190  					GetWords(Am, sSTR); 
191  					goto10; 
192  				} 
193  				if (Am == 8) 
194  				{ 
195  					Character = "Eighty"; 
196  					Am = Right(co, 1); 
197  					GetWords(Am, sSTR); 
198  					goto10; 
199  				} 
200  				if (Am == 9) 
201  				{ 
202  					Character = "Ninty"; 
203  					Am = Right(co, 1); 
204  					GetWords(Am, sSTR); 
205  					goto10; 
206  				} 
207  			} 
208  			10: 
209  				  GetNumberInWords = Character; 
210  		} 
211  
212  		private void GetWords(int AM, string sSTR) 
213  		{ 
214  			if (AM == 1) 
215  			{ 
216  				Character = Character + " One" + sSTR; 
217  			} 
218  			if (AM == 2) 
219  			{ 
220  				Character = Character + " Two" + sSTR; 
221  			} 
222  			if (AM == 3) 
223  			{ 
224  				Character = Character + " Three" + sSTR; 
225  			} 
226  			if (AM == 4) 
227  			{ 
228  				Character = Character + " Four" + sSTR; 
229  			} 
230  			if (AM == 5) 
231  			{ 
232  				Character = Character + " Five" + sSTR; 
233  			} 
234  			if (AM == 6) 
235  			{ 
236  				Character = Character + " Six" + sSTR; 
237  			} 
238  			if (AM == 7) 
239  			{ 
240  				Character = Character + " Seven" + sSTR; 
241  			} 
242  			if (AM == 8) 
243  			{ 
244  				Character = Character + " Eight" + sSTR; 
245  			} 
246  			if (AM == 9) 
247  			{ 
248  				Character = Character + " Nine" + sSTR; 
249  			} 
250  		} 
251  	}
252  }
253  
 
 the above hilighted code is syntax error that i am geeting, and line 208 a lable is defined there also i am getting error. when ever i put blank space between goto and label that is 10, I am getting Syntax error.
Please remember to click “Mark as Answer” on the post that helps you

Jasim Akhtar
New Delhi ( INDIA )
0
miazaidi
4/20/2007 5:20:45 AM
Reply:

Similar Artilces:

use VB.NET and C#.NET code in the same C#.NET project
All-- Here is a sample that is "off the beaten path", (at least for me). Is it possible, in an ASP.NET application, using the code-behind page building technique, to have both pages written in VB.NET and pages written C#.NET?At http://www.WebLogicArts.com/DemoList.aspx there is a sample that shows that, (contrary to popular belief), it IS possible to mix ASP.NET pages built with C#.NET with ASP.NET pages built with VB.NET in the same VS.NET 2003 project. Note that this is just a "fun" sample to see if it can be done and I do not recommend this practice as a "standard" way of develo...

Sending SMS using vb.net or C#.net using vb.net or c#.net
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

Translate c#.net code to vb.net code
Hi I can usually do the translation myself, but this time I am a bit stumped  Let us consider to rewrite Urls (more than 16000 links) using a table. Save original url and rewritten url in a table. Now add a class file in App_Code folder. class UrlRewriteModule : IHttpModule{    public void Dispose()    {        // Nothing to dispose    }    public void Init(HttpApplication context)    {        context.BeginRequest += new EventHandler(context...

How to convert C#.Net code to VB.Net code ???...
HI, i was searching something new, then i suddenly find some tips to convert C#.Net code to VB.Net but i did not do well. i am puttint its url here plz tell me how to convert C#.Net code to VB.Net. http://www.dotnetspider.com/code/C-273-Convert-C-VB-NET.aspx Jasim...Please remember to click “Mark as Answer” on the post that helps youJasim AkhtarNew Delhi ( INDIA ) It would be better if you write the problem you having, while converting from C# to VB.NET. You cannot completely rely on online converters. ThanksMark post(s) as "Answer" that helped youElectronic ScrewWebsite||Bl...

converting to vb.net from c#.net authorize.net
authorize.net offered me some sample code when I signed up with them the only problem is the sample code is in c#.net but my page that they type all of their credit card into is vb.net <code><%@ Import Namespace="System.Net" %> <%@ Import Namespace="System.IO" %> <script language="C#" runat="server"> void Page_Load(Object Src, EventArgs E) { myPage.Text = readHtmlPage("https://certification.authorize.net/gateway/transact.dll"); } private String readHtmlPage(string url) { ...

How to migrate code from vb.net to c#.net?
Hi all,If anybody knows information on migration of VB.Net application to C#.net. i.e Any tools available, best practices, methodology for estimation. etc.   RegardsHelen    Hey, Take a look at this topic http://forums.asp.net/t/1100603.aspxMaybe some of these sites can be of help to you.  Arnold you can do it by page by page just copy and paste ur page in the following link http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspx and convert ur vb.net to c# gotcha!!YasserSpica.www.spica.aewww.bncnetwork.netPlease remember to mark as answers i...

Migrate code from vb.net to C#.net
Hello friends, I had created a web site using visual studio 2005. web site was created using the language vb i.e. VB.net. Now as per the clint requirement I have to migrate all the code in C#. So the question is that is there any tool or any inbuild utility in Visual Stuidio so that we can migrate the site from vb.net to C#.net. Or we have to do it mannually i.e. by changing each and every line of code mannually? Kindly suggest me. Thanks & Regards Girish NehteThanks & RegardsGirish NehteIf This post helps you to solve your problem please mark this as an answer. Hi, at the mome...

vb.net vs c#.net vs j#.net
just out of curiousity which looks, acts most like java? i'm still learning trying to used to vb.net but it seems that it was easier to do some stuff with java. C# is Java++ in my opinion. If you have done C or Jave you will prefer C#.Mike Schellenberger - MCAD If you are looking for language similar to java go for J#. However most code samples you find on the net will be in VB.NET and C#....

.Net 2.0 Web application using Vb.net is unable to create object of another dll writen in C# .net 2.0
Hi, I habe created one ASP.net web application using Vb.net which is adding reference of dlls written in C# and .net 2.0. But whenever trying to create object of referencing dll, it is throwing error :Object reference does not set to an object. But, locally it is working fine,. In the server i have deployed the .aspx files and dll files in the bin. There were already an web.config in the server which is of .net 1.1. But checked it is retrieving value for that web.config correctly. Should i have to deply any other files and if not what can be the solution for this? Please help. Thanks, So...

VB.Net To C#.Net
Hello... Since Last from 1 year i had develope web application in using vb.net now i want to transfer from vb.net to c#.net so what should i do to transform to c# language any link or book related to me through i can easily understand and coding using c# in a short time... Thanks~ Mark As Answer If UseFull ~Kaushal. Hi, you can read the specifications of the language. You're already familiar with .NET and how to program in an OO manner thanks to your experience with vb.net. The only thing you need to learn is the new syntax of C#. You can also convert parts of your v...

C#.NET or VB.NET
what lang does everyone prefer? Thanks, Peter Iuvara, MCP It's a very famous debatable question in forums! I would say if you are from Java/C/C++, then C# would be easy to use for you. If you are from ASP/VB, then VB.NET would be easy for you! As long as if you follow CLS, then what ever the language you use, it's going to be the same for CLR!Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti I would agree with that ... just curious as to what user's on this forum predominantly code in?Thanks, Peter Iuvara, MCP I came from no real programming background, started i...

vb .net or c# .net
I currently develop websites using php but have been requested to develop a site using asp.net. The question I have is for someone who knows php would it be better to transition to vb.net or c#.net? Thanks, Fr. Robert C# -> There is a converter that will transition about 60% or more of your PHP code to C#. Plus C# is closer to PHP than VB.NET.Jason N. GaylordASPInsider and Microsoft MVPhttp://jasongaylord.com...

Both C# ASPX pages and VB.NET ASPX in single VB.NET Web Applcation Template
Hi.. Is it possible to have both c# pages and VB pages in same Webapplication, what i chose is VB.NET Web application Template. With Thanks, Jaya.... I don't see why you couldn't, but for the sake of consistency I don't know why you would want to do this. When you choose a C# or VB.NET application template(I'm assuming you're using VS or WebMatrix), it simply creates a .aspx file that includes a page directive that specifies the page language. If you created a C# template but want to use VB.Net instead, you need to go from: <%@ Page Language="C#" .... to...

change web form background property from code in vb.net
I have a web form in a vb.net project. The web form has both a design view and an HTML view. In the design view, the property box has a background property that can be set to an image file. This causes a background attribute to be added to the Body element in the HTML view. My question is, how do I modify the background property from program code? I can't find the object that has this property so I can set its value. On way to do it is to use 2 different style sheet and change the stylesheet in the pageload event depending on your condition. Look for an example in Report Starter Kit ...

Web resources about - How to change vb.net code to C#.Net ?... - asp.net.web-forms

Change Congress - Wikipedia, the free encyclopedia
Change Congress is an American organization that aims to end perceived corruption in the United States Congress by reducing what it considers ...

Becoming A Brand Change Leader
“The first step for a brand change leader is to free up resources that are committed to maintaining things that no longer contribute to brand ...

Obama: Climate change vital to economy, security
President explains why the world is focusing on climate amid a terror threat before leaving the Paris climate talks

Emanuel dismisses top cop Garry McCarthy amid pressure for change
Chicago Tribune Emanuel dismisses top cop Garry McCarthy amid pressure for change Chicago Tribune Garry McCarthy was appointed Chicago police ...

Here’s What International Leaders Have To Say About Climate Change
It was time for the world’s heads of state to have their say on the climate change problems and opportunities. They have now done so at COP21. ...

What global climate change looks like
Representatives from world countries gather in Paris to set carbon emissions targets they hope will reduce climate change.

House votes to reject Obama climate change regulations
CNN International House votes to reject Obama climate change regulations CNN International Washington (CNN) Hours after President Barack Obama ...

Obama Calls For World Action On Climate Change
... urgent action against a challenge that he suggested was greater even than the fight against terrorism. “The growing threat of climate change ...

Trump: Obama Is ‘Really Out Of It’ When Calling Climate Change The ‘Greatest Problem Confronting Our ...
Trump: Obama Is ‘Really Out Of It’ When Calling Climate Change The ‘Greatest Problem Confronting Our Country’

Open thread for night owls: Study shows the true extent of climate change deniers' media impact
... True Extent, Influence Of Climate Denial Echo Chamber For First Time : [T] hanks to a study published in the journal Nature Climate Change ...

Resources last updated: 12/2/2015 2:11:55 PM