Click here to Skip to main content
15,885,365 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# and SQL server problem Pin
William Ten Broek24-Aug-06 11:27
William Ten Broek24-Aug-06 11:27 
GeneralRe: C# and SQL server problem [modified] Pin
CooperWu24-Aug-06 16:34
CooperWu24-Aug-06 16:34 
AnswerRe: C# and SQL server problem Pin
~~~Johnny~~~24-Aug-06 1:47
~~~Johnny~~~24-Aug-06 1:47 
Questionint to String conversion Pin
Brendan Vogt23-Aug-06 23:49
Brendan Vogt23-Aug-06 23:49 
AnswerRe: int to String conversion Pin
William Ten Broek23-Aug-06 23:55
William Ten Broek23-Aug-06 23:55 
AnswerRe: int to String conversion Pin
CooperWu23-Aug-06 23:59
CooperWu23-Aug-06 23:59 
AnswerRe: int to String conversion Pin
ayyp24-Aug-06 0:30
ayyp24-Aug-06 0:30 
AnswerRe: int to String conversion Pin
Guffa24-Aug-06 2:50
Guffa24-Aug-06 2:50 
ma se wrote:
I always thought that integers can get converted to strings?


Yes, they can, but not automatically. You have to tell the compiler that you actually are wanting to do the conversion, and not just trying to assign an integer to a string variable by mistake.

Here are some of the ways that it can be done:

string bottleQuantity = (i * 6).ToString();<br />
string bottleQuantity = Convert.ToString(i * 6);<br />
string bottleQuantity = (i * 6).ToString(CultureInfo.InvariantCulture);<br />
string bottleQuantity = (i * 6).ToString(CultureInfo.CurrentCulture);<br />
string bottleQuantity = (i * 6).ToString(new CultureInfo("en-GB"));<br />
string bottleQuantity = (i * 6).ToString("0");<br />
string bottleQuantity = string.Format("{0}", i * 6);<br />
string bottleQuantity = string.Format("{0:0}", i * 6);<br />
string bottleQuantity = (i * 6).ToString("0", CultureInfo.InvariantCulture);<br />
string bottleQuantity = string.Format(CultureInfo.InvariantCulture, "{0}", i * 6);



---
b { font-weight: normal; }

GeneralRe: int to String conversion Pin
Brendan Vogt24-Aug-06 3:31
Brendan Vogt24-Aug-06 3:31 
GeneralRe: int to String conversion Pin
Guffa24-Aug-06 12:20
Guffa24-Aug-06 12:20 
GeneralRe: int to String conversion Pin
Brendan Vogt24-Aug-06 22:37
Brendan Vogt24-Aug-06 22:37 
AnswerRe: int to String conversion Pin
Guffa25-Aug-06 9:31
Guffa25-Aug-06 9:31 
GeneralRe: int to String conversion Pin
Brendan Vogt27-Aug-06 20:34
Brendan Vogt27-Aug-06 20:34 
QuestionDisplay a on the datagrid [modified] Pin
Mamphekgo23-Aug-06 22:37
Mamphekgo23-Aug-06 22:37 
AnswerRe: Display a on the datagrid Pin
Christian Graus23-Aug-06 22:45
protectorChristian Graus23-Aug-06 22:45 
JokeRe: Display a on the datagrid Pin
Not Active24-Aug-06 2:28
mentorNot Active24-Aug-06 2:28 
GeneralRe: Display a on the datagrid Pin
Muammar©10-Sep-06 0:31
Muammar©10-Sep-06 0:31 
Questionno mails in mailroot when i send the mail Pin
ayyp23-Aug-06 21:09
ayyp23-Aug-06 21:09 
AnswerRe: no mails in mailroot when i send the mail Pin
CooperWu24-Aug-06 0:04
CooperWu24-Aug-06 0:04 
GeneralRe: no mails in mailroot when i send the mail Pin
ayyp24-Aug-06 0:25
ayyp24-Aug-06 0:25 
GeneralRe: no mails in mailroot when i send the mail Pin
CooperWu24-Aug-06 0:37
CooperWu24-Aug-06 0:37 
QuestionOptional Prameter Pin
iprasad00723-Aug-06 20:44
iprasad00723-Aug-06 20:44 
AnswerRe: Optional Prameter Pin
Christian Graus23-Aug-06 21:12
protectorChristian Graus23-Aug-06 21:12 
QuestionRe: Optional Prameter Pin
iprasad00723-Aug-06 23:13
iprasad00723-Aug-06 23:13 
AnswerRe: Optional Prameter Pin
Christian Graus23-Aug-06 23:19
protectorChristian Graus23-Aug-06 23:19 

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.