473,396 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

HUH??! Help badly needed.

Can someone please try this, and tell me what happens, cause either I've got
a weird bug in my VS2003, or I'm going mad...

C#
public void UpdateComments(string customerId, string comment)
{
string firstPart;
string secondPart;
int lengthOfString = comment.Length;
if (lengthOfString >= 200)
{
firstPart = comment.Substring(0,200);
secondPart = comment.Substring(200);
}
else
{
firstPart = comment;
secondPart = "";
}
<... Rest of Method...>
}

Couldn't be much simpler eh?
However if I run this in debug mode, and step through the code, then if my
string is longer or equal to 200 then all is well. IF however the string is
less than 200, the code jumps right over the else part of the method and
carries on with the 'Rest Of Method' code.

Anybody tell me what the **** is going on...?

TIA,
Chris
Jul 21 '05 #1
2 1158

"Chris Mayers" <ch**************@SUEDEYahoo.Com> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
Can someone please try this, and tell me what happens, cause either I've
got
a weird bug in my VS2003, or I'm going mad...

C#
public void UpdateComments(string customerId, string comment)
{
string firstPart;
string secondPart;
int lengthOfString = comment.Length;
if (lengthOfString >= 200)
{
firstPart = comment.Substring(0,200);
secondPart = comment.Substring(200);
}
else
{
firstPart = comment;
secondPart = "";
}
<... Rest of Method...>
}

Couldn't be much simpler eh?
However if I run this in debug mode, and step through the code, then if my
string is longer or equal to 200 then all is well. IF however the string
is
less than 200, the code jumps right over the else part of the method and
carries on with the 'Rest Of Method' code.

Anybody tell me what the **** is going on...?

TIA,
Chris

When I call your method using a short string as the second argument, the
code follows the expected path, into the else. So, you're not going mad,
IMHO. Any other indications that your VS2003 or .NET Framework 1.1 is having
problems? Can we assume the described behavior occurs with any short string
you pass?
A guess at a shotgun solution would be to uninstall, then reinstall the .NET
Framework, as I had to do that recently on a PC that suddenly lost the
ability to find the VB compiler (C++ and C# remained fully functional).

--
Peter [MVP Visual Developer]
Jack of all trades, master of none.
Jul 21 '05 #2
It may just be a debugger problem. Try deleting the binaries (.exe,
..dll, and .pdb) and recompile.

I had a problem where the debugger was seemingly jumping to the wrong
lines or to blank lines and it was because the .pdb file was out of
synch with the exe.

Chris

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Matthew Robinson | last post by:
http://www.houseproudlancs.co.uk/index.new.htm is the worst, can somebody please have a look and tell me where im going wrong? It shows fine in opera, konqueror, mozilla, netscape but not IE. i...
2
by: Gav | last post by:
Hi, I am new to PHP and was just curious, how "fool proof" is PHP against bad code? I.e. is it possible to cause major headaches for the server (infinite loops etc) with bad code or is the PHP...
1
by: Gil | last post by:
This is a question involving CORBA but the problem shows up using Sun C++. The problem doesn't occur with Visual C++ 6. I'm using a string in the following form in my CORBA IDL declaration so...
10
by: Garmt de Vries | last post by:
In an overview of book titles in many languages, which I wrote about in another thread, I've run across a problem with some titles in scripts that are written from right to left, like Arabic and...
5
by: Paul Reddin | last post by:
Hi, using ROWNUMBER() is affecting the plan of a view very badly... is there a way of writing the following view to ensure rownumber() is done as the last thing done? i.e after the calling...
2
by: Sam Samnah | last post by:
I am building a custome control and I need to access the information in the hidden field (HtmlInputHidden HIH) so that when a button is pressed the information in the hidden fields value is...
3
by: Jerome Cohen | last post by:
AI am trying to call a third-party web service. this service expects an XML fragment that contains the request plus other parameter. adding the web reference created the syntax below(reference.vb)....
3
by: Ivonne Riedel | last post by:
Hi everybody, I have got a serious problem building an HTTPHandler in codebehind style. I made the following steps: Create an ASP .net Website project Add a generic handler. Rewrite this...
8
by: Seeker | last post by:
Hello, In using Solaris Pro Compiler to compile Pro*C code. I am getting this error: make: Fatal error in reader: parser_proc_online.mk, line 26: Badly formed macro assignment Based on other...
2
by: na23sh | last post by:
can somebody help me on how to run a visual basic project with a visdata.On a user pc without installing visual basic 6?i have tried the package depolyment wizard but it didn't work?can you help me...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.