Click here to Skip to main content
16,004,761 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: multiple file upload Pin
Abhijit Jana8-Jun-09 21:04
professionalAbhijit Jana8-Jun-09 21:04 
QuestionExporting Report in ReportViewer Pin
jgotlt8-Jun-09 20:28
jgotlt8-Jun-09 20:28 
AnswerRe: Exporting Report in ReportViewer Pin
saanj8-Jun-09 20:39
saanj8-Jun-09 20:39 
Questionhow to convert numeric value to word Pin
prateekfgiet8-Jun-09 19:05
prateekfgiet8-Jun-09 19:05 
AnswerRe: how to convert numeric value to word Pin
Baran M8-Jun-09 19:11
Baran M8-Jun-09 19:11 
AnswerRe: how to convert numeric value to word Pin
Christian Graus8-Jun-09 19:16
protectorChristian Graus8-Jun-09 19:16 
AnswerRe: how to convert numeric value to word Pin
Abhijit Jana8-Jun-09 19:30
professionalAbhijit Jana8-Jun-09 19:30 
GeneralRe: how to convert numeric value to word Pin
prateekfgiet8-Jun-09 19:38
prateekfgiet8-Jun-09 19:38 
ya i have tried a code but when code runs it will give error
code is :
string Number;
string deciml;
string _number;
string _deciml;
string[] US = new string[1003];
string[] SNu = new string[20];
string[] SNt = new string[10];
protected void Page_Load(object sender, EventArgs e)
{
Initialize();
}

public string NameOfNumber(string Number)
{
string GroupName = "";
string OutPut = "";

if ((Number.Length % 3) != 0)
{
Number = Number.PadLeft((Number.Length + (3 - (Number.Length % 3))), '0');
}
string[] Array = new string[Number.Length / 3];
Int16 Element = -1;
Int32 DisplayCount = -1;
bool LimitGroupsShowAll = false;
int LimitGroups = 0;
bool GroupToWords = true;
for (Int16 Count = 0; Count <= Number.Length - 3; Count += 3)
{
Element += 1;
Array[Element] = Number.Substring(Count, 3);

}
if (LimitGroups == 0)
{
LimitGroupsShowAll = true;
}
for (Int16 Count = 0; (Count <= ((Number.Length / 3) - 1)); Count++)
{
DisplayCount++;
if (((DisplayCount < LimitGroups) || LimitGroupsShowAll))
{
if (Array[Count] == "000") continue;
{
GroupName = US[((Number.Length / 3) - 1) - Count + 1];
}


if ((GroupToWords == true))
{
OutPut += Group(Array[Count]).TrimEnd(' ') + " " + GroupName + " ";

}
else
{
OutPut += Array[Count].TrimStart('0') + " " + GroupName;

}
}

}
Array = null;
return OutPut;

}


private string Group(string Argument)
{
string Hyphen = "";
string OutPut = "";
Int16 d1 = Convert.ToInt16(Argument.Substring(0, 1));
Int16 d2 = Convert.ToInt16(Argument.Substring(1, 1));
Int16 d3 = Convert.ToInt16(Argument.Substring(2, 1));
if ((d1 >= 1))
{
OutPut += SNu[d1] + " hundred ";
}
if ((double.Parse(Argument.Substring(1, 2)) < 20))
{
OutPut += SNu[Convert.ToInt16(Argument.Substring(1, 2))];
}
if ((double.Parse(Argument.Substring(1, 2)) >= 20))
{
if (Convert.ToInt16(Argument.Substring(2, 1)) == 0)
{
Hyphen += " ";
}
else
{
Hyphen += " ";
}
OutPut += SNt[d2] + Hyphen + SNu[d3];
}
return OutPut;
}

