|
It seems that he wants to redefine how mathematics works.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
|
Pete O`Hanlon wrote: It seems that he wants to redefine how mathematics works.
Thanks for the chuckle - that might just be the case.
I wanted to give the author the benefit that it might just be a language issue, though.
It isn't enough to do well in life.
One must do good when and where one can.
Otherwise, what's the point?
|
|
|
|
|
double answer;
if(dbNumber == 9.5)
{
answer = 9.05;
return answer;
}
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
The people in the lounge said I should google for the answer to a programming question but I do not know what search engine to use
|
|
|
|
|
ROTFL !!!!
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
Try using this
double d = 9.5;<br />
d = Math.Floor(d) + ((Math.Floor(d) + 1) - d) / 10;<br />
Paras Kaneriya The difference between genius and stupidity is that genius has its limits.
|
|
|
|
|
Hi
I've been searching through multiple articles on this topic,
however,
what I'm not finding is a simple way to count decimals. I simply want to count
how many decimals are in the string, unfortunately everything in regex seems to involve
replacing the decimals...and regex seems really heavy way of doing something that should
be simple.
Any thoughts on this topic?
-----------------------------------------------------------
Completion Deadline: two days before the day after tomorrow
|
|
|
|
|
jgasm wrote: I simply want to count
how many decimals are in the string, unfortunately everything in regex seems to involve
replacing the decimals...and regex seems really heavy way of doing something that should
be simple.
If you know the string always has a decimal:
Int32 decimalCount = text.Split('.')[1].Length
If it doesn't always have a decimal, it gets much more complicated :
Int32 decimalCount = text.IndexOf('.') > -1 ? text.Split('.')[1].Length : 0;
Share and enjoy.
Sean
|
|
|
|
|
Count significant decimal places? This is rather rough:
[System.STAThreadAttribute]
static void Main(string[] args)
{
int d ;
args [ 0 ] = args [ 0 ].Trim( new char[] { '0' } ) ;
d = args [ 0 ].IndexOf ( '.' ) ;
if ( d >= 0 )
{
d = args [ 0 ].Length - d - 1 ;
}
else
{
d = 0 ;
}
System.Console.WriteLine ( d ) ;
}
|
|
|
|
|
Thank you so much for the reply.
However, Sean's answer was exactly what I was looking for.
-----------------------------------------------------------
Completion Deadline: two days before the day after tomorrow
|
|
|
|
|
If you don't need the results of the Split for something else then mine is likely more efficient.
Here it is with the Conditional Operator:
int d ;
args [ 0 ] = args [ 0 ].Trim( new char[] { '0' } ) ;
System.Console.WriteLine
(
( d = args [ 0 ].IndexOf ( '.' ) ) == -1 ? 0 : args [ 0 ].Length - d - 1
) ;
|
|
|
|
|
A similar question was asked in the microsoft.public.dotnet.languages.vb newsgroup two days ago. Here's the code that I suggested, converted to C#, and assuming that the decimal separator is a period:
int pos = text.IndexOf('.');
int decimalCount;
if (pos == -1) {
decimalCount = 0;
} else {
decimalCount = value.Length - pos - 1;
}
It's about ten times faster than splitting the string.
If you want it in few lines:
int pos = text.IndexOf('.');
int decimalCount = (pos == -1) ? 0 : value.Length - pos - 1;
---
single minded; short sighted; long gone;
|
|
|
|
|
Hello All,
My Problem Is I Have A Ledger Which Have Values Like:
jan feb mar april may june july...... dec
Ajay 0 1 2 0 10 8
Anu 0 55 54 88 45 77 ......
...
..
Now These are marks of students in a particular subject for everymonth
Teacher has to enter these marks in the matrix way as i shown above.
I m Unable to FInd ne such control in asp.net
Editable grid doesnt work for me. as i cant fill any garbage data in any table.
Any suggestions? I m in terrible situaton.
Please Help me.
(I m A Novice)
Thanks To ALL
Sanchit Jain
|
|
|
|
|
If the only thing preventing you from using the standard grid is that any old garbage data can be put in it, why not do some client-side or server-side validation of the data?
p.s. this question might be better asked in the ASP.NET forum.
|
|
|
|
|
hi all,
is there a(ny) way to check whether a cell value is empty or not ?
when i try to do (for an empty cell): string.isnullorempty(datagridview.rows[i].cells[j].value.tostring());
i get this error: object reference not set to an instance of an object.
i'd like to know if there is any solution for my problem.
thanks in advance.
MFA
|
|
|
|
|
Try this: string.IsNullOrEmpty(datagridview.rows[i].cells[j].value as string);
|
|
|
|
|
You can use this rather
datagridview.rows[i].cells[j].Text
Paras Kaneriya
|
|
|
|
|
I need to perform an action if I drag to an area outside of the control being dragged from. Namely an error message and a return. I can't figure out how to do this.. help! pleeeeze and thank you
|
|
|
|
|
You could Capture the mouse using theControl.Capture = true. This way, I believe you'll get drag and drop events even if your mouse is outside of the control.
I'm not certain it will actually work, however. Might be worth looking into.
Outside of crazy capture the mouse schemes, I don't know that this can be done within the confines of the .NET framework.
|
|
|
|
|
when the connection is successfully connected (means if only the user logged into the sql server)need to show the message "successfully logged on".
not just the connection opened before the server validate the user.
could any one help me with this..
|
|
|
|
|
MessageBox.Show("Successfully logged on");
|
|
|
|
|
You won't get an open connection if the user (info) is invalid. Or are you seeing something else?
|
|
|
|
|
Our organization is currently developing an SDLC process for managing development projects. Would anyone be willing to share what your organization is currently doing?
What we are looking for is when our development department is approached with a project, we want to first deliver to the requestor an SDLC type statement of work where everything is outlined and the proceedure that we will follow.
Before going throught the hassle of creating ours from cradle to grave I was hoping to see what others have already created?
Thanks in Advance
|
|
|
|
|
fuziononline wrote: Before going throught the hassle of creating ours from cradle to grave I was hoping to see what others have already created?
So your hoping to see our C# implementations of SDLC?
|
|
|
|
|
More specifically I work in a application design department that designs in c#. They have just now decide to provide application development and are now in the process of defining the process that we will use to develop.
I'm tasked with coming up with the SDLC and also the way to document it (i.e. paperwork, statement of work, contract) that we give to the deparment that is requesting development.
|
|
|
|