For those new to message boards please try to follow a few simple rules when posting your question.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
No advertising or soliciting.
We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
I need to replace every 'a' char with 'b' char, every 'b' char with 'c' char and so on. I've tried to make this with if but code is very very long for every char. Exists a method how mo make this without if or switch or something like that?
You can use the collating sequence of alphabetic and numeric characters to test whether they are in a certain range, and also to increment them to the next character, as follows:
string inputString = "The quick brown fox jumps over the lazy dog";
char chars = newchar[inputString.Length];
for (int i = 0; i < inputString.Length; i++)
if (inputString[i] >= 'a' && inputString[i] <'h') // is it between a and g (lower case only)
chars[i] = (char)(inputString[i] + 1); // yes, add 1 to make it the next letterelse
chars[i] = inputString[i]; // no, copy direct to the output buffer
The default precision to which doubles are printed is different in C++ and C#, so they might actually be the same, can't tell from this. They might also be different, depending on some funny combination of one program being 32bit (and defaulting to the x87 FPU and 80bit computation followed by a conversion to 64bit) and the other 64bit (and defaulting to SSE2 and 64bit computation), I'm not sure if that actually makes a difference here.. If you reinterpret the bits as an int64 and print that we could be sure.
Thank you very much! You are right, having a look at both results as int64 shows, that both results are exactly the same.
Thank a lot again!
More and more I recognize I'm becoming older...
To my shame, I must confess that the above described observations were made only by observing the debugger display.
I think ten years ago I would also have come up with the idea to compare the results binary
It does not solve my Problem, but it answers my question
Back in the day, I wrote a method called AlmostEqual to compare floating point values to a specified precision. I've found that as long as you don't do math on the value, it will remain as it was set, so given the following:
double x = 0.01d;
double y = 0.01d;
The expression if (x == y) will always evaluate to true.
However, if you to this:
x = x * 1.0d
the expression above will evaluate to false.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
Secondly, there's no need for the nested query; just use TOP 1 with an ORDER BY:
using (var connection = new SqlConnection("..."))
using (var command = new SqlCommand("SELECT TOP 1 Balance FROM [Interest Posting] WHERE [Member ID] = @MemberID ORDER BY [Input Date] DESC", connection))
object result = command.ExecuteScalar();
// There is no balance for the member...
decimal balance = Convert.ToDecimal(result);
// Display the balance...
is this a WinForms application?
is the ComboBox using data binding?
which event are you using, and what's inside its handler (please show relevant code).
have you looked at the actual SQL command when it works and when it fails?
are you using try/catch blocks which do actually catch and show exceptions?
did you single-step with the debugger?
i want to resize (Readjust) all of the controls that are belongs to a Form or User Control while i am resizing the User Control or the Form. I already have used from both docking and anchoring , but non of them are working properly. Is there any way to create a class to overcome this. i also searched but i did not get any proper answer.
i will be thankful if you professionals coach me to do it.
Thank you in advance.
Last Visit: 25-May-19 22:55 Last Update: 25-May-19 22:55