private void Initialize()
{

SNu[0] = "";
SNu[1] = "One";
SNu[2] = "Two";
SNu[3] = "Three";
SNu[4] = "Four";
SNu[5] = "Five";
SNu[6] = "Six";
SNu[7] = "Seven";
SNu[8] = "Eight";
SNu[9] = "Nine";
SNu[10] = "Ten";
SNu[11] = "Eleven";
SNu[12] = "Twelve";
SNu[13] = "Thirteen";
SNu[14] = "Fourteen";
SNu[15] = "Fifteen";
SNu[16] = "Sixteen";
SNu[17] = "Seventeen";
SNu[18] = "Eighteen";
SNu[19] = "Nineteen";
SNt[2] = "Twenty";
SNt[3] = "Thirty";
SNt[4] = "Forty";
SNt[5] = "Fifty";
SNt[6] = "Sixty";
SNt[7] = "Seventy";
SNt[8] = "Eighty";
SNt[9] = "Ninety";
US[1] = "";
US[2] = "Thousand";
US[3] = "Million";
US[4] = "Billion";
US[5] = "Trillion";
US[6] = "Quadrillion";
US[7] = "Quintillion";
US[8] = "Sextillion";
US[9] = "Septillion";
US[10] = "Octillion";
}
protected void Button1_Click(object sender, EventArgs e)
{
string currency = "Rupees ";
string _currency = " Paise Only";
if (Convert.ToDouble(TextBox1.Text) == 0)
{
TextBox2.Text = "Null Value";
return;
}
if (Convert.ToDouble(TextBox1.Text) < 0)
{
TextBox2.Text = "Invalid Value";
return;
}
string[] no = TextBox1.Text.Split('.');
if ((no[0] != null) && (no[1] != "00"))
{
Number = no[0];
deciml = no[1];
_number = (NameOfNumber(Number));
_deciml = (NameOfNumber(deciml));
TextBox2.Text = currency + _number.Trim() + " and " + _deciml.Trim() + _currency;
}
if ((no[0] != null) && (no[1] == "00"))
{
Number = no[0];
_number = (NameOfNumber(Number));
TextBox2.Text = currency + _number + "Only";
}
if ((Convert.ToDouble(no[0]) == 0) && (no[1] != null))
{
deciml = no[1];
_deciml = (NameOfNumber(deciml));
TextBox2.Text = _deciml + _currency;
}


}
and error is:

System.IndexOutOfRangeException: Index was outside the bounds of the array.
Source Error:


Line 166: }
Line 167: string[] no = TextBox1.Text.Split('.');
Line 168: if ((no[0] != null) && (no[1] != "00"))
Line 169: {
Line 170: Number = no[0];
GeneralRe: how to convert numeric value to word Pin
Christian Graus8-Jun-09 19:42
protectorChristian Graus8-Jun-09 19:42 
GeneralRe: how to convert numeric value to word Pin
Abhijit Jana8-Jun-09 19:48
professionalAbhijit Jana8-Jun-09 19:48 
GeneralRe: how to convert numeric value to word Pin
saanj8-Jun-09 19:54
saanj8-Jun-09 19:54 
GeneralRe: how to convert numeric value to word Pin
prateekfgiet8-Jun-09 20:10
prateekfgiet8-Jun-09 20:10 
GeneralRe: how to convert numeric value to word Pin
prateekfgiet8-Jun-09 20:13
prateekfgiet8-Jun-09 20:13 
GeneralRe: how to convert numeric value to word Pin
saanj8-Jun-09 20:16
saanj8-Jun-09 20:16 
GeneralRe: how to convert numeric value to word Pin
prateekfgiet8-Jun-09 20:21
prateekfgiet8-Jun-09 20:21 
GeneralRe: how to convert numeric value to word Pin
saanj8-Jun-09 20:33
saanj8-Jun-09 20:33 
GeneralRe: how to convert numeric value to word Pin
prateekfgiet8-Jun-09 20:46
prateekfgiet8-Jun-09 20:46 
GeneralRe: how to convert numeric value to word Pin
Abhijit Jana8-Jun-09 20:45
professionalAbhijit Jana8-Jun-09 20:45 
Question"Publish" website Pin
devvvy8-Jun-09 17:14
devvvy8-Jun-09 17:14 
AnswerRe: "Publish" website Pin
Christian Graus8-Jun-09 17:27
protectorChristian Graus8-Jun-09 17:27 
AnswerRe: "Publish" website Pin
saanj8-Jun-09 18:56
saanj8-Jun-09 18:56 
GeneralRe: "Publish" website Pin
devvvy8-Jun-09 19:26
devvvy8-Jun-09 19:26 
GeneralRe: "Publish" website Pin
saanj8-Jun-09 19:43
saanj8-Jun-09 19:43 
Question\0 character? Pin
devvvy8-Jun-09 15:49
devvvy8-Jun-09 15:49 
AnswerRe: \0 character? Pin
N a v a n e e t h8-Jun-09 16:04
N a v a n e e t h8-Jun-09 16:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.