|
Hello everyone,
Mentioned here,
http://msdn.microsoft.com/en-us/library/system.decimal(VS.80).aspx
What means "The scaling factor also preserves any trailing zeroes in a Decimal number"? Could anyone show me a sample please?
thanks in advance,
George
|
|
|
|
|
It means simply that it will not chop off any trailing zeros from your number i.e. 12.450 does not become 12.45
Hope that helps
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Thanks Bob,
Your sample pretty well demonstrates what means "preserves any trailing zeroes", but I am confused about what means "scaling factor also preserves" here?
BTW: I have the background of how Decimal and float are stored internally, but I do not know how could we utilize scale (I think it is the exponent) to preserve zero?
regards,
George
|
|
|
|
|
As I said originally, it preserves the number of decimal places. A quick look at MSDN for decimal says "The scaling factor specifies the number of digits to the right of the decimal point; it ranges from 0 through 28"
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Thanks Bob,
From the link,
http://msdn.microsoft.com/en-us/library/system.decimal(VS.80).aspx[^]
I can not find "The scaling factor specifies the number of digits to the right of the decimal point; it ranges from 0 through 28", could you post the link where you find the statement you quoted please?
I want to read more.
regards,
George
|
|
|
|
|
Hi,
Is the .Net winform development is competitive tool for windows system programing???? [Unsure] really? What is position of .Net winform developer in developers market? Is C# being preferred over c/c++ by any developer any point of time for system programming , embedded system programming?
|
|
|
|
|
|
|
Any Microsoft programming skills you have are marketable, so pick the one you like.
Second, .Net is more than just WinForms. If you limit yourself to that, you may as well get a job flipping burgers instead.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hello
I m developing a window application. I m doing diferent tasks against different events using multi-threading. Against 1 thread , I m enabling the timer, and against its function I m performing 1 task, but it is not working i.e it is not executing the timer function. if I put all the code against some button rather than within thread , then it works well.
plz tell me how could I use the Timer within the thread.
here is my Code.
private void Start_Click(object sender, EventArgs e)
{
pthrd = new Thread(new ThreadStart(Thrd1));
pthrd .Start();
}
void Thrd1()
{
MessageBox.Show("Thread Start");
timer1.Enabled = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
MessageBox.Show("Start Grabbing");
Calculate();
}
Shanzay
|
|
|
|
|
DeepOceans,
I am not sure if this is correct, but i think its because the thread does the work and then exits, thus the timer will be told to start but then instantly quick, thus it never ticks.
Since i am not sure if my thinking is correct, i dont have a solution other than to keep the thread alive.
Whats the reason you want to run a Timer in the background anyways?
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
I m using Timer to enable my function for grabbing the video frames on every tick. yes u might b right that thread does its work and exits but in my case it never actually goes in the function (i checked by printing a messegeBox). i already gave the code. plz try it and tell me more specific reason.
Thanku so much !
Shanzay
|
|
|
|
|
Your thread function should look something like this:
private void Thrd1()
{
while (true)
{
Thread.Sleep(1000);
Calculate();
}
}
private void Calculate()
{
}
BTW "Thrd1" is a crappy function name.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
The Timer uses a thread, so you needn't use your own as well.
|
|
|
|
|
But using a thread is more programmerish.
The Timer class is for lazy people.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Certainly, but using both at once is nuts.
|
|
|
|
|
Agreed.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
how to serialize a windows form control (binay or xml serialization) ?
|
|
|
|
|
[Serializable]
private System.Windows.Forms.Button button1;
at the form.designer.cs code..
modified on Saturday, January 17, 2009 8:11 AM
|
|
|
|
|
Hi all!
I'm having a problem with checkedlistbox.
At one point I want to update the data associated with the selected item, which is a struct I defined. When I try to do this I get an error:
"Specified argument was out of the range of valid values.Parameter name: '-1'is not a valid value for 'index'"
And then the last item in the list is removed.
CheckedListBoxItem temp = (CheckedListBoxItem)clbFormats.Items[clbFormats.SelectedIndex];
temp.Update = chkUpdate.Checked;
clbFormats.Items[clbFormats.SelectedIndex] = temp;
The thing is that clbFormats.SelectedIndex isn't -1, it's 0 if I add it to the watch window. And if I do that same with clbFormats.Items[clbFormats.SelectedIndex] it also shows the correct, valid values.
And what's even stranger is that this code works if I compile it in VS2005, unfortunately I have to use VS2003.
/Gadjuka
|
|
|
|
|
Why don't you just do this:
clbFormats.SetItemChecked(cblFormats.SelectedIndex, chkUpdate.Checked);
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Thanks for the suggestion, unfortunately that won't work.
The CheckedListBox-items and the CheckBox are independent, but for each ListBox-item I need to remember whether the CheckBox was checked when that item was selected.
That's why I need to be able to update the Data associated with each ListBox-item.
|
|
|
|
|
I truly dislike wasting my time.
When you ask a question here, clearly state all of your requirements in your original message. Finding the answer you want will require at least 30 minutes. Of course, you're a programmer too (or maybe not), and that's how long it should take YOU to work this out on your own.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hello everyone,
Here is my understanding of pros and cons SortedDictionary v.s. Dictionary, am I correct? Or anything important missing? What is your practices of when to use SortedDictionary and when to use Dictionary?
1. Dictionary is faster for insertion and removal, but slower for query value by key compared with SortedDictionary;
2. Dictionary is using a linear array to store key/value pair, but SortedDictionary is using binary search tree to store key/value pair, so for query, SortedDictionary is faster.
thanks in advance,
George
|
|
|
|
|
George_George wrote: 1. Dictionary is faster for insertion and removal, but slower for query value by key compared with SortedDictionary;
Lookups should be the same, both O(1).
George_George wrote: 2. Dictionary is using a linear array to store key/value pair,
But this is store in a special order, determined by the hash value of the key. If indeed the SortedDictionay is using a BST, it will be slower for lookups as it will by O(log n).
|
|
|
|