|
One last question. What if Int64 and long is too short? What I am doing is the following.
I have a list of 100 000 records which are all long numbers and can be upto 11 digits long some of them. Now, I need to calculate a total for them, add them all together. The ansrew I think can be upto 16 digits long but it seems like Int64 only returns 13 digits.
Anyway, I can use something else that would return a much bigger value?
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Christian Graus wrote: Your code is right,
No, its not. Look again!
|
|
|
|
|
I think my problem here is the foreach loop. DO I need to use foreach ? Can I structure this different to not use a foreach loop and avoid it from itterating so many times?
Code again:
long sum = 0;
foreach (imphash hsm in res)
{
sum += Convert.ToInt64(hsm.Field1.ToString());
CalculateNum(sum);
}
}
void CalculateNum(long list)
{
long sum = 0;
for (long i = 0; i < list.ToString().Length; i++)
{
sum += Convert.ToInt64(list);
txtboxdsptxt.Text =(sum.ToString() + Environment.NewLine);
}
}
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Kwagga, this has been answered 3 times now. Im not sure what it is you're not getting about this seemingly simple task. You have a list of numbers as strings, parse each number into an integer (as discussed you may need a bigger integer than int so use long) and sum them.
What your code does:
1) for each number in the list
2) parse it to a long
( good so far but... )
3) send the long to a method which converts it back to a string (list.ToString() )
4) go character by character of the number and convert the original long back to a long (sum += Convert.ToInt64(list); )
( its getting worse... )
5) sum the number again.
For the final time (i hope) the second method is supervlous.
long sum = 0;
foreach (imphash hsm in res)
{
sum += Convert.ToInt64(hsm.Field1.ToString());
}
txtboxdsptxt.Text =(sum.ToString());
|
|
|
|
|
Thanks mate. However,Int64 is not bog enough for the result. Anything else that would be big enough? Int64 only returns a 13 digit number causing it not to calculate correctly.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
iam devoloping both ftp server and client in c# (windows application)
i have two doubts
1. in ftp client when set sslenable=true for security then server receive
"AUTH" command server returns "226 authenticated" then server recieve
some encoded character. my qustion is what is that chracter and which code returns by server
2.when uploading a file asynchronously server receive "OPTS" command
which code returns for this by server
please help me
with advance thanks
|
|
|
|
|
About your first question I am not sure where this information would help you. This is handled by the protocol itself and if there is an error/exception, it would be shown.
However if you still want the information, you can use any ftp client like Filezilla etc and enable tracing capabilities (to create a trace log) which would show you the data sent and received.
For OTPS command, please refer the RFC.
http://apps.mrochek.com/rfc/rfc2389.html#sec-4
~Dave
Dave Traister
Software Engineer
ComponentOne LLC
www.ComponentOne.com
|
|
|
|
|
I have created a service which keep track of c:\program files folder and record all the creation & deletions of in the folder. I have created a setup too to install it, And i know how how to set the service type to automatic and restart the machine, But i want to know the place where the restart code should be placed in the project. means after installation i want the computer to restart itself.
|
|
|
|
|
Write an installer that installs the service and then prompts the user to restart the machine. BTW, you should do everything you can to avoid requiring a reboot. Users hate that.
"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
|
|
|
|
|
i have two forms one fills from datasource
the second form have number of textboxs
i want to copy the text from textboxs on the first form to the textboxs on the second form
i'm using C#.net 2005
regards
|
|
|
|
|
Depending on how many tere are, you can have properties on the form that set the values and set them before showing it, or pass them through on the constructor. It also depends if you want to force your user to provide the values.
If the second form is already visible and you want to set it, then properties or using a delegate are your options
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i tried the following , but it don't work
In Form1.cs:
Copy Code
private Form2 otherForm;
private void GetOtherFormTextBox()
{
textBox1.Text = otherForm.TextBox1.Text;
}
In Form2.cs:
public TextBox TextBox1
{
get
{
return textBox1;
}
}
|
|
|
|
|
Hello everyone,
When use the following XPathDocument Constructor, we can not open the XML file in exclusive mode. Any ideas about how to open an XML file in exclusive mode and using XPath Query?
http://msdn.microsoft.com/en-us/library/te0h7f95(VS.80).aspx
thanks in advance,
George
|
|
|
|
|
Hello,
Is there any way to communicate between a single windows form, and multiple DLLs (being used in form's code...) without using IPC?
Regards,
Adeel
Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks.
|
|
|
|
|
If the dlls are imported into the main app, you can just use delegates.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi all,
I have a datagridview. Currently I am using CellEndEdit event to handler the validation of each cell's value. May i know is there have an another way to do a cell validation ?
Any tips are welcome
regards
cocoonwls
|
|
|
|
|
DataGridView has CellValidating and CellValidated events. You can use them for cell validation.
|
|
|
|
|
Hello, thanks! Is gread!
modified on Thursday, May 15, 2008 2:52 AM
|
|
|
|
|
I am new programming and this is probably a stupid question but, how do you create a new form using a button?
I know I have learned it somewhere but I just simply forgot. Is it something like new Form = formname.Form I can't remember too well. Can anyone help?
|
|
|
|
|
I would recommend reading a beginners book at this point. I assume you don't have one, or you'd be referring to it.
Form1 f = new Form1();
f.ShowDialog();
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
Hi,
please refer me to a sample project (on the web) that is based on 3 layers, and data access code and bussiness code in it be clear.
I want to see a sample data access and bussiness code.
Best wishes
|
|
|
|
|
I think the ASP.NET forum would be the right place to ask this question, but even there, we are here to answer specific questions, not to send people projects. We'd be googling for it, same as you can.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi may i know what is the 0000000 mean?
CREATE PROCEDURE [users_retrieve]
@UserId bigint = 00000000,
|
|
|
|
|
zero. zip. Nada.
It's a default value. 0 would be fine.
In future, we have a SQL forum.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|