Click here to Skip to main content
15,902,114 members
Home / Discussions / C#
   

C#

 
QuestionHow to get a .Net Control of a web page in c# Pin
Yukivi3-Jun-09 23:20
Yukivi3-Jun-09 23:20 
AnswerRe: How to get a .Net Control of a web page in c# Pin
Henry Minute4-Jun-09 2:44
Henry Minute4-Jun-09 2:44 
QuestionZero's before number. Pin
Satish - Developer3-Jun-09 22:59
Satish - Developer3-Jun-09 22:59 
AnswerRe: Zero's before number. Pin
0x3c03-Jun-09 23:15
0x3c03-Jun-09 23:15 
AnswerRe: Zero's before number. Pin
Christian Graus3-Jun-09 23:17
protectorChristian Graus3-Jun-09 23:17 
AnswerRe: Zero's before number. Pin
Pete O'Hanlon3-Jun-09 23:22
mvePete O'Hanlon3-Jun-09 23:22 
AnswerRe: Zero's before number. Pin
CPallini4-Jun-09 0:54
mveCPallini4-Jun-09 0:54 
AnswerRe: Zero's before number. Pin
Lutosław4-Jun-09 1:46
Lutosław4-Jun-09 1:46 
I suppose that what you really wanted to ask is: how to read a data with leading zeros and don't loose these zeros.
You have two possibilities:
- Store the number asa string in your application and parse it each time you need it for calculations.
- Create a structure which would store a number of zeros (I would do it this way).

internal struct IntWithZeros
{
	private int zerosCount, value;

	public static implicit operator int(IntWithZeros x)
	{
		return x.value;
	}

	// overload other required operators to preserve zerosCount

	public static IntWithZeros Parse(string data)
	{
		IntWithZeros ret;
		ret.zerosCount = 0;
		while (data.Length > ret.zerosCount && data[ret.zerosCount] == '0') {
			ret.zerosCount++;
		}
		ret.value = int.Parse(data);
		return ret;
	}
	public override string ToString()
	{
		string s = value.ToString();
		return s.PadLeft(s.Length + zerosCount, '0');
	}
}


Greetings - Jacek Gajek

AnswerRe: Zero's before number. Pin
Searril4-Jun-09 3:13
Searril4-Jun-09 3:13 
GeneralRe: Zero's before number. Pin
Lutosław6-Jun-09 1:50
Lutosław6-Jun-09 1:50 
QuestionCheck this out guys! Pin
Rajdeep.NET3-Jun-09 22:24
Rajdeep.NET3-Jun-09 22:24 
AnswerRe: Check this out guys! Pin
0x3c03-Jun-09 22:27
0x3c03-Jun-09 22:27 
GeneralRe: Check this out guys! Pin
Rajdeep.NET3-Jun-09 23:01
Rajdeep.NET3-Jun-09 23:01 
GeneralRe: Check this out guys! Pin
0x3c04-Jun-09 1:36
0x3c04-Jun-09 1:36 
AnswerRe: Check this out guys! Pin
Pete O'Hanlon3-Jun-09 22:28
mvePete O'Hanlon3-Jun-09 22:28 
GeneralRe: Check this out guys! Pin
Rajdeep.NET3-Jun-09 22:52
Rajdeep.NET3-Jun-09 22:52 
GeneralRe: Check this out guys! Pin
0x3c03-Jun-09 22:58
0x3c03-Jun-09 22:58 
GeneralRe: Check this out guys! Pin
Rajdeep.NET3-Jun-09 22:53
Rajdeep.NET3-Jun-09 22:53 
GeneralRe: Check this out guys! Pin
Alan N3-Jun-09 23:10
Alan N3-Jun-09 23:10 
AnswerRe: Check this out guys! Pin
J4amieC3-Jun-09 23:48
J4amieC3-Jun-09 23:48 
GeneralRe: Check this out guys! Pin
Rajdeep.NET4-Jun-09 6:10
Rajdeep.NET4-Jun-09 6:10 
GeneralRe: Check this out guys! Pin
J4amieC5-Jun-09 0:08
J4amieC5-Jun-09 0:08 
QuestionRe: Check this out guys! Pin
Rajesh R Subramanian3-Jun-09 23:57
professionalRajesh R Subramanian3-Jun-09 23:57 
AnswerRe: Check this out guys! Pin
EliottA4-Jun-09 7:15
EliottA4-Jun-09 7:15 
GeneralRe: Check this out guys! Pin
Rajesh R Subramanian4-Jun-09 18:50
professionalRajesh R Subramanian4-Jun-09 18:50 

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.