Jan Schreuder on .Net

.Net code samples, experiences, observations

View my professional profile on LinkedIn

Recent Posts

Tags

News

  • Inappropriate comments will be deleted at my discretion.

    The information and code samples in this weblog is provided "AS IS" without warranty of any kind, either expressed or implied, including but not limited to the merchantability and/or fitness for a particular purpose.

Community

Email Notifications

Tool suppliers

Tools

General

Microsoft

Favorite blogs

Archives

Posted: by

Comments

Jan Schreuder said:

VB.NET? Bah! ;)
# October 23, 2003 1:43 PM

Jan Schreuder said:

Er is niks mis met VB.Net. Maar dat is een andere discussie. Gelukkig is alles in die documenten van toepassing op C# en VB.Net. ;-)
# October 23, 2003 1:58 PM

Jan Schreuder said:

En welkom hè! :)
# October 23, 2003 4:05 PM

Jan Schreuder said:

is numega niet uitbreidbaar met custom rules ?
# October 28, 2003 8:38 AM

Jan Schreuder said:

Ja, numega is uitbreidbaar met custom rules. Je kunt een compleet eigen database bouwen met code review regels. Zo zitten er bijvoorbeeld heel veel checks in die je uit kunt schakelen. Maar je kan ook zelf expressies bouwen waarmee je jouw eigen rules kunt toevoegen.

Of je dat voor deze check moet doen zodat ook commentaar tussen /* */ als correct wordt gezien is de vraag. Je krijgt dan namelijk zo'n wirwar aan commentaar in je code.

Als je Numega hebt geïnstalleerd heb je in het menu de optie "Mange Code Review Rules". Kijk daar maar eens naar.
# October 28, 2003 8:51 AM

Jan Schreuder said:

Zo had ik eens met Ernst de discussie of je alles na bijvoorbeeld een "if" statement tussen 'curly-brackts' { en } moest zetten. Als je namelijk maar één regel hebt, kun je gemakkelijk zo doen:

if (a == 1)
b = 1;
else
b = 2;

Dat is voor mij makkelijk en volgens mij ook gemakkelijk leesbaar. Maar volgens heel veel coding standards mag dat absoluut niet.

En Numega wil bijvoorbeeld ook dat je je connectie altijd 'conn' noemt. Tenminste, die zag ik snel ff voorbijkomen.

Ik zou die /* */ toevoegen in de rules.
# October 28, 2003 11:36 AM

Jan Schreuder said:

Ik ben het op zich wel met je eens over die if statement, maar Ernst heeft wel een punt. Ik heb het vroeger in C projecten helemaal fout zien gaan omdat mensen vooral in grote procedures niet meer doorhadden wat nou wel en wat nou niet bij de "if" hoorde. Zelfde geldt natuurlijk voor "while...", "for ...", etc. Zodoende ben ik een voorstander van curly brackets bij al die statements. Safety first...

Niet iedereen is zo oplettend als jij en ik :-)

Vind wel dat er toch wel een minimale set van code standaards moeten gaan komen. Die hoeven dan niet al te dwingend voorgeschreven te worden, maar kunnen dan wel als basis dienen voor een eventuele review van je eigen of andermans werk.
# October 28, 2003 11:45 AM

Jan Schreuder said:

Punt 1, wat dacht je van hungarian casing? :)

Punt 2, wat dacht je van :

string myString = null;

Mogelijk in whidbey! Worden we nu blij of niet?! ;)
# October 29, 2003 2:53 PM

Jan Schreuder said:

Gaan we doen voor de SIG!
Ik heb ooit al eens een geweldig document gezien, wat ik nooit meer kan vinden, maar ik ga het toch proberen.

Daarnaast gaat óf DevParter óf FXCop gewoon de waarheid vertellen over je code! ;)
# October 29, 2003 2:54 PM

Jan Schreuder said:

Punt 1. Dat is het ook, volgens mij. Of ik heb het mis?

punt 2. Kan nu ook al. Alleen is null iets wezenlijk anders dan string.Empty. Dat is namelijk "".

Misschien had ik een ander voorbeeld moeten nemen, bijvoorbeeld een integer.
# October 29, 2003 3:04 PM

Jan Schreuder said:

gelukkig helpt de c# compiler ons met dit soort fouten. Je krijgt gewoon een warning in je tasks.
The variable 'strTest' is assigned but its value is never used
# October 30, 2003 9:06 AM

Jan Schreuder said:

Ja, dat is als je wel een assignment doet maar verder de variabele niet gebruikt. Maar dat is minder fout dan wanneer je de variabele niet assigned. En je krijgt een warning, niet meer. Tenzij je aangeeft dat warnings als errors gezien moeten worden. Wat in sommige gevallen ook de betere optie is.
# October 30, 2003 9:10 AM

Jan Schreuder said:

oh, ik had een andere foutmelding verwacht....

is alleen met andere objecten dan met string geloof ik......

# October 30, 2003 9:11 AM

Jan Schreuder said:

ja, het is met andere objecten dan string
dan krijg je de warning:
Use of unassigned local variable 'test'
# October 30, 2003 9:29 AM

TrackBack said:

# March 11, 2004 8:11 AM

TrackBack said:

# March 16, 2004 12:31 PM

Jan Schreuder said:

Is it possible to create a calculated field for it.

Otherwise reload the grid grouped from the database.....(With a Calculated filed in SQL)

Or

CReate a new datatable grouped as you want and ordered as you want and bind that to the grid....

# March 16, 2004 3:35 PM

Jan Schreuder said:

Nope, calculated fields cannot be used. The problem lies in the fact that the row id that is available in the event is the row id of the group being opened. What you need is an absolute row id for the row that will be displayed.
# March 17, 2004 7:49 AM

Jan Schreuder said:

if (ConditionA && ConditionB && ConditionC && ConditionD)

Nog leesbaarder, minder code, zelfde effect.
# March 17, 2004 12:42 PM

Jan Schreuder said:

Depends on the conditions. When you call functions that return a true/false value and that contain a number of parameters, the suggested line of code would be extremely long ;-)

And && doesn't work in VB.Net, And does..
# March 17, 2004 3:46 PM

Jan Schreuder said:

WHAT? VB.NET SUCKS! ;-)

In VB.NET it's AndAlso, or something like it.
And when I call a lot of methods (with parameters, if you will) in an if statement, I'm not really making readable code. Not even in the DO loop you present.

Normally I declare some variables, run the methods and let them return their value into my variables. Then I check this inside my if statement. That's also much more handy when debugging. I hate going inside methods because I need to know it's return value, but I used the method somewhere, where I don't return it into a variable. This way solves it all! ;-)

But this is probably another great example of those 'coding standards' discussions, where everybody likes their own ways best. Again I say, such things don't belong in coding standards, let the developer decide for themselves. The only thing you can do, is present them with the alternative options (like I do now) and maybe the other developer(s) like my way better and decide to use it. I seriously doubt it, but who knows! ;)
# March 17, 2004 8:12 PM

Jan Schreuder said:

Performance isn't an issue here if the if is false the entire tree wont be parsed.

Other then that I find the second code example les readable.

not indenting in functions / if's = not done

also supplying your conditions in as few if's as possible is usually best.

with a simple line of comment above it.

# March 18, 2004 12:52 PM

Jan Schreuder said:

As Dennis rightly stated, it's a matter of taste. Let's just say that in the project I work in now, there have been a few situations where my original posting improved the readability of the code. However, you have to use it with care, just like any other type of code constructs. I just love these discussions :-D

Dennis, perhaps code standards is a nice discussion item for the next SIG?


# March 18, 2004 3:25 PM

TrackBack said:

# March 18, 2004 3:27 PM

Jan Schreuder said:

Maybe indeed so. Create a guideline we can all agree on, or at least at some level. And handle one or a few things at a time. I'm taking it in consideration!
# March 18, 2004 7:44 PM

Jan Schreuder said:

Ziet er aardig uit maar is het gebruik van een <a href="http://www.codeproject.com/cs/miscctrl/maskedcsedit.asp">textbox met een regular expression</a> niet handiger en meer van deze tijd?

# March 19, 2004 10:39 AM

Jan Schreuder said:

Waarom ziet mijn bericht er weer eens niet uit?
Kan dit forum niet een HTML editor implementeren...!?
# March 19, 2004 10:40 AM

Jan Schreuder said:

Regular expressions are usefull. But the RegularExpressionValidator is a webcontrol and I'm building a normal Windows Form application. Don't really want to use a web control there...
# March 19, 2004 11:01 AM

Jan Schreuder said:

The example I posted in het URL is a winform example as well...

Let me try to get it right this time:
http://www.codeproject.com/cs/miscctrl/maskedcsedit.asp
# March 19, 2004 11:08 AM

Jan Schreuder said:

@Ernst: First of all, this is not a forum, but a weblog.
Second, when you allow your visitors to post HTML, they are going to totally screw up your layout, intended or not.
# March 19, 2004 12:39 PM

Jan Schreuder said:

ok, ok, ok, don't shoot me ;-0
# March 19, 2004 1:06 PM

Jan Schreuder said:

Does this occur in C# as well or is it a VB.NET feature?
;-)
# March 24, 2004 5:53 PM

Jan Schreuder said:

I have no idea... I never do WinForms and in ASP.NET I never touch the wysiwyg editor. I do everything by hand, the controlfreak that I am! :)
# March 24, 2004 8:11 PM

Jan Schreuder said:

This happens in c# as well :-(
# March 25, 2004 2:26 PM

Jan Schreuder said:

Yep I also read his article. It is very interesting. Not only for the memory leaks topic but also for numerous examples on how to use databinding in a pratical way. Did you see the sort of undocumented feature on the use of 'navigation paths' when binding to a datagrid?

tip: read the summary of best practices at the end.
# March 31, 2004 4:56 PM

Jan Schreuder said:

Yeah, I did. I really enjoyed reading this one!
# April 1, 2004 10:24 AM

Jan Schreuder said:

first, your layout screws up on my computer. winxp with ie6.0, latest patches.

second, ofcourse you can do the @@identity. :)

third, it's hard to believe it takes such a long time, compared to the integers. I'll have to test this myself. Did you use auto-primary keys for both or not?
# April 13, 2004 9:19 PM

Jan Schreuder said:

I can understand it's hard to believe, but I have the code and database here to prove it. But as Patrick already stated, you can must test with large numbers of rows.

I had the application run the same tests over night on 30.000 rows in the parent table. So in total 330.000 rows were deleted and inserted. The same test ran for one hour on the table with guids and 29 minutes on the table with bigints.

Index parent table:
ObjID BIGINT Identity.
PK = ObjID clustered

Index child table:
ObjID BIGINT
RowID INT
PK = ObjID + RowID, clustered

One last comment. My application is simulating an existing process. So next to the inserts, there are also selects on these tables during the entire process. But as these selects are used in both versions, they have no influence on the conclusion. In fact, even if you could prove that inserting the data is equally fast on both tables, then I will argue that a select on tables with guids is slower.
# April 14, 2004 8:13 AM

Jan Schreuder said:

Funny people really dont want o believe...

1. A specialist who say ..... IT IS LIKE I SAID
2. A Programmer who experienced it in real life......

But that is not why I wanted to respond in the first way.
Like dennis said you are using the @@identity thing....

Never do this use scope_identity ( Look around in the books online for this ) instead.
If some moron decides to add some audit triggers to your table, the @@identity will return the identity of the Audit table, while scope identity will return the identity used in your scope......


hth....

Patrick
# April 14, 2004 8:48 AM

Jan Schreuder said:

my namespaces

vs

refactoring support

---

In vs.net 2005 anyways :)
# May 11, 2004 3:02 PM

Jan Schreuder said:

I had to look twice to really understand what this means :

Verdict: I'll give this one to C#, but given that these operators increase brevity at the cost of readability, you can make a case that their lack in VB.NET should really represent a win for VB.NET.


So, only if you agree with short unreadable code it is a win for C#....
I thought an advantage should always be an advantage....

So this one goes to VB.NET.

With .NET
C#.Sucks
VB.Rulez
End With




# May 12, 2004 9:33 AM

Jan Schreuder said:

Ultra Cool!

Now I can finally listen to my 300+ cassette tapes lying in my attic!

My wife will be pleased to hear she cannot throw my 20-year old tapes away because I'm gonna listen to them all over again ;-)
# June 2, 2004 2:56 PM

TrackBack said:

# June 2, 2004 3:16 PM

Jan Schreuder said:

Cool.
I immediately tried it at some sources on the project I'm currently working on and got some nice results.
Pitty though that it crashes at three of the projects I have in my solution. Maybe they are to complex to analyze? 8-)
# June 9, 2004 7:51 AM

Jan Schreuder said:

Rutger,
Glad to hear you like the results from devMetrics. We have been quite surprised by the demand and activity around devMetrics. Anticipating Minds created devMetrics as an internal tool to help manage our software and decided to share it with others.
Although it is free, we plan to support it with the level we support our other products. With that in mind, any additional information you can provide with respect to the error you had would be very helpful to us and others. If the failed projects generated an error report could you please send it to us? If there is an error report, there will be a link to it at the bottom of the project report. If that is not the case, can you please provide any information possible regarding the project that failed – noting any special characteristics or just sending the project files by itself (no code) would be very helpful. Please email the information to support@anticipatingminds.com


Thanks in advance.
Anticipating Minds Support

You can send any questions or issues to support@anticipatingminds.com or post anonymously to our forums for devMetrics at…
http://www.anticipatingminds.com/Forums/ShowForumGroup.aspx?ForumGroupID=5
# June 9, 2004 9:34 PM

Jan Schreuder said:

The only difference is that DevPartner is analyzing the runtime behaviour of your code (code coverage/time) opposed to this static code analyse. They both have there place.
# June 17, 2004 8:50 PM

Jan Schreuder said:

I'll give this a look. It looks very cool.

I have been using a different tool - for free, from http://www.1bot.com. It provides lots of metrics on .Net Dll's. It is called Vil. I have not had any problems with it, and it produces nice HTML reports. It is not fancy, but it is free!
# June 28, 2004 7:00 AM

Jan Schreuder said:

Hm....
Why does this leak memory? There's no resource allocation... is there?
# July 15, 2004 9:19 AM

Jan Schreuder said:

No, there isn't. At least, not by the code. But the framework does allocate memory to handle this. And I assume that's where the problem is.
# July 15, 2004 9:21 AM

Jan Schreuder said:

This article could contribute a bit more one componentOne TrueDB Grid.

http://dotnetjini.jigneshdesai.com/dotnet-whidbey/ShowArticle.aspx?ID=5


Regards,
Jignesh Desai.
# August 5, 2004 10:21 AM

Jan Schreuder said:

Last week I started using DataGrid more seriously. I needed the know the row that the user clicked on after the event CurrentCellChanged. I found the same solutions you describe using Google. In fact, it has been documented many times.

Please note that you need to test if the bm.Position against bm.Count when you allow editing of the table shown in the DataGrid. The members of type string in the new row will be null.
# August 26, 2004 9:11 PM

Jan Schreuder said:

You are correct on checking the position. I will add a new version a.s.a.p to make sure we have that covered too. For me the solution described here worked fine because I don't allow editting in the grid :-)
# August 26, 2004 11:22 PM

Jan Schreuder said:

I know even a GOOD C# has to tweak some vb in it's app to make it work
# August 27, 2004 7:11 PM

TrackBack said:

# August 27, 2004 7:20 PM

TrackBack said:

# August 27, 2004 7:23 PM

Jan Schreuder said:

Have not browsed that assembly yet with Reflector but if those methods use exceptin handling for testing if a specific object's string representation is representing a date, number, boolean and other datatypes then using it is really no option.

using exception handling for input checks == BAD :-)

Exception handling kill's performance especially when you are validating a textfile that contains a million lines containing 15 columns each to be validated this way.
# August 31, 2004 11:04 AM

Jan Schreuder said:

I agree that Exception handling slows things down. The point I'm trying to make however is to use the standard VB.Net checks in your C# project. The internals of the assembly are not relevant to me. I'm just happy I don't have to implement them myself.

I also agree with Duncan McKenzie (who pointed me in that direction) that it is likely that the checks in the VB.Net assembly are likely to be better than one you create yourself using exception handling. I also hope that MS will have made sure it's performs well enough.
# August 31, 2004 11:11 AM

Jan Schreuder said:

Well For what it's worth.....

I like VB better, but that is only because my typo's are corrected.

Furthermore holding the shift key works great in Biztalk Projects as well. This can be very handy when you have to target another biztalk server. Or another SQL server.
Just select everything in the project explorer and modify the properties........

I wanted to tell Dennis this as well. but he disabled the comments and that was really UNCOOL.....

It's really typical that if you don't like some thing (like VB) you blame it for everything.....
# September 8, 2004 1:34 PM

Jan Schreuder said:

Visual Studio .NET 2005 (aka "Whidbey") should fix all those rename annoyances. Just right click on a variable, class, namespace, method or whatever and use the new Refactor menu-item.

I don't agree with Jan that VB.NET and C# will grow to be more alike in Whidbey. C# will have iterators, anonymous methods and more refactoring options. VB.NET will have Edit & Continue and the new My classes that will speed up development.

I haven't tried this yet, but maybe if you can stand having a "using Microsoft.VisualBasic.MyServices;" line in your C# program, you can use the My classes in C# as well :) But the VB.NET IDE will probably have much better support for them.
# September 8, 2004 8:15 PM

Jan Schreuder said:

There will still be differences between C# en VB.Net. But there will be features currently available in C# that will be available in VB.Net. For example XML comments.

And I don't mind have a "using Microsoft.VisualBasic.MyServices" in my C# application. Already have a "using Microsoft.VisualBasic" in my C# code, which allows me to use the Location class that contains functions like IsDate and IsNumeric.
# September 9, 2004 7:31 AM

Jan Schreuder said:

I also mis a c# like feature as the VB With keyword. Sometimes it makes it much easier to initialize objects. But i don't like it that the language allows you to do things like


With myCoolObject

If ReallyCoolMethodCool Then
.CoolMethod()
Else
Select Case(.CoolProperty)
Case a:
.Data = .....;
Case b:
.Data = .AnotherCoolProperty & "blaat";
Case c:
.Data = .....;
End Select
End If
End With


I don't mind having the With statement used for method calls and assignment. But I think it shouldn't be used for things like in the Case b example.

I think that could be the reason why c# doesn't have this keyword (or a similair one) and because the With block can contain a lot of nested scopes that will not endorse readability :)

And as I wrote in the beginning. Normally only usefull for initialization. But initialization should be done primarily by using the constructor. But that's just my opinion...
# September 9, 2004 12:33 PM

Jan Schreuder said:

I came across a quote that was too good to control myself by not posting it :) Of course I cannot post it to the new LogicaCMG .NET community because as the moderator I am completely unbiased there :)

Edsger Dijkstra: "It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration." (http://en.wikiquote.org/wiki/Edsger_Dijkstra)

But hey, I started programming using MSX BASIC so there is no hope for me as well...
# September 11, 2004 12:19 AM

Jan Schreuder said:

How about the very simple:

If ConditionA AndAlso _
ConditionB AndAlso _
ConditionC AndAlso _
ConditionD AndAlso _
ConditionE Then

'do something

End If

There's no complex nesting, it doesn't take as much vertical space, its just as efficient as the nested version (AndAlso does shortcircuiting), doesn't need a jump statement (eg Exit Do) and reads pretty OK. :-).
# September 14, 2004 7:33 PM

Jan Schreuder said:

Well, since you started on MSX, that's a whole other story! The best, the coolest, the smartest, the best looking people come from MSX! Yay!

And Ramon, you're right when you say initialization should be done in the constructor! Thank you!
# September 29, 2004 11:04 AM

Jan Schreuder said:

Can't really remember me stating that initialisation should NOT be done in the constructor. But since the subject was brought up anyway. Obviously that will only be done for class wide variables
# September 29, 2004 11:14 AM

Jan Schreuder said:

"Well, since you started on MSX, that's a whole other story! The best, the coolest, the smartest, the best looking people come from MSX! Yay! "

Always nice to have your ego stroked :P

* also started on the msx *
# October 6, 2004 1:51 PM

Jan Schreuder said:

The keyvalue is not really nessesary...

You can define aDatakey in the dataset itself.
then you can do something like :

While icount < DataGrid.items.count
if datagrid.DataKeys(iCount) = myID then
datagrid.selectedindex = icount
return true
end if
iCount = icount +1
End while
Return false

If you consequently set the datakey of a datagrid you never have to worry about a thing.

Th enice thing about a datakey is havint to thing about your dataset and really give them a neat PK
# October 7, 2004 10:21 PM

Jan Schreuder said:

Cool, I started programming on the ZX81. But more cool stuff on the MSX, it simply had the best Basic at that time.

But I hate the fact they really starting to treat C# differently from VB.Net. But I guess C# will be leading when it comes to new programming language concepts as seen in Xen (or however they call it nowadays).

But the discussion about which language is the best is really annoying sometimes. Damn I already have to fight those #$%@ J2EE/Java hackers on a daily basis. I don't wanna start bashing al those C# or VB.Net (depends on which side of the discussion I'm on ;) )
# October 8, 2004 1:19 PM

TrackBack said:

S dot One heeft het over .NET &raquo; Waarom C# vs VB.Net?
# October 8, 2004 1:24 PM

Jan Schreuder said:

If you run in VB.Net, then Yes, this will also work. But try this in C#, I haven't found it yet.
# October 14, 2004 4:58 PM

Jan Schreuder said:

It's really a pity that the "C# programmers don't do that" prevents MS from including those work speed enhancements from the VB editor like intellisense on any character, not only the period and automatic right-casing words into the C#-Editor. Why should a C#-writer should not love those ? I agreee that VA does a grat job, but part of it should have been done already by MS...

Guenter
# October 26, 2004 12:51 PM

Jan Schreuder said:

Klinkt goed, ik zal het binnenkort ook eens gaan proberen :)
# October 27, 2004 12:26 AM

Jan Schreuder said:

Maybe the crash was because of Visual Assist ?
i never have problems pinning whatever window somewere
# October 27, 2004 8:29 AM

Jan Schreuder said:

Well, it also happened to me before I installed Visual Assist, so I don't think it was because of the new tool. But it's a useful feature.
# October 27, 2004 10:04 AM

Jan Schreuder said:

Are you saying that the datagrid has datakeys in VB.Net and doesn't have them in C# ??????
# October 27, 2004 1:20 PM

Jan Schreuder said:

Yes, I do. The dataset connected to the grid has a datakey. Which you will need to add, by the way. But the datagrid itself does not have that property.

The procedure I created however can be used to check on any column you want, not just key column(s). And that was pretty usefull in my project. It also makes sure only rows visible in the grid are searched by filtering the dataview. This is not necessarily the case when you search the dataset itself.
# November 3, 2004 2:56 PM

TrackBack said:

# November 4, 2004 2:04 PM

Jan Schreuder said:

It must be me but I really don't see what the problem is...?
What am I missing? As far as I can see this is simple and straightforward DHTML...
# November 4, 2004 5:27 PM

Jan Schreuder said:

Not only that, but there's no other solution. You can probably also use VBScript, but that's no solution as only IE supports that, as far as I know.

People complain all the time Microsoft is adding features to CSS/HTML/whatever which other browsers don't support. Seriously, how could Microsoft ever provide another feature then javascript?
# November 4, 2004 8:01 PM

Jan Schreuder said:

It is simple and straightforward, Ernst. I know. But when you've never done this before, like the friend I was helping out, you don't get a clear picture. And for myself, I hardly do ASP.Net projects, so I tend to forget how it's done. That's why I posted this, so I never forget.

But there is another solution, Dennis. Check out the following link: http://www.dialog-box.net. A commercially available DialogBox component for ASP.Net.
# November 4, 2004 9:46 PM

Jan Schreuder said:

.Net solution for this:
http://www.metabuilders.com/Tools/ConfirmedButtons.aspx

Way easier to implement :P
# November 5, 2004 1:12 AM

Jan Schreuder said:

Hmm these get squished by my popup blocker and don't work here.

The solution I posted at the original post has worked for me in all situations and is a pure FREE .NET solution.
# November 5, 2004 1:15 AM

Jan Schreuder said:

Yep, seen that one too. And it's freeware :-)
# November 5, 2004 7:31 AM

Jan Schreuder said:

Ok, whats new here?
# November 5, 2004 9:49 AM

Jan Schreuder said:

Nothing's new here. It's just that I forget this stuff not being involved in ASP.Net projects too often.
# November 5, 2004 9:53 AM

TrackBack said:

# November 5, 2004 1:52 PM

TrackBack said:

# November 5, 2004 1:54 PM

TrackBack said:

# November 5, 2004 2:00 PM

TrackBack said:

# November 8, 2004 7:35 AM

Jan Schreuder said:

Looks usefull thanks :)
# November 8, 2004 1:02 PM

Jan Schreuder said:

Using Try Catch for this kind of functionality is an absolute performance kill. if you really want to do it that way, use functions such as [bool Double.TryParse(String, out double)] (same for all other types), which return true if the conversion is successful. It's a much better approach.
# November 29, 2004 11:40 PM

Jan Schreuder said:

I know Antonio. The argument I was trying to make here is to use methods that are available to you. In this case, there is a Microsoft Visual Basic method which you can safely call from C#.
# November 30, 2004 7:40 AM

Jan Schreuder said:

here's an other approach.This one is most of the time a little bit slower than yours. Only when calculating more than ~2000 times this one is faster:

private int CalculateWorkDays(DateTime begin, DateTime end )
{
if (begin.DayOfWeek == DayOfWeek.Saturday)
begin = begin.AddDays(2);

else if (begin.DayOfWeek == DayOfWeek.Sunday)
begin = begin.AddDays(1);

if (end.DayOfWeek == DayOfWeek.Saturday)
end = end.AddDays(-1);

else if (end.DayOfWeek == DayOfWeek.Sunday)
end = end.AddDays(-2);

//calculate the amount of days between 2 dates
TimeSpan subtraction = end.Subtract(begin.Date);
int days = (int)Math.Ceiling(subtraction.TotalDays);

int weekendDays = 0;
if (days>7)
{
// calculate the amount of days that fall in a weekend
weekendDays = Convert.ToInt32(days / 7) * 2;
}

return days - weekendDays;
}
# December 1, 2004 10:18 AM

Jan Schreuder said:

I presume national holidays are not an issue?
# December 2, 2004 2:22 PM

Jan Schreuder said:

Indeed, they're not. This just to make sure weekends are not used in calculations I had to create. When you have national holidays, you need to do some extra work. You could use this method as a start though :-)
# December 2, 2004 2:28 PM

Jan Schreuder said:

I am not interested,
i already code in VB so i don't have to convert...... :)
# December 10, 2004 1:15 PM

TrackBack said:

# December 10, 2004 2:10 PM

Jan Schreuder said:

The programmer probably had no comment to that ;-)
# January 25, 2005 11:24 AM

Jan Schreuder said:

Well... I know why he probably did this :)

He had a public method. Public methods require XML documention comments (if you configured your project to do so). When you comment the public method the XML documentation will generate an error. So then you set the method in comment with its XML documentation tags.

The same for getting a certain coverage level. You can remove it and rely on your repository when you would need it again in the future or just put it in comment.

Nothing wrong with that. Probably someone else decided to add the method again but forgot to uncomment the XML document tags :)

That is why I would LOVE a keyword that just wont include the method when compiling.
# January 25, 2005 11:45 AM

Jan Schreuder said:

A valid explanation, but that hits on another issue. You usually have Source Safe, or another source revision tool. So why comment methods and leave them in the code. If it's not used, it's not supposed to be there.

# January 25, 2005 12:35 PM

Jan Schreuder said:

Did you ever figure out why it was freezing when you did this?
# January 26, 2005 6:26 PM

Jan Schreuder said:

Excellent bro; You saved me a hotta hassel. Sometimes the simple solutions are the hardest to devise.
# March 1, 2005 5:25 PM

Jan Schreuder said:

I highly doubt this would've been caught in a code review. Perhaps when you're doing pair programming, but not when you're just looking at the code.

And you might want to make sure you're not creating unnecessary transactions or add a lot of reads to your transaction. Transactions can/will lock your table/rows when reading, until the transactions commits or rolls back.

And reading is what you're doing here.
# March 15, 2005 2:26 PM

Jan Schreuder said:

If this was not found in a code review, then the review was not done properly. Code review is not 'looking at the code', it is inspecting the code to see if it is functionally and technically correct.

I will agree that not all errors will be found in a code review. That is not what a code review is intended to do, because it is nearly impossible to do so.

The point I was trying to make was that code inspections could have trapped this problem. Even if you only find 50% of these problems, you cannot deny the fact that if you can find and solve 50% of these problems before they reach the end-user, your overall product quality has improved.
# March 15, 2005 3:00 PM

Jan Schreuder said:

I've managed to use the VB.NET version above (translated to C#) and, at first glance, it works fine. In my grid definition I have:

[code]
<asp:datagrid id="dataGrid" runat="server" datakeyfield="item_id" .....
[/code]
and I call the following code after I bind the grid:

[code]
int icount = 0;
while(icount < grdEmails.Items.Count)
{
if((int)dataGrid.DataKeys[icount] == ema_id)
{
dataGrid.SelectedIndex = icount;
break;
}
icount++;
}
[/code]

Can anyone see any problems with this?
# March 15, 2005 3:50 PM

Jan Schreuder said:

You close the connection before using the returned IDataReader? Are you serious?
# March 15, 2005 9:12 PM

Jan Schreuder said:

It seems indeed your change is wrong. I agree with Roland you should not close your connection when returning the IDataReader (so in the case when no exceptions occur) because this closes the IDataReader. Remember code in the finally block runs in all cases. So the connection should only be closed when an exception occurs, as in the original code.

But I spot another problem. In general, catching Exception is bad practice. Rethrowing it with "throw ex;" even more so. That way you loose the call stack information up to that point. If you must rethrow, do it without specifying the Exception object. Just say "throw;". That way the call stack in the Exception object is not reinitialized.

In general "catch (Exception ex)" is considered bad practice because do you really know how to handle an OutOfMemoryException or an ExecutionEngineException gracefully? When these exceptions occur no code can reliaby run anymore.

In this case catching the base class Exception might be justified because you really want to try to close the connection.

But you really should enclose the "connection.Close();" in another try block and ignore any further exceptions with an empty catch block, because this statement might throw another exception. If "connection.Close();" throws, you loose your original Exception object. According to the MSDN docs the Close method for SqlConnection method throws a SqlException when the connection could not be opened.
# March 16, 2005 12:12 AM

TrackBack said:

# March 16, 2005 2:29 AM

Jan Schreuder said:

You're right, closing the connection closes the reader. So I introduced a bad fix here. I was mislead by the NUnit tests for this procedure which, as I found out this morning, always opened the connection before calling the procedure. So I did a rollback for that change.
# March 16, 2005 8:10 AM

Jan Schreuder said:

Another proof that what you want to achieve with code reviews doesn't work. Many developers have looked at the code and Roland is the first to notice that you broke the code!
# March 16, 2005 8:19 AM

Jan Schreuder said:

No Dennis, this is actually the proof that code reviews work. You've now looked at the code and found a problem. So did Roland and Erwyn!

Yes, I introduced a new problem in the code. If someone had reviewed my work, this would never have happened.
# March 16, 2005 8:21 AM

Jan Schreuder said:

Come on Jan, give up! :)

I've never read any document or seen any company where code reviews are done by 10 people or more!

I see this:
- One guy (or girl) creates the method
- Jan reviews it, brakes code

Code is in producten, áfter code review
# March 16, 2005 8:30 AM

Jan Schreuder said:

I've closed the comments on this item. But you can still express your views on code inspections.

I'm not giving up, Dennis.
# March 16, 2005 8:39 AM

Jan Schreuder said:

Jan,

I have to agree with you. I think well conducted code reviews can lead to a better product/project.

The fact that your example was erronious doesn't prove anything (sorry, Dennis).

Code reviews are a two-bladed sword: the quality will go up and the person who made the code that is reviewed will learn from the comments.
In fact, even the reviewers might learn something.

"One comment even said that he'd never seen documentation on the subject or large companies using this method."

True, at my company, code reviews aren't standard practice. But that doesn't mean it's not worth doing... duh ;)

We all know that we, as developers, can learn from each other, so why not use code reviews to do exactly that and at the same time, increase quality...
# March 16, 2005 1:24 PM

Jan Schreuder said:

I also agree that code reviews are a good thing and should be recommended practice.

I recently caught two serious errors in the use of ASP.NET SessionState doing code reviews. Both on an internal project and on a client project. Just by looking at the code you could tell the same session state was shared by all users due to misuse of the singleton pattern. One of the developers wasn't convinced that it was wrong even after I explained why it would go wrong. He said they had tested the application with two simultaneous users. I said I didn't believe that and challenged him to start two browsers on two different computers. Seeing the flaw in action quickly convinced him though.

Luckily the fix was easy to implement in both cases.
# March 16, 2005 11:46 PM

Jan Schreuder said:

Manual trackback:
http://www.rolandboon.net/WSBeanRSS/Weblog.aspx?day=2005-3-16/1

Jan posted a strange example to get us talking about code reviews. He retracted the example, and suggested to discuss to the topic without the aid of an example.

Here is my two Euro cents.

Code reviews (inspections) help to produce better quality software product.

About four years ago, I participated in a project that used code reviews on a regular basis. This project was modest in size. Only the two guys who wrote C++ code (one of them being me) had to undergo code reviews. The person conducting the code reviews had used this technique before on projects much larger in scale. The reviewer wasn't on the payroll for our project, but helped us out for the shear love of the art of technical software engineering. No kidding.

The reason why we wanted to have code reviews was that "failure was not an option". The application would be published on a government web site, the available time too short, and the deadline fixed, the press conference scheduled, etc. We wanted to prevent introducing bugs with code reviews and find the ones not caught by rigorous regression testing.



And it worked. We made the deadline, and not a single bug fix was requested. After a year, new functionality was added, the application released, and again not a single bug fix was requested. In fact, three years after its release, the same version of the application can be downloaded from the client's website. [Sorry, I cannot provide a link for this one. E-mail me if you don't take my word for it and want a hyperlink as proof.]

Was it easy? No! It was hard work.

We found out that my colleague wrote C style C++. This meant a drastic reassignment of tasks. Also, I had to learn to adhere to coding standards and not be argumentative about issues found in a code review. And the route to release wasn't easy. There were nasty bugs and shortcomings in the software library which we used as a baseline for the project. But we found them, mostly by thorough and lengthy debugging sessions.

The extra time needed to talk about coding details was precious. The result is that one is a bit more careful when writing code. That pays off big time in the long run. Still, I attribute the success of the project for most to the skills of the team of professionals assembled for this project and the excellent input and test effort by the client. The code reviews helped, I have no doubt about that. But it isn't a tool that makes one a super programmers overnight.

Jan,

The example you gave was seriously flawed. During a debugging session you misinterpreted the meaning of the wording in the code. That led you to make an incorrect 'bug fix'. This all has nothing to do with a code review. You provide the correct references, talk the talk, but you cannot do the walk.

How did I catch the incorrect 'bug fix'?

I looked at the structure of the code. Instinctively, it looked funny to me, still does. First, the 'framework' consists of functions instead of methods. Next, one function simply passes along all the parameters to another function that does all the work. Finally, there was no symmetry; if you open a connection in a function, you need to close it in that function. The output parameter mustCloseConnection is bad design. And then there was the indent of 'throw ex' after the 'if' statement with the connection.Close() on the same line. I also noted that the original version does not return statement under the catch block. I seriously dislike the return statement inside the try block.



I started to think how to repair this code. At the very first, the mustCloseConnection parameter needs to be returned by ExecuteReader as well. Then I thought that PrepareCommand() should create the IDbCommand instance and should Debug.Assert that the connection is opened to begin as a pre condition and dump the mustCloseConnection thingy.

Only after all of these and other observations did I start to think if it was correct to close the connection and still use the reader.

# March 17, 2005 12:15 AM

Jan Schreuder said:

I admit that the example I provided was seriously wrong. I completely missed that the reader would be closed when the connection is closed. The NUnit for that method didn't test for that, and wrongly assumed the NUnit test was correct.

I didn't retract the post. It's still there, I only stopped people from adding comments to it. A link to that post is even in this post to which Roland responded.

I feel code inspections can play an important part in software development. That is why I started this new post. I want to get people's opinions on code inspections, rather than be viciously attacked for giving an example that contained an error. Saying I talk the talk, but cannot do the walk is a bit nasty, don't you think?

As you state, it is important not to be argumentive about issues found in your code. We developers all think we're the better than everyone else and most don't like being pointed at their mistakes. I've learned to accept that I make mistakes. If you look at the original post, you'll see I correct the erroneous code examples and also admitted to the mistakes.

I provide the correct references because I used them on several occasions. I've been moderator in formal code reviews at my previous employer, and my code was also reviewed on a regular basis. In some projects at LogicaCMG I worked on, I've also had my code reviewed. In some I've introduced formal code reviews to help improve the overal quality of the code. In all the code inspections I was part of, we've found serious problems which were then fixed before they went to a live product.

And you're right. It's not the magic solution to all your problems. It will never make you a super developer. Code inspections are a tool, just look FxCop, NUnit, etc. Using these tools are also no garantuee for writing bugless code, but we use them nonetheless to help us improve the code. And I think code reviews should have a place in that process as well.
# March 17, 2005 8:56 AM

TrackBack said:

# March 23, 2005 3:48 AM

TrackBack said:

# March 23, 2005 3:48 AM

Jan Schreuder said:

A bit off-topic, but why the try catch block when all you do is throw?
# April 14, 2005 4:07 PM

Jan Schreuder said:

I was about to ask the same thing as Ramon...
# April 14, 2005 6:15 PM

Jan Schreuder said:

Point taken. I removed it, as you can see :-) It was there, because the example was based on existing code I found in one of the webservices I was working on. Forgot to remove all for this topic.
# April 14, 2005 8:55 PM

Jan Schreuder said:

Hi Jan,

that's a nice list! But the link for Regulator is wrong, I think. It's the same as that for .Net Reflector, but Regulator can not be found there.

I think the link should be http://regex.osherove.com ??
# April 15, 2005 11:26 AM

Jan Schreuder said:

You are SO right. It's been corrected :-)
# April 15, 2005 1:06 PM

Jan Schreuder said:


I am Missing MyGeneration and I see codesmith on the list.....

Well Please add MyGeneration to the list as it is definitely a MUST HAVE TOOL.....

( Go on..... give it a try........ )
# April 15, 2005 2:26 PM

Jan Schreuder said:

I've seen MyGeneration and it looks cool. But I still use CodeSmith. As soon as I'm convinced MyGeneration is a good replacement for CodeSmith, I will add it to the list.
# April 15, 2005 3:13 PM

TrackBack said:

Blog link of the week 17
# May 1, 2005 6:33 PM

TrackBack said:

# May 2, 2005 10:48 PM

TrackBack said:

# May 12, 2005 2:21 AM

TrackBack said:

# May 12, 2005 2:22 AM

Jan Schreuder said:

Got it too in the mail.
Hope to set ip up this weekend, all in virtual pc's.
# May 13, 2005 7:14 PM

TrackBack said:

# May 14, 2005 2:54 AM

Jan Schreuder said:

FYI, the performance of that object is abysmal. When you look at how it is implemented, it is obvious why...
# May 15, 2005 8:47 PM

TrackBack said:

# May 16, 2005 6:39 AM

TrackBack said:

# May 16, 2005 6:43 AM

Jan Schreuder said:

Thanks for running the tests.

Comments:
1. Your Queue test case is doing more than the others (PadLeft)
2. Since you are using Whidbey you might as well utilise Stopwatch (or with .NET today use the one from my blog)
3. If you run your tests on a WinCE device against the CF with version 1.0, the gap is larger
4. When measuring perf for collections it is important to test the retrieval as well as the addition.

Bottom line:
VB Collection is slower. How much slower depends on your exact scenario and usage: measure your specific case with the various data structures and make your choice. You might even decide that perf is irrelevant so you choose the interface you are more comfortable with.

The point:
My point was not to say that you can't use it - of course you can. The point is to be alert to its slow performing implementation (internally uses a hashtable and two arraylists)

Thanks for playing :-)
# May 16, 2005 10:28 PM

Jan Schreuder said:

Thanks Daniel. I agree with the point you made. It's just that after reading your comment to my earlier post I was curious as to the difference. Hence the test. And as you said, if you're aware of the performance issue, you can make a correct decision when to use either.

So far, I haven't developed anything for WinCE so I'm not aware of any performance issues there. I can only imagine having to be carefull with memory and such. And as for Whidbey, haven't been able to do much with it yet. I used it for the test because I had just installed the new beta ;-) I will check out StopWatch and will definitely look at the one from your blog. Thanks for the tip.

# May 17, 2005 7:39 AM

Jan Schreuder said:

Doing a performance test with only adding objects sound like a bit incomplete. You should also test how much time it takes to retrieve the data you have put in the collection. The 'overhead' code should also be ignored thus create one object and add that reference a zillion times into the collection object to really measure the collection object.

What about a normal array? Haven't seen that only here. Seems to fit in quite well in your fixed size collection test.
# May 17, 2005 9:56 AM

Jan Schreuder said:

I'll post an update as soon as I have the time. I'll then keep in mind the comments made by Daniel Moth and Ramon Smits.
# May 17, 2005 11:11 AM

Jan Schreuder said:


Did you use the projects of Mygeneration and secondly..
did you look at the datalayer produced with the dOOdad architecture ?
# May 19, 2005 9:59 AM

Jan Schreuder said:

Jan,

Thanks for this example. I had struggled with an error that plagued mr for several hours. I was having a problem properly Set the data source using XML data sources in a generic sort of way. I was trying to set the data source using the data tables themselves to the table in the report. While this seemingly should work it kept throwing a Logon exception. Which it pretty much about as msileading of a message that could possibly exist. The solution apparently was to apply the data set to the report tables.

This methodology really helped me out.

Thanks

John Jordan
# May 20, 2005 4:00 AM

Jan Schreuder said:

You could send an email when fatal errors occur.
log4net (http://logging.apache.org/log4net/) has a smtpappender which allows you to email log statements.
5 log levels are available by default. (Debug, Info, Warn, Error and Fatal)

You could configure to send Fatal logs to the smtp appender for example.

There are about 20 other appenders available (textfile ,database, eventlog, Console etc)

log4net rules. It's highly customizable and configurable. Ofcourse opensource.
# May 20, 2005 7:32 PM

TrackBack said:

# May 21, 2005 5:52 AM

TrackBack said:

# May 21, 2005 5:54 AM

Jan Schreuder said:

Wel lafter SQL running yesterday... i installed VS 2005 today....
it is working now....

I guess all the shit we had was due to the SQL express stuff mixing with the SQL developer edition....

Cause the developer edition of SQL runs very good...

hmmmmm

I used to hear this a lot... 'Every thing is runnig ok on my developement machine....'
# May 21, 2005 7:51 PM

Jan Schreuder said:

I have the same feeling. I had some Express stuff on my machine and I made really sure it was gone before I gave it another try.
# May 22, 2005 10:59 AM

Jan Schreuder said:

I know Pascal. The point is, my customer wants a notifier application, not an emailing one... And I thought this was cool stuff. Maybe you could use it for Nabber??
# May 22, 2005 11:03 AM

Jan Schreuder said:

You are not allowed to install software, but you are allowed to build a new executable? Moreover, you can create a msi setup, but not run it? Makes no sense to me. I say it is time to hack the registry!

Reminds me of the time when I needed to test UDP broadcast code. USP was strickly forbidden, but on and off I had been testing the application for a month, or so. At the last day on site, I get a phone call from the admin. He demanded to know the name of my supervisor at once. Then, at that same moment, the power goes down in most of Rotterdam, and od course my PC shuts down with it. But the phoneline didn't go down so the guy was still on the other line. My reply: "Well that is a h3ll of a way of shutting down my PC!".
# May 23, 2005 12:06 AM

Jan Schreuder said:

Yep. I can't install applications here. I tried installing this tool, and it fails on my system. And on others here. It works fine on my laptop though. At least I know have a solution if I cannot use the tool
# May 23, 2005 7:45 AM

TrackBack said:

# May 24, 2005 2:03 AM

TrackBack said:

# May 24, 2005 4:19 AM

TrackBack said:

# May 27, 2005 5:55 AM

TrackBack said:

# May 27, 2005 6:16 AM

Jan Schreuder said:

I installed the personal site starter kit in VS.NET 2005, but it didn't show up in the 'new project' dialog as a template.
Any ideas?
# May 31, 2005 1:53 PM

Jan Schreuder said:

The MSI file only installs a zip file in the Visual Studio 2005\Templates\ProjectTemplates\Visual Web Developer\CSharp folder. This is either in your MyDocuments folder, or somewhere else on your system. Unzip that file, and you should see the Personal Web Site Starter Kit in your new project dialog.
# May 31, 2005 4:53 PM

Jan Schreuder said:

I still owe you an answer as to why I don't blog yet. Right now I am spending quite some (spare) time on getting the SharePoint workspaces up and running within our company and I don't want to spend too much time behind my computer screen in the evening ;). But the good news is that I am still considering starting a blog. I guess it would be more convenient to respond to somone's post on my own blog.
# June 1, 2005 9:28 PM

TrackBack said:

# June 10, 2005 1:46 AM

Jan Schreuder said:

Then I know what i want for my BirthDay on Nov 8
# June 10, 2005 1:06 PM

Jan Schreuder said:

de pagina is al niet meer beschikbaar volgens mij
# June 10, 2005 3:58 PM

Jan Schreuder said:

Page is still there Karijn. Just checked.
# June 10, 2005 8:17 PM

Jan Schreuder said:

I like Me & My cause they imply its mine....
this & that implies it's not your's....

Liked the article (and the comments even more)

Why do c# people think you really have to know EVERYTHING about something when it comes to programming......

I gues they all know the complete framework..........

Guess not.................cause they wouldn't have time to read those blogs.....




# June 15, 2005 9:47 PM

Jan Schreuder said:

I updated the post. Check the MSDN link in the post for more information on what network settings can be retreived using Win32_NetworkAdapterConfiguration.
# June 21, 2005 1:40 PM

Jan Schreuder said:

Good post, great tool, thanks!
# June 23, 2005 10:38 AM

TrackBack said:

# June 27, 2005 2:31 AM

TrackBack said:

# June 27, 2005 2:56 AM

Jan Schreuder said:

The be-all-end-all list of developer tools is located at Scott Hanselman's blog:

http://www.hanselman.com/blog/ScottHanselmans2005UltimateDeveloperAndPowerUsersToolList.aspx
# June 27, 2005 8:52 AM

TrackBack said:

# June 27, 2005 9:17 AM

TrackBack said:

# July 1, 2005 3:51 AM

TrackBack said:

# July 1, 2005 3:55 AM

TrackBack said:

# July 3, 2005 5:03 PM

TrackBack said:

# July 4, 2005 4:56 PM

Patrick Wellink said:

This is definately a cool Keyboard....

Wehere can we get it......
# July 15, 2005 1:22 AM

Mike Blaak said:

I agree: a very cool keyboard. I only wonder how long these lcd-keys will last...
# July 15, 2005 8:33 AM

Ramon Smits said:

Why don't you just install WSE and use the buildin logging to file support?

Performance will suffer when the log gets huge. But who on earth would log all messages on a webservice?
# July 20, 2005 2:38 AM

Jan Schreuder said:

Well, my client doesn't use the WSE stuff (yet). And it was interesting enough for me to do it this way.

And I'm not logging everything, only in- and outgoing messages. It will usually only be setup while testing the services. And in those cases, having them all logged is really useful.
# July 20, 2005 3:04 AM

Jan Schreuder on .Net said:

As I wrote in an earlier post, I wanted to implement a simple tracing option on my new webservice. I...
# July 20, 2005 10:48 PM

Jan Schreuder on .Net said:

As I wrote in an earlier post, I wanted to implement a simple tracing option on my new webservice. I...
# July 20, 2005 11:48 PM

Dennis van der Stelt said:

What comments?! :)

And by the way, unregistered users are not allowed to post comments.

Agile doesn't mean you don't do code reviews and such. And pair programming doesn't mean you're doing XP. Even with Agile methodologies you can have quite some documentation, it's just that it's not written up front. Like Robert Martin says, when you write documents in concept phase or something, and specs (both technical as functional) change, the documentation is a drag to update and most of the time this doesn't happen. Result is a very complicated lie of what your system is, instead of the truth.

Source code is the best documentation you can find. Better make people able to read your code.

The metrics part to define when sourcecode is up for review is one most excellent method! I'll definitly try to implement that in some upcoming project. First, more holiday for me! ;)
# July 22, 2005 3:00 AM

Carlo Poli said:

An official announcement for Longhorn is scheduled today at 6 A.M. pacific time (which is 15:00 in the Netherlands, I guess). See http://radio.weblogs.com/0001011/2005/07/21.html#a10721 for more details.
# July 22, 2005 3:05 AM

Jan Schreuder said:

I love metrics as a way to see what code might need review/refactoring. I still see code from developers where one method will actually span 800 lines or more!!! I've even seen a class with just one method and that method was > 1000 lines of code... I've refactored it to a class with 20 methods, the largest of which is about 70 lines.

Enjoy the holiday Dennis. And I've changed my blog settings. Everyone can comment now!
# July 22, 2005 4:32 AM

Erwyn van der Meer said:

Yep, the rumors were right. Windows Vista it is. I don't know yet if I like the name, but I like the...
# July 23, 2005 8:58 AM

Erwyn van der Meer said:

Jan, congratulations on a very good article. Should be next week's featured article on the homepage of BloggingAbout.NET! I largely agree with the points you make. Some are so obvious to me that it puzzles me every working day why lots of developers don't abide by these coding standards.

New technology should be used if the productivity gains outweigh the problems of beta software. If the gains are not worth the risks, use proven technology. Of course you have to try out the beta software on a small scale to get a feeling for the gains and risks.
# July 28, 2005 2:23 PM

Edward Bakker said:

Jan, nice piece of work! I don’t think you have to apologize for people who feel offended by your article because in my opinion these are all valid issues!
I haven’t seen a lot of projects with people working on it that have almost 18 years of IT experience. Try to convince the architect on your project to choose the appropriate architecture for the job. At Tech Ed I heard somebody talk about a totally new architecture called BCA (Buzzword Compliant Architecture) ;) works all the time!
# July 29, 2005 2:46 AM

Patrick Wellink said:

Excellent article !!!

I only have a little addition....

If you test something, try to test it with as much as possible....

Let a method run for a night ( while you are sleeping) and inspect memory usage and stuff like that.

If you are using a database, spend 5 minutes to create an application that will fill the database for you. And test, not with 5 records in a database but with 50.000 at least.....

Then you know performance won't degrade after the first two months the customer uses it.



# July 29, 2005 5:24 AM

Dennis van der Stelt said:

[quote]Should be next week's featured article on the homepage of BloggingAbout.NET![/quote]
Done!

Haven't read the article yet though! ;) But I have a feeling it's at least worth the reference.
# July 30, 2005 4:20 AM

Jan Schreuder on .Net said:

Author : &lt;a href=&quot;/blogs/jschreuder/&quot;&gt;Jan Schreuder&lt;/a&gt;&lt;br&gt;&lt;br&gt;
After years of experience as a developer in multiple languages, Jan shares his vision on software development with the world.&lt;br&gt;
# August 1, 2005 12:48 AM

Wim van den Brink said:

Hear hear ;-)

I have a little less experience but the same idea's and feelings ..
I like the idea of BCA ;-)
# August 7, 2005 11:20 PM

Dave Frey said:

You're my first google hit for "code complexity .NET" and I look forward to trying the tool you mention.

I'm involved in a codebase that's begging for refactoring to the same degree you describe. Are you happy with how the tool "scores" your before/after?
# August 9, 2005 9:15 AM

Patrick Wellink said:

Use InfoRapid.....
Se a previous post of me....

It really rocks !
# August 11, 2005 1:26 AM

Jan Schreuder said:

Yeah, he could use InfoRapid. But the link I posted is interesting because there are several other registry tweaks that might help you
# August 11, 2005 2:31 AM

Jan Schreuder said:

The scores before and after are great. Especially in the case where I refactored one method which spanned 900 lines into about 20 others. The code is easier to read and understand.
# August 11, 2005 2:36 AM

Ramon Smits said:

Commandprompt here, virtual desktop manager and powercalculater are always part of an xp install :)

HTML slide show wizard isn't really that cool but the image resizer is also a tool I use frequently.
# August 15, 2005 1:17 PM

Erwyn van der Meer said:

I highly recommend the new XP SyncToy from Microsoft. Written in .NET! It's currently in beta, but works fine for me: http://www.microsoft.com/windowsxp/using/digitalphotography/prophoto/synctoy.mspx

Oh, and don't forget TweakUI. I can't live in Windows XP without it.
# August 15, 2005 2:39 PM

Nathan J Pledger said:

Absolutely right! (It must be, 'cos I put the same standards in my current place of work)

However, in real life, I see that the extensive libraries I carry around with me, which are XML documented, which are commented and are packaged in meaningful namespaces are not used by my colleagues.

I wonder why this is. I have published the XML documentation, I advise of changes to the various API's or libraries using a techie mailing list and I package them in every project I work with - so everyone will experience them (even if a useful function 'accidentally' pops up in IntelliSense) at some point, so why not use them?
# August 16, 2005 10:30 AM

Nathan Pledger said:

Nah!

Smug TiVo owner here. I would rather have a Linux box with all the configurational nightmares than lose my TiVo + AudioTron setup. TiVo is a black box (not literally) that "just works" - and doesn't cost £2,000 for the hardware.

MS Media Centre is - from the Media Centre forums I have read - an expensive configurational nightmare.

I am looking for a repacement for TiVo when it inevitably fails, but there is nothing out there that comes close. MS Media Centre would be an option, except for the extreme cost and huge amount of negative feedback from people who have used it.
# August 24, 2005 1:33 PM

Erwyn van der Meer said:

Don't forget to check out Brad Abrams blog. It links to a welth of resources on designing class libraries. The subfeed for Design Guidelines is: http://blogs.msdn.com/brada/archive/category/2656.aspx. I especially recommend this post http://blogs.msdn.com/brada/archive/2005/07/11/437388.aspx which contains a lot of links to videoa and transcripts.
# August 25, 2005 1:27 AM

Morten said:

Hi Jan
How do you administer changes from others to your common class library?
# August 28, 2005 5:23 PM

Chris Slatt said:

This blog post does a good job explaining things:
http://weblogs.asp.net/erobillard/archive/2004/05/10/129134.aspx

Make sure you're making a distinct between System.SystemException and System.Exception They're different.
# September 7, 2005 7:20 AM

Erwyn van der Meer said:

Jan, the guideline to derive from System.ApplicationException has been withdrawn by Microsoft as it adds no real value. You should not catch ApplicationException directly. Current guidance is to reuse existing exception types (which derive from SystemException) as much as possible. So ApplicationException does not serve as a distinction between exceptions thrown from the .NET Framework and exceptions thrown from your application or your own libraries or third party libraries. The conclusion is that deriving from ApplicationException unnecessarily deepens the exception hierarchy in your application. The standard reference on this topic is the thread on this post by Brad Abrams: http://blogs.msdn.com/brada/archive/2004/03/25/96251.aspx.
# September 7, 2005 1:08 PM

Jan Schreuder said:

I hardly catch any standard exceptions, unless I want to distinguish between exceptions I can/want to handle/ignore and exceptions I want to leave for the caller of my library code.

I do throw some exceptions myself from within my library code. If possible, I use standard Exceptions, such as ArgumentException, ArgumentNullException and ArgumentOutOfRangeException. But in some cases I throw a custom exception, just to make sure it was thrown by my code. Based on the guidelines, I changed the inheritence from System.Exception to System.ApplicationException, but I will gladly change it back.

Strange though, that Microsoft still has the outdated guidelines online.
# September 7, 2005 1:40 PM

Jan Schreuder on .Net said:

using Anticipating Minds DevMetrics 2.0
# September 16, 2005 5:36 AM

Jan Schreuder on .Net said:

using Anticipating Minds DevMetrics 2.0
# September 18, 2005 11:42 AM

Jan Schreuder on .Net said:

using Anticipating Minds DevMetrics 2.0
# September 18, 2005 11:50 AM

Jan Schreuder on .Net said:

using Anticipating Minds DevMetrics 2.0
# September 19, 2005 4:06 AM

Jan Schreuder on .Net said:

using Anticipating Minds DevMetrics 2.0
# September 19, 2005 4:16 AM

Joshua's .Net Tips said:

Just saw this post&amp;nbsp;by Jan Schreuder talking about MSDN Virtual Labs. If you haven't checked these...
# September 20, 2005 12:23 PM

Chi Wai Man said:

Congratulations Jan!!:)
# September 22, 2005 2:31 PM

Rutger said:

Van harte gefeliciteerd Jan!!

Een goede kraamtijd toegewenst!!
# September 22, 2005 11:01 PM

Patrick Bes said:

Congratulations. She looks very pretty Jan :)
# September 22, 2005 11:47 PM

Erik van Olst said:

Hoera! Prachtig kindje, mooie naam en inderdaad reden om trots te zijn!

Heel veel plezier toegewenst de komende tijd!
# September 23, 2005 12:05 AM

Ernst Wolthaus said:

Jan,
Congrats on your beautiful daughter!
Life will never be the same...

Let's hope she looks like her mother :-)
# September 23, 2005 12:22 AM

P.J. van de Sande said:

Welkom op aarde Lisa! :)

Gefeliciteerd Jan!

# September 23, 2005 12:41 AM

Edward van Steenderen said:

Congratulations!
# September 23, 2005 1:13 AM

Rob Joosen said:

Jan,

Proficiat !

Rob
# September 23, 2005 2:15 AM

Fijsjan Heijkoop said:

Gefeliciteerd Jan!!
# September 23, 2005 4:50 AM

Mischa Kroon said:

Heel veel plezier gewenst in de komende tijd met de kleine :)
# September 23, 2005 6:30 AM

Dennis van der Stelt said:

Wow, nice Jan! Congrats! And as Ernst says, life will NEVER be the same again!

Nice name too!
# September 23, 2005 11:54 AM

Rick van den Bosch said:

Congratulations Jan...!!!
# September 23, 2005 2:04 PM

Colin said:

I downloaded your code and tried it, but I don't get the same results you get. I got the following result for MethodC:

HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Thu, 13 Oct 2005 12:08:21 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Content-Type: text/xml; charset=utf-8
Content-Length: 428

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<MethodCResponse xmlns="http://Test.com/webservices/">
<MethodCResult>
<Result>OK</Result>
<Detail>MethodC</Detail>
<SomeValueA>SomeValue A</SomeValueA>
<SomeValueB>SomeValue B</SomeValueB>
</MethodCResult>
</MethodCResponse>
</soap:Body>
</soap:Envelope>
# October 13, 2005 5:08 AM

Jan Schreuder said:

That is because you are looking at the result of the Invoke action. That result is OK. And I know my webservice works correctly.

It's just that the "View in browser" option in Visual Studio should give you a sample of what the actual result will look like, without having to invoke the method. In that case you will not see the Result and Detail values.
# October 13, 2005 6:32 AM

Colin said:

Sorry, I didn't understand what you were trying to show. Looks like a bug. Whatever is generating that page ignores the base for the type extension in the schema.

<s:complexType name="Method2Response">
<s:complexContent mixed="false">
<s:extension base="tns:Method1Response">
# October 13, 2005 7:37 AM

Patrick Wellink said:

He Jan,

I had quite similar problems, i don't really trust those generated screens.

I now always use WebService Studio available on Gotdotnet.

I had very complex schema's exposed as a paremeter in a webservice but they didn't show up just like yours....
But in Webservice Studio they do show up.....

Jus have a look at it......
# October 13, 2005 7:39 AM

Patrick Wellink said:

I forgot to mention those schemas also imported other schemas, and it went wrong on the imports....

Since you are inheriting..... It goes wrong on the inherit....

hmmm i see some similarity here.....
# October 13, 2005 7:43 AM

Patrick Wellink said:

I forgot to mention those schemas also imported other schemas, and it went wrong on the imports....

Since you are inheriting..... It goes wrong on the inherit....

hmmm i see some similarity here.....
# October 13, 2005 7:43 AM

Dennis van der Stelt said:

Ultimate Edition is the thing to go for.

Note to self : Quadriple your RAM!
# October 14, 2005 12:11 AM

Erwyn van der Meer said:

Of course every self-respecting geek should go for the Ultimate Edition!

Jan, you're not running XP Home Edition at home, are you? ;)
# October 14, 2005 12:45 AM

Ramon Smits said:

AFAIK Daemontools has support for more image files and has the ability to change it's name so you can also use it with some kind of copy protection schemes.
# October 14, 2005 12:51 AM

Jan Schreuder said:

I use Daemontools myself. It's freeware if you use it at home. But in the office, you need to register your version, which would cost you EUR 14.10 ($15,95).

And the Microsoft version, although with very few features, is free. So you can use it when Daemontools can be an issue.
# October 14, 2005 2:22 AM

Jan Schreuder said:

Nope, I'm running XP-Pro on my machine at home. I even bought an official license!
# October 14, 2005 4:16 AM

Patrick Wellink said:

Hmm this looks finally like the feature rich OS i need.....

Hmmm 5 Media center sessions... can i have 5 tuners as well then ????
# October 14, 2005 4:47 AM

Dennis van der Stelt said:

It's great, as long as you don't have to do an initial implementation that has dozens of methods. That was our <s>problem</s> challenge, we had so many methods.

In my current project I have to write a client application that supports plugins, but if it turns out to have too many methods again, I'll definitly have a look at some other implementations.

However, if you look at the ASP.NET 2.0 Membership model, which is implemented via Provider Model, way to go! You can implement this in your own application, and use the standard .NET 2.0 features to have a web interface for administrating your users and groups. Now thát is a cool solution!!!
# October 18, 2005 11:10 PM

Dennis van der Stelt said:

Oh, by the way, I had blogged about it before, right after or even during our project.

It's called "Provider Model Madness" :)
http://bloggingabout.net/blogs/dennis/archive/2004/10/20/1497.aspx

# October 18, 2005 11:12 PM

Jan Schreuder said:

Yeah, I remember your post :-). Still, it was fun to experiment with that design pattern.
# October 18, 2005 11:16 PM

Patrick Wellink said:

Looks Promising....

I think i will have a go at it as soon as im home.....
# October 19, 2005 5:44 AM

SAK said:

it's good what if i dont want to hide the status bar but to show the correct number of total pages, because it's not showing the correct number instead it shows total pages=1+
regards SAK
# October 24, 2005 1:02 AM

Mike D said:

Great Help! My application had huge memory leak problems until I read this article. Based on my search on this topic in many forums I think there are great misconceptions when it comes to .NET memory management. There is more to it then meets the eye. thanks
# November 3, 2005 2:09 PM

Erwyn van der Meer said:

How to check for cyclomatic complexity that is too high in VS2005.
# November 4, 2005 2:49 AM

BlogofBob said:

Jan Schreuder on .Net : Generics FAQ for Visual Studio 2005
Another excellent article right when I needed...
# November 14, 2005 10:42 AM

BlogofBob said:

Jan Schreuder on .Net : Generics FAQ for Visual Studio 2005
Another excellent article right when I needed...
# November 14, 2005 9:54 PM

Arbindo said:

You could do this by adding a custom rule in FxCop and using FxCop to analyze your code.
# November 16, 2005 2:44 PM

Wingnut said:

I've been looking for something along these lines to assist in presenting Crystal Reports on our extranet in PDF/XLS format. This helper class seems to be a great resource for this purpose.

Anyone have any code samples of how to implement runtime parameters using this class?
# December 31, 2005 10:17 AM

Jan Schreuder on .Net said:

If you're not interested in someone expressing his feelings about checking code and code quality, please...
# January 3, 2006 5:24 AM

Patrick Wellink said:

Well i once tried FXcop, and ran into the problem you mention.

Of course there will be problems that you cannot solve, or that are aceptable in your situation

But they were so many that it was almost impossible to evaluate all of them to see if it was really acceptable..... So i wound up with too many errors.... That's why i stopped using FXCOP.

Maybe i should start using ist again...
# January 3, 2006 7:04 AM

mike blaak said:

I agree that code of methods shouldn't be too long, but beware of the other side: hundreds of methods of about 1-5 lines code, so that you get completely lost when trying to debug it...
# January 3, 2006 7:09 AM

Ramon Smits said:

We use fxcop in our buildcycle. You really have to use fxcop with every check-in because you will have to to a lot of work when you want to improve code quality afterwards :). fxcop suggestions are correct most of the time. It is also very good to add rules for code consistency between developers in a team.

Methods that become bigger then a screen should be refactored to multiple methods. If code reviewers allow the existance of such methods then you should hire other reviewers :). It is very important that changed code gets reviewed by at least another developer but best for a senior developer or architect. And this should be done before each revision that gets tested by users.

Reviewing others code WILL be rewarding for both developers. I really don't need a tool like DevMetrics that let's me know about the code complexity within my team. But DevMetrics is a nice tool though :)
# January 3, 2006 9:29 AM

Jan Schreuder said:

Devmetrics is a great tool to quickly identify methods that are too complex. As for FxCop, rules that you find that are not applicable to your project can be disabled for that project, so it is possible to only check for stuff you find important.
# January 4, 2006 1:14 AM

Jan Schreuder on .Net said:

If you're not interested in someone expressing his feelings about checking code and code quality, please...
# January 4, 2006 1:15 AM

Arno Beljaars said:

Does somebody uses a subset of the standard rulesets that can be used in FxCop and that provide for a good static analysis of code, but that does not return an impractical amount of warnings? I'd like to use FxCop in existing projects, but like Patrick, I think I don't have time to evaluate all rules.
# January 5, 2006 4:21 AM

Jan Schreuder said:

Easiest way is to open FxCop and then create a new project. Don't add any assemblies, but select the Rules tab in the explorer part (on the left-hand side) of the screen.

You will see a list of all the available rules. Disable the rules you don't need, then save the project with a name such as MyFxCopTemplate.

Now every time you want to use FxCop to check your assemblies, simply load the template project and save it under a new name. Then load the assemblies you want to check and run FxCop.
# January 5, 2006 5:12 AM

Jan Schreuder on .Net said:

If you're not interested in someone expressing his feelings about checking code and code quality, please...
# January 18, 2006 3:52 AM

Patrick Wellink said:

Maybe thsi programmer had too much to drink :-)

But is this code detected by FXcop and such ?
( I guess it should be )

Patrick
# January 20, 2006 2:04 AM

Erwyn van der Meer said:

That's a very nice picture. I use SyncToy as well to back up my photographs to another hard disk. It's a great tool and reasonably fast (for a .NET application ;).
# January 25, 2006 1:06 PM

Joshua Langemann said:

The C# (and now VB) "using" statement is really helpful to ensure that you properly dispose of objects. I don't know how many times I missed disposing of things like DataReaders prior to learning about using. Try/Finally blocks (without the Catch) are also handy, since they guarantee that the Finally block will run even when you have no need to catch exceptions.
# January 26, 2006 1:29 PM

Marco said:

# January 30, 2006 7:15 AM

Mike Blaak said:

Yeah, Jan
This is definitely the event I was looking for. Skip all the DevDays, TechEDs etc...
I just wonder: did you notice the date...april 1st 2006? Doesn't that ring a bell...
# February 3, 2006 11:44 AM

Dennis van der Stelt said:

We're not _THAT_ stupid, Mike :)
# February 6, 2006 1:07 AM

Dennis van der Stelt said:

All but the first issue! And so it happens, I still have two copies of them, including cd, both still in plastic! Never opened!

How's that for a collectors item!? :D
# March 21, 2006 7:36 AM

dina said:

Hi,
As you said:
"The Service1.asmx file inherets from System.Web.Services.WebService by default. Change this so it inherits from the class generated by the WSDL tool." How can i do that? I got the error saying: The type or namespace name "WsdlGeneratedClass" couldn't be found.
tnx
# March 31, 2006 1:34 AM

Jan Schreuder said:

Dina, I the code generated does not necessaruly have a namespace. Make sure the namespace in your generated class is identical to the project namespace you are using. And then it should work.
# April 6, 2006 3:11 AM

Patrick Wellink said:

Still no MyGeneration ????

PW ;-)
# April 7, 2006 7:41 AM

Mads Kristensen said:

Hi Jan.

I'm glad you liked it. I'm looking forward to reading more of your articles. There are quite a few of them and they all look very interesting.
# April 12, 2006 1:53 AM

Mads Kristensen said:

That's great news. I have some issues with the current version not understanding Generics correctly at all times. Gotta go tell them right away :)
# April 13, 2006 12:15 PM

Mads Kristensen said:

I wish we had a magazine like that in Denmark. Currently I subscribe to MSDN Magazine, but it's not that good. Dr. Dobb's Journal is much better, but it's not about .NET. Concider yourselfs lucky to have a local .NET magazine.

I downloaded one of the old issues and found to my surprise that Dutch isn't that hard to read.
# April 13, 2006 12:19 PM

Rob Tillie said:

Jan already posted the details of the Atlas toolkit over here, but I missed one thing in his post that...
# April 17, 2006 12:16 PM

Patrick Wellink said:

I think Google is an evil company....

Just like Yahoo they incorperate their google toolbar in every piece of open source software. If you run the installer, there is that little nifty check box (install Google Toolbar) that's on by default.

So if you are too eager to klik the next button google toolbar is installed.

If i really want a google toolbar I can download it myself....

I hate all companies that have this kind of push-ware....

So that's Yahoo and Google...

Futhermore Google isn't indexing as good as they should.......

Have a look here...

http://tweakers.net/nieuws/42356

This was a reason for me to use the Yahoo search when Google Fails
# May 8, 2006 11:26 PM

oruga said:

very good
# May 10, 2006 3:05 AM

Patrick Wellink said:

Nice those patent's from the US isn't it.....
# May 11, 2006 3:51 AM

Jean-Paul Smit said:

I ran into this anoying behaviour as well. Thanks for posting!
# May 11, 2006 4:08 AM

Mads Kristensen said:

Very interesting. It looks like a fun place to work, with fitness centres, playgrounds and all sorts of stuff. However, one could be concerned about the monopoly of information described in the film.
# May 20, 2006 6:03 AM

Dennis van der Stelt said:

Nice article mate! And great layout! Good job!
# May 31, 2006 1:39 AM

Ramon Smits said:

Hi Jan, this code isn't that usefull. You should really add a multi-wildcard search option to it for performance reason's. A really good implementation would be to make use of yield return to return a collection of FileInfo's.

But then it could be that you receive a securityexception when scanning a path recursively. You should catch that too and add an event handler for such scenarios to determine what to do.

Also add a return parameter that return information like total files, directories, filesize, etc.

Then it would be an interesting piece of reusable code ;-)

Hope you don't mind my comments...

If you have done that then it would look almost the same as the search class that I reuse all the time LOL.
# May 31, 2006 3:49 AM

Jan Schreuder said:

Ramon, I was already contemplating about adding the search option, so a new version is uploaded to include that functionality.

But I want to keep this class as lean as possible. You don't always need the properties you mention. But if you do, you can inherit from this base class and implement those features.

As for the security exception, my first version used the Directory.GetDirectories() and Directory.GetFiles() methods. And in that scenario, I did get the UnauthorizedAccessException. But by changing to the DirectoryInfo.GetDirectories() and DirectoryInfo.GetFiles() methods, I got rid of that exception. And these methods return a collection of DirectoryInfo and FileInfo objects. So there's your yield return ;-)

And no, I don't mind comments. My opinion on this is, that if nobody comments on your code you'll never be able to improve yourself. Nobody writes perfect code by default, but parts of my code are excellent ;-)

# June 1, 2006 2:48 AM

Lennard said:

Not only on NTFS is it possible to create a loop. There are more filesystems on this world.

I havn't test your code if it works on shares (attached to a drive letter or directly).
In that case this solution will not work.
# June 1, 2006 4:38 AM

Jan Schreuder said:

Lennard, if you'd like to send me an example scenario I would be more than willing to see if it will or will not work. And if it won't work, I'll try and provide a working solution.
# June 1, 2006 5:01 AM

Lennard said:

Get yourself a linux box with samba.
Create a windows share with samba.

In the folder you did share create a loop:
$ mkdir loop
$ cd loop
$ ln -s ../loop loop

Now you will have a folder which is looping.
Mount the share to a drive letter or use the UNC path. The application will loop.
# June 4, 2006 5:01 AM

Lennard said:

There is also an problem with deep folders which will give a path name longer than 255 chars.

Steps:
1: C:
2: mkdir C:\long
3: cd C:\long
4: mkdir 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
5: share this folder with a sortname like 'l1' and make the share writeable
6: mount the share to a driveletter: 'net use G: \\winxp01\l1' (winxp01 is my machine name)
7: repeat step 4 on G:
8: create a dummy file inside the long folder on G:

Use the example application and let it scan C:\long
The second long folder will not be found, also the create file will not be found.

This is a result that windows cannot search thru paths which are longer than 255 chars.
# June 4, 2006 5:22 AM

Jan Schreuder said:

Interesting scenario's, but those I will not even attempt to fix.

To be honest, if it's a problem with Linux shares on windows, then I will leave solving that problem to people who want that solved.

Windows has a problem with pathnames longer then 255 bytes. All windows developers (should) know that. Windows explorer doesn´t even handle that situation properly, so I can´t be bothered.
# June 4, 2006 11:50 AM

Tom Elix said:

Do you think this will hurt C# Online.NET?

C# Online.NET is a wiki-based C# and .NET resource featuring articles, code snippets, forums, study guides, and tutorials.

http://wiki.csharp-online.net/
http://blog.csharp-online.net/
http://forum.csharp-online.net/
# June 12, 2006 7:12 AM

Ramon Smits said:

I am using a version found through the ndoc main site. But the documents that hold the link aren't served at the moment. Will get back to you on the version I am using at home.
# June 16, 2006 3:42 AM

Jim Merhaut said:

Hi

We use Visual Studio C++ 6.0. Do you know of any metric tool that is in the open source space that integrates with this IDE?

I check on DevMetrics and it looks like it is in the .NET space.

Jim Merhaut
# June 16, 2006 7:37 AM

P.J. van de Sande said:

Don't forget to install GhostDoc as well. But for the .NET 2.0 support, here is a quote of the persistents:

NDoc 1.3 can document .Net 2.0 assemblies if an app config file is supplied to force NDoc to prefer the 2.0 framework over the 1.1 framework

You can download a zip file containing example config files from here. Just place the config files in the same directory as the NDoc binaries, and you are ready to go :)

If you have a different version of the 2.0 framework such as that which is supplied with the latest C# Express beta, then you will have to update the version number within the file - it should be obvious where to make the change once you have looked at the file contents... VS 2005 Beta 2 needs this tag <supportedRuntime version="v2.0.50215" /> ... VS 2005 RTM needs this tag <supportedRuntime version="v2.0.50727" />

Note, however, that generics are *not* supported, nor is importing VS.NET 2005 solutions.

If you use NDoc to document an assembly containing generics the results will be, at best, disappointing - it is quite likely that NDoc may abend or produce output that cannot be compiled by the help compilers...

? The generated framework links use the 1.1. framework namespace. Do we need to wait until the Alpha version to have an NDoc that will generated links to the 2.0 framework topics?

Whilest waiting for the final 2.0 version of NDoc; a modified version of NDoc 1.3.1 that is compiled with support for generics can be found here. This version produces decent output for generics but doesn't handle links to system types.


I see the page is offline at the moment, but you can view it yourself in the google cache. With working links:
http://66.249.93.104/search?q=cache:LmKSsFUd680J:ndoc.sourceforge.net/wiki/dotNet_2.0_Support+ndoc+2.0+support&hl=en&ct=clnk&cd=1
# June 21, 2006 2:33 AM

Jan Schreuder said:

Yep, I use Ghostdoc as well. A really good help when you want to add XML tags to your code.

There is a beta version of NDOC for VS 2005 at sourceforge: http://sourceforge.net/projects/ndoc05. The latest build is date somewhere in April 2006. But I can't get it to work. Anyone have any clues?
# June 21, 2006 3:29 AM

Ramon Smits said:

The problem with ndoc is that is generated default documentation. Documentation that a developer really doesn't need because it does not add more information.

The documentation elements are only very usefull for describing a methods funcionality in detail with remarks and examples.

If you cannot provide that information then you can better not add xml documentation at all.
# June 23, 2006 12:42 AM

Marc Jacobi said:

I also tried GhostDoc but I was only pleased with the feature that retrieves "derived" documentation. The text it generates is not really usefull documentation, at least I don't consider "The data table" usefull ;-).

Bottom line is that the documentation you really want to read as a user of your code is hard to write as a Human and I dont think we're long of automating that.

If code comments are not reviewed on their contents, than GhostDoc is the tool for you!

-Marc Jacobi
# June 23, 2006 2:42 AM

Jan Schreuder said:

Marc, you're right ofcourse that comments like "The data table" are not useful. As I said, you need to add a bit more information to the stuff generated. And as you said, it's great when it is able to get "derived" documentation. It's equally great when documenting properties, at least I think so.

I'm sorry to say, but you're comment "If code comments are not reviewed on their contents, than GhostDoc is the tool for you!" sounds a bit disappinting. Yes, code comments could benefit from reviews. But that goes for comments created using the help from GhostDoc as for the stuff added by more or less "intelligent" developers.

It's still up to the developer to write something useful. GhostDoc is a tool to help you create documentation and create the obvious stuff.

# June 23, 2006 4:50 AM

Jan Schreuder said:

Sounds obvious Ramon. Ofcourse you need to add remarks and examples. It's what I do in my code library. And if a developer cannot provide that information, than why is he/she wrting the code in the first place?
# June 23, 2006 5:10 AM

Nathan Pledger said:

The way I see it is some documentation is better than none, even if it is stating the obvious. And besides, if your good at your functional programming, it should be pretty obvious what is going on anyway.

I installed it and really like it. Does away with typing the same old things again and again.
# June 23, 2006 5:19 AM

Ramon Smits said:

Well it depends on the complexity of a method. There are alot of methods that really don't need any documentation. For example a stack object which has a Push and Pop method.
# June 23, 2006 6:38 AM

Jan Schreuder said:

If some methods are that obvious, then why would Microsoft bother to document every single property and method in the System.IO namespace? For example, the File.Copy method. Pretty obvious what it will do, right? Try this link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemiofileclasscopytopic.asp

Overkill? I think not. Even obvious stuff needs documentation. If not for its purpose, then at least for examples, exceptions, etc.
# June 23, 2006 12:38 PM

Dennis van der Stelt said:

I don't get what this tool gives you more than the standard /// in VS2003 and 2005.

First of, the function your writing not only builds the insert command, it also returns this. So I'd rename the function to GetInsertCommand or something. GhostDoc will probably say "Get Insert Command". What's the benefit of that over the current method name?!

Same goes for "The data table". One of the reasons for loosing notation where you'd specifiy the type (as in strMyString and blnChecked) was because we can see the type when hovering over it. What's the use of some comment saying "Dude! Hey, check this! I'm returning a data table here! Oh, yeah, I know, you can see that in the exact same tooltip as where you're reading this sentence, but hey, I'm generated with GhostDoc and this is just what I generate!"

If it's in the top 10 must have addins, I don't even want to take a look in that list! :)
# June 23, 2006 1:30 PM

Ramon Smits said:

Yes you are correct but I was referring to the documentation that ghostdoc generates. As you have seen even the simplest of documentation on this method couldn't be genereted by ghostdoc :). Examples, exceptions and remarks still have to be added by hand.

We use some logic in our documentation task of our build server to detect if documentation is usefull. Not that is does extremely difficult stuff. It currently just checks default content and return value documentation. We opt for manually added documentation on all properties, methods, classes, interfaces, etc. and on all visibility types (public, internal, protected, etc.).

I really think it's overkill in general. I like a good general class description and some good examples at class level. But that is just my prefered documentation style because I also browse for documentation this way. I use intellisense, get to the class and smash F1 ;)
# June 23, 2006 2:25 PM

P.J. van de Sande said:

It isn't for nothing that this tool had the first price in Roy's Addin Contest.

There is one point that Dennis forgot, document generation for method overrides. When you implement and method defined in a interface, the documentation from the interface method sig will copied. This is a very great function, i write the documention above the method sig's in the interface. And every implementor can just copy the documentation with GhostDoc and only add the and exception inforomation or some extra information if needed.
Only for this future i will recomment GhostDoc!
# June 26, 2006 4:56 AM

Ravi Bhavnani said:

I've been using this version of NDoc for .NET 2 for some time.  Works quite well.

http://jonas.lagerblad.com/blog/?p=4

/ravi
# June 28, 2006 7:43 AM

Ramon Smits said:

That is the same version that I'm using and that is also linked somewhere at the ndoc site.
# June 28, 2006 11:11 AM

Jan Schreuder on .Net said:

A&nbsp;few weeks back, I blogged about NDoc not being available for .Net 2.0. In that same blog post,...
# July 3, 2006 3:40 AM

Jan Schreuder on .Net said:

GhostDoc really helps you when documenting your code with XML tags! Find out why I use it and see if it's useful for yourselves.
# July 4, 2006 11:20 PM

Jan Schreuder on .Net said:

In my previous post I explained how you could build a class that uses recursion to scan through directories....
# July 4, 2006 11:52 PM

Patrick Wellink said:

Well....

For sure i have to kick in here.......
The using stuff uyou are using is translated in try block to get the same functionality in VB.Net.

But you can do without those in vb and clean up the system in a different way. By doing so your code would look a lot cleaner....

and btw the stuff that is doing really something ....

                  while ((line = importReader.ReadLine()) != null)
                   {
                       ProcessLine(line, ds);
                   }
                   UpdateDataSet(connectionString, ds);

and

                   While Not (line Is Nothing)
                       ProcessLine(line, ds)
                       line = importReader.ReadLine()
                   End While
                   UpdateDataSet(connectionString, ds)

are not that different at all....
and I think Nothing is clearer then NULL

Also i likw writing out stuff, i really do like writing out Inherits and implements....



# July 10, 2006 6:58 AM

Jan Schreuder said:

I knew you would respond :-P. The using stuff in C# is great. You just know that the Dispose method on those objects is called. Why that is a good thing can be found here: http://bloggingabout.net/blogs/jschreuder/archive/2006/01/19/10814.aspx. And VB.Net 2.0 also has the Using statement.

But it's a matter of taste, I guess. I don't think VB.Net is lesser language, I just prefer C#.
# July 10, 2006 7:13 AM

Ramon Smits said:

Did you know that you could omit al those brackets? It makes the c# version even more attractive :)

private void Process(string fileName, string connectionString)
{
   using (FileStream importStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.None))
   using (StreamReader importReader = new StreamReader(importStream))
   using (SqlConnection con = new SqlConnection(connectionString))
   using (DataSet ds = new MyDataSet())
   {
       string line = null;

       while ((line = importReader.ReadLine()) != null)
       {
           ProcessLine(line, ds);
       }

       UpdateDataSet(connectionString, ds);
   }
}
# July 10, 2006 11:20 AM

Jan Schreuder said:

Of course, Ramon. But I always add brackets, even for if statements where only one line of code follows. A matter of taste, I guess :-)
# July 10, 2006 11:24 AM

Rick van den Bosch said:

[quote]Of course, Ramon. But I always add brackets, even for if statements where only one line of code follows. A matter of taste, I guess :-)[/quote]

And that's exactly my taste! In Dutch: Hulde! On-topic: I think C# is a bit cleaner too. That's probably because of being around C# (or not being around VB.Net) for a long time. At the end of the day there's one important question: does it work? And if it does: party! ;)
# July 10, 2006 1:10 PM

Jan Schreuder on .Net said:

About a year ago, I felt I had to write my own SqlCommandBuilder object because I had some issues with...
# July 12, 2006 4:26 AM

Ramon Smits said:

@Jan & Rick: It depends. When I have an if statement with one line then I put the whole comparison on one line:

if(x) return 27;

I always put if, switch, do, while blocks seperate with the previous and upcoming code. The result is very clean and readable code. The using block in my example is very readable although not all using statements have their own brackets.
# July 12, 2006 5:25 AM

Jan Schreuder said:

Ramon, don't get me wrong. I'm not critisizing your style of coding. Your code sample is very clean and readable. I just wanted to point out that I, as a rule, almost always add brackets. That goes back to the time that I was building C apps. I do have situations where I, like you, place the one-line-if-statement on one line. But that's about the only exception I can think of. A matter of taste.

I do the same as you for if, while, etc...
# July 12, 2006 5:47 AM

Daniel said:

FYI- I didn't realize until watching dnrTV, but Using is available in VB as of .NET 2.0.  That used to be one of my reasons for preferring C#, too. =)
# July 13, 2006 3:01 PM

Rory Primrose said:

NDoc has been a valuable tool for many years. Unfortunately, like many 3rd party free software projects,...
# July 13, 2006 3:54 PM

Marc Jacobi said:

Iterating over all tables in your dataset will not work if they have DataRelations. You need to do a topological sort (which will not work for cyclic relations!) of the entity graph to determine the order of updating the tables.
# July 14, 2006 1:15 AM

Jan Schreuder said:

If there are relations, you're right. Handling tables in the right order is the only way to get the relations updated correctly. The code here was just a sample. Please note I updated the post to thank you for your comment ;-)
# July 14, 2006 2:58 AM

P.J. van de Sande said:

As some extra information to you post, Anand Raman has informated me about the reason for the delay:

"When we tested Sandcastle bits with our beta partners we had the following feedback:

1. Detailed documentation required. At a minimum, an architectural overview and detailed walkthrough is needed." - Anand Raman
# July 17, 2006 12:19 AM

Jan Schreuder said:

Thanks for the extra information!
# July 17, 2006 12:43 AM

Nathan Pledger said:

Better news is vmWare's attempts to make thier software free. GSX server is now available free of charge at http://register.vmware.com/content/download.html
# July 17, 2006 12:54 AM

Arindam Jha said:

Can you suggest any good tool for the same purpose in .NET Framework 1.1?
# July 22, 2006 2:09 AM

Jan Schreuder said:

Both FxCop and DevMetrics both work for .Net framework 1.1 and 2.0.
# July 23, 2006 11:49 AM

Luis Lebron said:

First thanks for the excellent code. I am trying to convert the code to VB but ran into 2 functions I am having trouble "translating" correctly: the RaiseFileEvent and the RaiseDirectoryEvent functions.

/// Raises the file event.
/// </summary>
/// <param name="fileInfo"><see cref="FileInfo"/> object for the current file.</param>
private bool RaiseFileEvent(FileInfo fileInfo)
{
bool continueScan = true;

// Create a new argument object for the file event.
FileEventArgs args = new FileEventArgs(fileInfo);

// Now raise the event.
FileEvent(this, args);

continueScan = !args.Cancel;

return continueScan;
}

private bool RaiseDirectoryEvent(DirectoryInfo directory, ScanDirectoryAction action)
{
bool continueScan = true;

// Only do something when the event has been declared.
if (FileEvent != null)
{
// Create a new argument object for the file event.
DirectoryEventArgs args = new DirectoryEventArgs(directory, action);

// Now raise the event.
DirectoryEvent(this, args);

continueScan = !args.Cancel;
}
return continueScan;
}

# July 26, 2006 7:39 AM

Jan Schreuder said:

I'm not really a VB.Net developer, but my guess is that is should be something like this:
-------------------------------------
Public Delegate Sub FileEventHandler(ByVal sender As Object, ByVal e As FileEventArgs)

Public Event FileEvent As FileEventHandler

Private Function RaiseFileEvent(ByVal fileInfo As FileInfo) As Boolean
Dim continueScan As Boolean = True
Dim args As FileEventArgs = New FileEventArgs(fileInfo)
FileEvent(Me, args)
continueScan = Not args.Cancel
Return continueScan
End Function

Public Delegate Sub DirectoryEventHandler(ByVal sender As Object, ByVal e As DirectoryEventArgs)

Public Event DirectoryEvent As DirectoryEventHandler

Private Function RaiseDirectoryEvent(ByVal directory As DirectoryInfo, ByVal action As ScanDirectoryAction) As Boolean
Dim continueScan As Boolean = True
If Not (FileEvent Is Nothing) Then
Dim args As DirectoryEventArgs = New DirectoryEventArgs(directory, action)
DirectoryEvent(Me, args)
continueScan = Not args.Cancel
End If
Return continueScan
End Function

-------------------------------------

You could try and download SharpDevelop. It contains a tool to convert C# to VB.Net code (and vice versa), which sofar has helped me a lot when I needed to migrate existing C# code to VB.Net
# July 26, 2006 10:50 PM

Rick van den Bosch said:

Jan, as I blogged before (http://bloggingabout.net/blogs/rick/archive/2006/07/24/13108.aspx) Anand said they expect to release Sandcastle in August, as a part of the Visual Studio SDK CTP.
# July 28, 2006 2:09 AM

Jan Schreuder said:

Well, that's true. It would definitely be in the August CTP of the Visual Studio SDK. BUT, they would also release it as a separate CTP if possible. And so far, this has not yet been contradicted. Still, I can't wait for this to really happen.
# July 28, 2006 3:04 AM

Anand Raman said:

Jan and Rick,
Thanks for your patience. I posted the CTP at MS download center and you can get pointers through our blog site.
http://blogs.msdn.com/sandcastle

Anand..
# July 30, 2006 1:46 PM

P.J. van de Sande said:

I worked with Sandcastle this weekend (http://born2code.net/?p=41) and i'll wait for the GUI Tool.

It is far from easy and it costs way more time than our friend NDoc. The only thing is that is fast.

I'm looking forward to your conclusion!
# July 31, 2006 12:52 AM

Jan Schreuder on .Net said:

I managed to find some time to try the Sandcastle CTP on the CommandBuilder component I blogged about...
# July 31, 2006 2:14 AM

Jan Schreuder on .Net said:

I managed to find some time to try the Sandcastle CTP on the CommandBuilder component I blogged about...
# July 31, 2006 2:15 AM

P.J. van de Sande said:

I couldn't agree more with you Jan. After I readed your post, I definitely stop working on a GUI because Mikael Söderström is working on one and Microsoft will release a GUI soon.

As far as I see are the most people exiting about the documentation that Sandcastle creates but everybody is a little bit disappointed about the amount of work it takes to create documentation with Sandcastle.
I guess a good GUI will give Sandcastle a great boost in the good direction.
# July 31, 2006 2:35 AM

Anders Ljusberg said:

Hi Jan,

I've created a MSBuild script that tries to automate the process a bit. I'd appreciate any comments!

http://blog.ljusberg.com/2006/07/msbuild-script-for-sandcastle.html

Regards,

Anders Ljusberg
# July 31, 2006 7:44 AM

Mikael Söderström said:

Hi,

I am working on the GUI at the moment and I will soon release the first beta of it.

The first version will allow you to set the paths to SandCastle, a binary, a xml comment file and to HTML Help Workshop.

But in later releases I plan to have support for multiple binaries, multiple xml comment files and allow the user to save projects, and maybe even import VS 2005 projects.

If you have any wishes, please let me know.
# July 31, 2006 11:36 AM

Mikael Söderström said:

# July 31, 2006 12:37 PM

Community Server Daily News said:

news of the day a grab bag for what&#39;s happening in Community Server ASPnix goes All Community Server
# July 31, 2006 1:01 PM

P.J. van de Sande said:

Great Mikael! Looks better then the last GUI I tried.
# August 1, 2006 1:36 AM

sherif said:

How to: Set set date ranges on a Crystal Report
# August 1, 2006 10:41 PM

Marc Jacobi said:

Does anybody know if sandcastle supports VS.NET help collections besides .chm output?
# August 2, 2006 12:37 AM

Jan Schreuder said:

I'm not sure, but since it uses the Microsoft Help compiler, it should anything that the help compiler supports.

Before running the help compiler, it generates all the documentation and TOC's as HTML files. So if you have a tool that uses that information, then you could also do it that way.
# August 2, 2006 12:58 AM

Frank Kroondijk said:

Visual Studio 2005 Sandcastle Add-In

For the ones having troubles with the scripts, here a super easy add-in, with source code.

Having troubles getting it started?, let me know!

Video:
http://www.overnight.nl/download/sandcastleaddin.html

Post with rest of the links:
http://dotnetpret.blogspot.com/2006/08/sandcastle-continued-documentation.html

Cheers,

Frank Kroondijk
fh_kro<NO-SPAM>ondijk@yahoo.com
# August 4, 2006 2:32 AM

llebron said:

Thanks for your help. The key to solving the problem was using
If Not FileEventEvent is Nothing

If Not DirectoryEventEvent is Nothing.

Btw, how do you deal with permission issues. When I try to go through my C:\ drive it alwasys stops at the System Volume Information folder with an access denied. I would like to skip the System folders and process the rest
# August 7, 2006 6:22 PM

Jan Schreuder said:

The easiest way to deal with that is to catch the UnauthorizedAccessException exception. If you specifically catch that exception you can allow the application to continue.
# August 7, 2006 11:21 PM

llebron said:

Thanks for all your help. I'm fairly new to .Net. Can you provide tell me on which function or subroutine I need to catch the UnauthorizedAccessException. Would it be the WalkDirectories and WalkFilesInDirectories functions?

thanks
# August 8, 2006 5:33 AM

Jan Schreuder said:

WalkFilesInDirectories is the most likely candidate. Both would be the safest option.
# August 8, 2006 12:14 PM

spaccabit said:

# August 9, 2006 12:24 AM

Jan Schreuder on .Net said:

A few weeks ago, Patrick Wellink blogged about how you would get a copy of a DLL when it's in the GAC....
# August 9, 2006 12:47 AM

P.J. van de Sande said:

Increasing the build number is only done by the Build Server?
# August 9, 2006 12:48 AM

Ramon Smits said:

We have a daily build system at our current project. The build server increases the build number every day. When a developer does a local build on his workstation then it always has the buildnumber 9999. I personally don't like the local buildnumber of the fixed 9999. Would have been better if it would start at 10000 and increment for each build. This way you can more easily spot build dependancy errors.

I use subversion at home. Subversion has revision numbers for check-ins. My CI build system uses that number as the buildnumber.

This almost has the same effect as the daily build server and labels on source-safe.

You could say that we use the revision number for production patches at a version number branch.

The major/minor identify a branch in the repository and should match with a certian set of functionality or stability requirements.

I also like the linux versioning scheme:
http://en.wikipedia.org/wiki/Linux_kernel#Version_numbering

Which if quite relaxed to identify increments within a project and hotfixes on those increments. You would lose the buildnumber though so you should use something else to identify the build.
# August 9, 2006 12:49 AM

Ramon Smits said:

The assembly directory is probably always %WINDIR%\Assembly so you could use that environment variable.
# August 9, 2006 1:01 AM

Jan Schreuder said:

Yep, that is correct. So you can create a small batchfile to call this application.
# August 9, 2006 1:30 AM

Erwyn van der Meer said:

I agree with the major/minor/revision part of your versioning scheme.

But I would distinguish the file version from the assembly version, i.e., the AssemblyVersionAttribute and the AssemblyFileVersionAttribute. In the assembly version I keep the build number fixed at 0 to prevent problems with having to update strong named references that use the assembly version number for each build. In the file version the build number is set by the build server and increased after each build. For a local build by a developer a fixed build number can be used for the file version.

So increasing the major/minor/revision part of the version number is a conscious decision and might involve updating strong name references. Increasing the build number is done automatically. The build number in the file version is irrelevant for binding.
# August 9, 2006 3:36 AM

Ramon Smits said:

@Erwyn: Jups.. the assembly version is static in our builds. Didn't directly reflect is to .net but this is the case for our .net deliverables.

The file version is very important for installers! Installers only look at the major.minor.revision and ignore the buildnumber. If an installer sees that a dll with version 1.2.3(.2) is installed and you install another product with dll 1.2.3(6) then the installer ignores the .6 library.
# August 9, 2006 3:57 AM

Olaf Conijn said:

I believe the way most java-guys do this makes pretty much sense to me:

A: complete new release
B: some public APIchanges have occured that might be breaking
C: some public API might have been added, not breaking.
D: no public API or breaking changes. only bugfixes inside the current API.

# August 9, 2006 2:09 PM

Paul Gielens said:

These guidelines make sense. We use the exact same protocol with the exception of the build number. The build numbers is increased for every nightly team- or cruisebuild to match the exact nr. of builds executed.
# August 9, 2006 2:40 PM

Jan Schreuder on .Net said:

I've spent some time playing with Microsoft's solution to build documentation based on XML tags in your code. This post gives a brief recap of what I experienced as well as providing links to help you get started.
# August 11, 2006 6:02 AM

Jan Schreuder on .Net said:

I've spent some time playing with Microsoft's solution to build documentation based on XML tags in your code. This post gives a brief recap of what I experienced as well as providing links to help you get started.
# August 11, 2006 11:51 PM

Frank Kroondijk said:

Hi Jan,

Saw you referring to my VS2005 add-in, well for your information and the rest of te world, you now can download an msi installation. Not only for sandcastle feature but also for statistics and classdiagram export.

http://www.codeplex.com/Wiki/View.aspx?ProjectName=SandcastleAddIn

Succes er mee en hoor graag feedback.

Groet,
Frank
# August 13, 2006 12:51 PM

Dennis van der Stelt said:

Community Server just keeps getting better and better, providing more features then I could even imagine
# August 14, 2006 5:56 AM

Jeff said:

I ran into almost the exact same problem - thanks for posting your solution - saved me a lot of time
# October 18, 2006 6:24 AM

ShoddyCoder said:

I agree... I never got hit with the comment spam, but the trackback spam forced me to just disable comments and trackbacks all together... it is a pity.
# October 19, 2006 6:41 AM

Patrick Wellink said:

Have a read of this one.... http://bloggingabout.net/blogs/wellink/archive/2005/04/05/3213.aspx I still think there is a market for this.... Seti against spammers.... and Seti against products spammed for..... So not only Spam the guy who is trying to sell viagra, but spam Pfizer as wel for doing business with a spammer...
# October 20, 2006 6:08 AM

krs said:

Great little tool that helped me with some specific problems with using datasets to quickly generate a testing framework for integration tests. But I noticed a small problem. In the GetColumnDetails method in LCommandBuilder.cs (lines 324/325) the ColumnDetail method is invoked, but the parameters precision and scale are passed in the wrong order. This can cause trouble with updating decimal/numeric columns but is easy to fix by moving the precision value before the scale. This worked for me: (Int16)row["NumericPrecision"], (Int16)row["NumericScale"]
# October 20, 2006 9:25 AM

Jan Schreuder on .Net said:

As I mentioned before , I will be attending the Microsoft European TechEd in Barcelona from November

# October 27, 2006 1:13 AM

Erwyn van der Meer said:

Those boxes look pretty slick. The first one (Windows Vista Ultimate Edition) is going to be expensive though. Hopefully it will be included in our MSDN Subscription. But then we will only get the ISO and not the cool box ;(
# October 31, 2006 8:30 AM

Ramon Smits said:

The concept is ok but it just does not work. They should have added delay times as the vid.nl reports plus the speedtraps from flitsservice.nl But I just never use this site for trafficjam information. The data shown is mostly incorrect or outdated :( By the way.. ever seen website of the belgium traffic center? http://www.verkeerscentrum.be/verkeersinfo/ Just visit the site during rush hours and notice that most days no real traffic jams are reported. Aaaah just the way I like traffic information "No traffic jams reported". By the way.. I live in Rotterdam but I have collegues from belgium :)
# November 2, 2006 4:21 AM

Jan Schreuder said:

Hmm, well I checked vid.nl and traphic.nl and both gave me identical information. So I guess it's ok ;-)

# November 2, 2006 4:54 AM

Ramon Smits said:

Good tip Jan! We also use this here at our projects. We call it a "GlobalAssemblyInfo" because we share it accross multipe solutions. We also extended it with some #if..#else..#endif's to add some more extensions. For example.. we keep te assembly info the same while working on the same branch and increase the fileversion. This depends on the type of build. We also add if the build is a Release, Developer, Continious Integration or Patch build.
# November 3, 2006 7:38 AM

Jean-Paul Smit said:

Please keep the unhappy few left here in the Netherlands informed.

Have fun over there!

# November 6, 2006 7:04 AM

Mike's Blog said:

Introduction CopySourceAsHTML will give you an error while using it in a Microsoft Virtual PC (I'm probably
# November 6, 2006 12:16 PM

Dennis' Blog said:

Jan wrote that he sees possibilities in Windows Presentation Foundation, for one that he doesn't need

# November 8, 2006 12:46 AM

Dennis van der stelt said:

Could you explain lambda expressions a bit? I'm very interested in those!
# November 8, 2006 2:59 AM

Dennis van der Stelt said:

For the soap thingy, these are called DataContracts where you can specifiy what's required (mandatory) and what not. Check out the following piece of code. [DataContract(Name="ShoppingCart")] public class ShoppingCart {     [DataMember(IsRequired=true)]     Customer customer;       [DataMember(Name="ItemsInCart")]     int? items;        } int? I prefer over nullable :)
# November 9, 2006 4:24 AM

Jean-Paul Smit said:

I'm very happy with the short posts. It shows an overview of what happens there and it kind of feels like I'm also in Barcelona.

Of course the more detail the better, but that is hard with like 8 sessions a day.

# November 9, 2006 5:01 AM

Ramon Smits said:

It's the same screensaver that has always been available through sysinternals.com but they are currently migrating that website to the microsoft domain thus also all its downloads. The only thing missing the sourcecode that is (still) available at sysinternals.com.
# November 9, 2006 10:59 AM

TechEd 2006 at WPF Exploration said:

PingBack from http://arnoud.org/weblog/?p=11
# November 10, 2006 1:25 AM

ShoddyCoder said:

Hey cool, I knew there was a combination to do that, and I was recently looking for it for C# code... that is my biggest pet peeve in C# is that the editor experience isn't as good as in VB for formatting... my 2nd pet peeve while I'm on the subject is when you type a using statement at the top the intellisense menu (which overall is "better" than vb) doesn't pop down. I'm assuming you got your VB to look like that by running it through a converter... Thanks for the tip :D
# November 15, 2006 7:47 AM

Mike Glaser said:

Report Builder is available since the beginning of SQL Server Reporting Services 2005. Before it was also available as an add-on to SQL Server Reporting Services 2000 delivered by a company called ActiveViews. try http://www.activeviews.com and you will be suprised where you end up. Not ;-). New to SP2 is Oracle Support in Report Builder. Users will now be able to use Report Builder on top of Oracle data sources.
# November 15, 2006 10:48 PM

Mike Glaser said:

Report Builder is available since the beginning of SQL Server Reporting Services 2005. Before it was also available as an add-on to SQL Server Reporting Services 2000 delivered by a company called ActiveViews. try http://www.activeviews.com and you will be suprised where you end up. Not ;-).

New to SP2 is Oracle Support in Report Builder. Users will now be able to use Report Builder on top of Oracle data sources.

# November 15, 2006 10:48 PM

Mike Glaser said:

Report Builder is available since the beginning of SQL Server Reporting Services 2005. Before it was also available as an add-on to SQL Server Reporting Services 2000 delivered by a company called ActiveViews. try http://www.activeviews.com and you will be suprised where you end up. Not ;-).

New to SP2 is Oracle Support in Report Builder. Users will now be able to use Report Builder on top of Oracle data sources.

# November 15, 2006 10:49 PM

Dennis van der Stelt said:

Two things

- C# requires case senstivity, so streamwriter won't work.

- If you haven't referenced the assembly, it can't find the namespace. Obviously, but it does suck! ;)

# November 16, 2006 5:28 AM

Jan Schreuder said:

I know C# is case sensitive, but trust me, the key-combination Alt+Shift+F12 does actually find the namespace if you type streamwriter instead of StreamWriter. The new option in VS 2005 is case-sensitive. And yeah, you do need the assembly... I updated the post!

# November 16, 2006 5:39 AM

Web Links 11.21.2006 « Rhonda Tipton’s WebLog said:

PingBack from http://rtipton.wordpress.com/2006/11/21/web-links-11212006/
# November 21, 2006 5:47 AM

Daily News Faq List said:

Dennis van der Stelt with a step-by-step guide on how to disable email notifications of Spam , linking
# November 22, 2006 8:25 AM

Daily News Faq List said:

Jan Schreuder takes anonymous comments offline because of spam at bloggingabout.net , linking to a post
# November 22, 2006 8:26 AM

Daily News Faq List said:

Jan Schreuder on changing the settings in CopySourceAsHtml for best use with Community Server.
# November 22, 2006 8:38 AM

davidvl said:

Hello Jan,

Opening a new tab is considered equivalent to opening a new Window (Ctrl+N) in the same IE client application. You can verify this behaviour in IE6.

Apparently, the original - and newly opened window or tab share cookies.

Was this what you meant?

Keep up the good writing ;)

Regards,

David van Leerdam

# December 11, 2006 1:35 AM

Ramon Smits said:

This is the same with IE6 as long as you don't fork a new IE proces but open up new windows with CTRL+N.

And Firefox also has this same behaviour. If you don't want this behaviour then just launch a new instance.

# December 11, 2006 2:53 AM

Web Log di M.rkino said:

Ecco arrivati all'ultimo atto di

# February 27, 2007 1:19 PM

davidvl said:

Jan,

Weird. The full name with the 'Attribute' postfix is the .NET Framework class name of the attribute, but as far as I know the 'Attribute' postfix is not required when using the attribute as an attribute (for readability, the compiler expands the attribute name when the attribute is applied on the class).

See also:

http://www.ondotnet.com/pub/a/dotnet/excerpt/vbnut_8/index1.html

In other words, both are syntactically correct and - should be equal in result. I wonder if this is reproducable and whether it is a bug or not.

Keep up the good writing.

Regards,

David van Leerdam

# March 5, 2007 3:15 AM

Community Server Bits said:

Dennis van der Stelt with a step-by-step guide on how to disable email notifications of Spam , linking

# March 12, 2007 8:31 AM

Community Server Bits said:

Jan Schreuder takes anonymous comments offline because of spam at bloggingabout.net , linking to a post
# March 12, 2007 8:33 AM

Community Server Bits said:

Jan Schreuder on changing the settings in CopySourceAsHtml for best use with Community Server.

# March 12, 2007 8:47 AM

Jan Schreuder on .Net said:

Exactly one month ago, I blogged about XML Notepad 2007 . XML Notepad 2007 is the replacement for the

# March 23, 2007 5:59 AM

Richthofen said:

I think the combo to do this without selecting the text is Ctrl-K Ctrl-D

# March 29, 2007 9:26 AM

steampunk said:

Just out of curiosity, do you think this has anything to do with the Time Zone update (http://support.microsoft.com/kb/928388) earlier this year?  My company switched to TFS before the time zone changes went into effect, but I've never run into that problem in the 14+ months I had  been using VSS 2005.  

You would think it wouldn't be a problem, but you never know.

# April 5, 2007 2:30 PM

Jan Schreuder said:

I really wouldn't know. It did annoy me though.

# April 5, 2007 11:29 PM

Johan; thinking out loud. » Managing several AssemblyInfo files in Visual Studio said:

PingBack from http://idstam.com/en/index.php/2007/05/02/managing-several-assemblyinfo-files-in-visual-studio/
# May 2, 2007 5:42 AM

Robin Paardekam said:

Thanks Jan, this is very helpful.
# June 6, 2007 2:49 PM

Jan Schreuder on .Net said:

Author : Jan Schreuder After years of experience as a developer in multiple languages, Jan shares his vision on software development with the world.

# June 13, 2007 9:02 AM

kenson goo said:

awesome procedures! I like them
# June 20, 2007 10:19 PM

Prema said:

How to hide the Main Reprot Display? I just want to display the report page nothing else.

# July 5, 2007 11:53 AM

Jan Schreuder said:

Use the ViewerTabs method and set the Visible argument to false

# July 6, 2007 10:03 AM

jack said:

Thanks, great code

# July 11, 2007 6:04 PM

Jose Mauricci said:

Hi Jan, i need your CrystlaHelper to use it into my application but the link to the zip file dont work.

Thankz

# July 18, 2007 10:19 PM

Martin said:

Hi, I have a report that has one OUT parameter, and one IN-OUT Parameter.  It links to an Oracle Stored Procedure.  My default value for the parameter was 5.

Im calling the report from a C# Windows application, and letting it export to a PDF file.

My report runs fine and exports perfectly using the default parameter.

But as soon as i set the parameter and then try export it then i get the error message: Error in file.. Failed to load database information.

It also mentions the crdb_oracle.dll file.

Why does this happen when i pass a parameter.  It works fine if i dont pass the parameter..?

Please help me..

TIA

Martin

# August 2, 2007 4:02 PM

Tim said:

Good. Thanks.

# August 2, 2007 10:12 PM

rudi said:

is there any sample using oracle database...

# August 7, 2007 6:40 AM

Jan Schreuder said:

No, I'm sorry. But when you use the DataSet examples in my demo application, you could fill the tables with information from an Oracle database. The helper class has no Sql specific stuff.

# August 7, 2007 8:38 AM

Sandeep said:

How to show total number of pages in crystal report instead of 1+, 2+, 3+ ....

# August 9, 2007 11:55 AM

Jan Schreuder said:

Show where? In the document is easy, it's a special field.

# August 9, 2007 4:05 PM

Jscript said:

Hi Am try to create Document for JavaScript

Using Script Doc I creatd ORG(*.org) as well as (*.xml)

But i do not know how to generate Document using SandCastle ?

pls give any useful idea

# August 14, 2007 12:46 PM

Jan Schreuder said:

You should check out the Sandcastle blog (blogs.msdn.com/sandcastle) and in particular this post: blogs.msdn.com/sandcastle/archive/2007/06/28/scriptdoc-1-0-for-extractiong-javascript-code-comments-is-now-available-at-codeplex.aspx

It describes a tool which you can use to extract comments for JavaScript.

# August 14, 2007 4:57 PM

Dave said:

Thanks Jan for this post.  If you have any questions please let me know.

# August 16, 2007 5:56 AM

Nils Gruson said:

Hi Jan,

Maybe you can update the URL, since GotDotNet is a thing of the past: www.jtleigh.com/.../CopySourceAsHtml

# August 18, 2007 12:01 AM

Niels said:

Scanning the HTML is only 1/3th of the job. Look for changes in the .css and .js files as well (client-side ofcourse!). You can use the Developer Toolbar from Microsoft for this, or -in case of Firefox- something like Firebug.

# October 23, 2007 10:21 AM

David van Leerdam said:

Hi Jan,

Are you using stylesheets (CSS) or other external sources that might cause this behaviour?

Kind regards,

David van Leerdam

# October 23, 2007 10:39 AM

Jan Schreuder said:

There are of course stylesheets involved. But they are very static, and I apply the same style sheet each time.

# October 23, 2007 10:50 AM

Leo said:

Hi,

  how to use devMetrics in vs2005? I can't add devMetrics in vs2005.I do it according as MSDN,but I am failed.Can you helo me?

Thanks!

# October 25, 2007 5:29 AM

Jan Schreuder said:

I really wouldn't know. I have not been able to use DevMetrics in vs2005 either

# October 26, 2007 10:41 AM

Kevin Thomas said:

StripTimeFromDate was very useful for me.  Thanks.

# October 29, 2007 10:27 AM

Jan Schreuder on .Net said:

Only a few weeks after the September release of Sandcastle, Microsoft have already released the October

# October 30, 2007 9:11 AM

Web 2.0 - Social Media - Internet News - Blogging » Sandcastle October 2007 CTP released said:

Pingback from  Web 2.0 - Social Media - Internet News - Blogging &raquo; Sandcastle October 2007 CTP released

# October 30, 2007 9:52 AM

Web 2.0 - Social Media - Internet News - Blogging » .Net Zip library said:

Pingback from  Web 2.0 - Social Media - Internet News - Blogging &raquo; .Net Zip library

# October 31, 2007 1:10 PM

John Brookes said:

This is a bit off-topic, but can you tell me how to monitor traffic on a computer, such as writing to a USB drive or CD?

-Just thought a man of your talents would have some idea.

Thanks in advance,

JB

# November 1, 2007 9:11 PM

krata said:

super many thanx

# November 3, 2007 10:21 PM

James David said:

Have you seen Highlight? I believe it supports Soundex searches: www.shuffletext.com/Highlight

# November 22, 2007 6:18 AM

Vinay Chandrashekar said:

I am new to c#.Could any one please tell me the procedure to skip System Volume Information folder while scanning for all folders in a particular drive.

I just read here u can do it by catching UnauthorizedAccessException.I am not sure what to write inside the catch block so that my application countinues working even if it encounters this exception.

# December 2, 2007 9:47 AM

Hari said:

Thanks for your excellent code and this is useful for me.But, I like to know how can I get the assembly with their version name instead of file name.I have more than one assembly with the same name but different versions in the GAC.I want to get a specific version needed.How can I do this?

# December 7, 2007 11:26 PM

Wim said:

Some customers aren't even ready to make the switch to vs2005 .. same with sql 2000 ... we just have some servers switched to 2005 .. next year 2008 comes and 2000 isn't supported anymore at the end of next year .. hmmm .. some work to do here..

Wim

# December 10, 2007 11:31 AM

christian kuhle said:

the netherlands has a very modern network of interstates . it is easy , to pass the country by in 2 - 3 hours . in earlier times i was often in the netherlands . the most modern motorways are in - for my opinion  - around and in rotterdam , dortdrecht and the hague . it is good , that many motorways are illuminated since a few years .

# December 10, 2007 5:34 PM

Matthijs said:

I don't know about the COM exception, but I think you can avoid the use of ServerXMLHTTP30Class altogether using the following code:

HttpWebResponse response;

WebRequest request = HttpWebRequest.Create("http://www.bloggingabout.net");

request.Timeout = 5000;

try

{

   response = (HttpWebResponse)request.GetResponse();

}

catch (WebException wex)

{

   response = (HttpWebResponse)wex.Response;

}

Console.WriteLine("{0} - {1}: {2}",

  (int)response.StatusCode,

  response.StatusCode,

  response.StatusDescription);

# December 12, 2007 1:53 PM

Jan Schreuder said:

I know this solution, but we abandoned it because it leans pretty heavy on the Exceptions thrown and it requires the server to render the entire request including rendering of the images. The ServerXMLHTTP30Class merely retrieves the response header. We did checks between both options and the ServerXMLHTTP30Class was faster.

# December 12, 2007 2:14 PM

Matthijs said:

You can add 1 line to only request the headers using the HttpWebRequest object, just like you do with [http.open("HEAD"...].

This should be just as fast:

request.Method = WebRequestMethods.Http.Head;

# December 12, 2007 2:32 PM

sam said:

Thanks alot for your article...It was really helpful as I am having the same senario for my application.

# December 17, 2007 12:03 PM

Mischa Kroon said:

A good thing is the first procedure gets optimised in SQL server 2005.

See this for more info:

milambda.blogspot.com/.../exists-or-not-exists-that-is-question.html

# December 25, 2007 11:51 PM

KooKiz said:

Maybe I missed something, but I don't find the "Add link" button on Visual Studio 2003, only on the 2005 version :/

How did you add a link with VS2003 ?

# January 2, 2008 4:42 PM

Jan Schreuder said:

Yes, you missed something. On the open button in VS 2003 you will see an arrow down on the right-hand side. Click that, and you should be able to select link.

# January 3, 2008 8:53 PM

KooKiz said:

I know what's the problem : this trick doesn't work with an ASP.NET project. Damn, it would have been so useful :/

# January 4, 2008 11:15 AM

Bidhan Das said:

please give me the project

# January 22, 2008 2:34 PM

Damien Guard said:

If we're going back as far as ME why not add MS-DOS 4.0 to the list?

Better yet Microsoft Access for DOS - a communications package that was quickly dropped and the name recycled a few years later for the database package we know today.

[)amien

# February 6, 2008 12:26 PM

Dave Sexton said:

I'm interested, but where's the article?  :)

# February 8, 2008 11:07 AM

Jan Schreuder said:

Sorry, but I forgot to add a link to the article. I updated the post, so have look!

# February 8, 2008 1:45 PM

Umesh Mali said:

Download and run WindowsXP-KB945007-x86-ENU.exe from windows downloads. This will solve your problem. If you are using Windows server 2003 then install and run WindowsServer2003-KB945007-x86-ENU.exe

# February 12, 2008 11:26 AM

Yash said:

Hi Jan,

I have been using your code with some modification and it works perfectly for me in the Prod environment.

Thanks a lot.

Yash

# February 14, 2008 8:08 PM

Jan Schreuder said:

There is no project, just the steps I explain in this post.

# February 15, 2008 10:04 AM

La Web de Programación said:

Lista de esquemas de colores para Visual Studio 2005/2008 : Yo me quedo con la de Oren Ellenbogen poniendo

# February 20, 2008 11:07 PM

Gary said:

This is great!  Thanks

# March 5, 2008 7:17 PM

Doug said:

Context, Context, Context. Fine arguments you guys pose, but what if you want to say display different messages based on the results of the condition? In that case nested if's with corresponding else's might be your best shot or setting variables as suggested, but then you will have to check the values in the variables again(more ifs)

# March 14, 2008 4:15 PM

SergioTarrillo's RichWeblog said:

Construyendo comandos para consultas a base de datos, es un tema que siempre despierta interés y siempre

# March 24, 2008 7:43 AM

phronima said:

I installed the redistribution msi but there was no files under system_web\2_0_50727?

But if i use the merge module I will get sub folders

Either way, I've done all that but am still getting image stubs aka red X on the image.. Any ideas? This is my third day trying to get my UAT machine back up..

# March 28, 2008 5:34 AM

Javier said:

Regards,

I am using the Sandcastle Help File Builder v1604, Sandcastle January release 2008 and HTML Help WorkShop v1.3, and create a document in chm, my problem is that creates my file output class.chm without problem, but on having opened, I see the namespace, the methods, etc, but do not see your description, is empty. I need to solve urgently this problem, please help me.

Thanks,

Javier

# March 31, 2008 9:24 PM

Syed Hasan Zubair said:

Thanks, Your aaplication help me alot.

# April 11, 2008 1:26 PM

Pieter Joost van de Sande said:

"

I enjoyed the article! :)

"
# April 11, 2008 6:25 PM

Zaf said:

How does one connect an access DB using the tool. Btw great work! I have been using this component for a while on MSSQL but never on MS Access. How do I do it?

# April 12, 2008 3:55 AM

Johan; thinking out loud. » Managing several AssemblyInfo files in Visual Studio said:

Pingback from  Johan; thinking out loud. &raquo; Managing several AssemblyInfo files in Visual Studio

# April 15, 2008 9:37 AM

Ashley Reddy said:

I wouldn't use an exception for flow control.

Using :

catch (IOException)    {        return false;    }

is not a good idea.

But if it works for you then more power to you!

# May 6, 2008 1:02 AM

Sangram said:

Hi,

I just want to know  the comments ///.... are essential for the sandcastle to understand or can i use

/*

<summary> some description </summary>

*/

instead

/// <summary>

/// some description

//</summary>

I have tried with the first one but it is giving me error as

D:\ProgramFiles\Sandcastle\Examples\sandcastle>csc /t:library /doc:comments2.xml test.cs

Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42

for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727

Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.

test.cs(18,18): warning CS1591: Missing XML comment for publicly visible type or member 'TestNamespace.StoredNumber'

D:\Program Files\Sandcastle\Examples\sandcastle>

# May 8, 2008 9:22 AM

Mahesh said:

Thanks Jan. Good article on CR..I just tried it and got the result. Keep your good work.

# May 9, 2008 9:39 AM

Vinod Robert said:

Hi

I am very much thankful for your effort in making such a wonderful piece of code.

May GOD Bless You

# May 14, 2008 6:16 PM

David said:

Destroying applications? Interesting..

# May 14, 2008 11:26 PM

Armando Miani said:

I used too.. very nice. thanks.

# May 22, 2008 1:07 AM

deploying a project in visual studio 2003 said:

Pingback from  deploying a project in visual studio 2003

# May 30, 2008 10:35 PM

Joe said:

I am deploying a VS 2008 C# application, using Crystal Reports 9. Do I still use the VS 2008 merge modules, or should I use something else???

Is it worth it to convert to CR Basic for VS 2008???

# June 3, 2008 6:22 PM

DAN said:

StripTimeFromDate is very nice :)

Saved my Time :)

Keep up the good work.

# June 4, 2008 2:01 PM

Anish said:

Gr8 works fine!!

# June 5, 2008 8:15 AM

Efrain said:

Hi,

thank you for this information. I followed all these steps on a Windows 2008 Server and the app runs. However, when I select a report to display I get a yellow screen saying "fail to render page" and the reports dont show up. If, however, I click on one of the drilldown options  I get data displayed.

This has something to do with the charts i have on the report, however, I have looked everywhere and have not been able to find any fix specific for Windows 2008 Server.

# June 5, 2008 4:29 PM

thecardinal said:

it say that the cast of toolstrip to the pageview and i get an error?

# June 17, 2008 4:01 AM

veljkoz said:

If you are using Crystal Reports for Visual Studio 2008, in order for your application to work when you deploy it, the most simple way to do it is to install on client computer the "Crystal Reports Basic for Visual Studio .NET 2008" msi package - see support.businessobjects.com/.../runtime.asp

After it installs, applications can use CR... very painless, and no need to use the merge modules

# June 17, 2008 11:42 PM

Jan Schreuder said:

That is correct.

# June 18, 2008 8:59 AM

Jan Schreuder said:

You could try and download the code for my Crystal Helper class here: www.codeproject.com/.../CrystalHelper.aspx. The helper class contains methods that do what I describe in this post. There's also a demo application in there that shows how the methods work.

# June 18, 2008 9:02 AM

Vivek said:

Hey thats gr8 Information, this might also be helpful dotnetguts.blogspot.com/.../understanding-datetime-and-timespan-in.html

# June 18, 2008 7:20 PM

Sandeep Targe(Rahata) said:

I cant get the event ::ViewerStatusBar & ViewerTabs, do we have to import any other classes?? Can any one help me?

# July 21, 2008 2:01 PM

HITESH said:

i have a sql server named abc where i configure all the crystal reports. they work perfectly allright.

Now i take the published version on the deployment site. I change the sql server name to pqr and configure the web application.

But do i need to configure each and every crystal reports to the new server settings?

I do have a lot of reports.

if that is so i ll again have to publish them at the site.

cant i just make the changes in the web.config?

# July 21, 2008 4:09 PM

Jan Schreuder said:

ViewerStatusBar and ViewerTabs are methods, not events. So when you want to use these methods to disable the tabs and/or status bar then you simply call them when the control will be displayed.

# July 22, 2008 11:10 AM

John Doe said:

I find StyleCop quiet interesting, but I disagree with some of the rules and it's sad if you cannot configure them, so you cannot enforce your own corporate coding style.

What bugs me even more is that I have to "correct" all those issues manually so that tool does not save me any work, instead it causes even more.

That is why I prefer a tool that *automatically* applies our *custom* styles to the source. This is why I love ReSharper where you can define your own settings and it can even apply it to your whole solution at your fingertips.

So, my conclusion on StyleCop is: Nice idea, but barely handy.

# July 25, 2008 2:50 PM

Jan Schreuder said:

I don't agree with some of rules either, but I tend to have that with almost all coding standards. All of them have one or more rules I don't really like or even completely oppose. However, Microsoft are promissing some degree of fine-tuning and will focus on automatic correction if that is possible. So for me this will do, eventhough ReSharper is better at customizing.

# July 25, 2008 2:59 PM

Larz said:

Wonderful, just wonderful. Thanks for sharing this, it's been a great help.

# July 25, 2008 9:28 PM

Jan Schreuder on .Net said:

If there's one thing that developers usually just cannot (or will not) agree to, then it's Coding

# July 25, 2008 10:11 PM

Erwyn van der Meer said:

StyleCop is not a Microsoft product. It was developed by a couple of Microsoft employees for their own product development. They decided to release it in public, because it might be of use to other developers. And it sure is useful! However, the rules in this tool should not be viewed as THE Microsoft coding guidelines rules. Feel free to turn off rules you don't like. For example, I always turn off the strange rule that says you should put your using statements for namespaces within a namespace declaration.

For more background info about StyleCop, see blogs.msdn.com/.../clearing-up-confusion.aspx

# July 26, 2008 7:03 AM

Nathan Pledger said:

I use and have encouraged our team at work to use the Philips Coding Standards (www.tiobe.com/.../gemrcsharpcs.pdf) with a few defined exceptions:

- private members to be prefixed _ and be in camel case

- constants are in CAPS

I'm a big fan of not relying on syntax highlighting or intellisense to help guide the eye of the purpose of a line of code, so will utilise every case/punctuation method I can to help differentiate items.

And you're right, a standard is not a standard if people don't use it. While (I believe) my coding standards are exceptional (I must confess to a small amount of OCD in my styling of code!), others often don't see it as being quite so important. I think we have a happy medium, though. Any shared projects do tend to meet these standards.

# July 26, 2008 4:30 PM

Christopher Steen said:

Link Listing - July 26, 2008

# July 27, 2008 5:31 PM

Jan Schreuder said:

Good to know Erwyn, thanks. I was under the impression that, although it was an internal tool that it would get more a Microsoft badge. Kinda like Sandcastle.

# July 28, 2008 9:07 AM

Dave Coates said:

Great post. Thank you.

I blog every fews with some tech tips and code. Would you like to place a link under your favourite blogs if I would do the same? It's all legit. I have recently moved to another city and am in the process if setting up a .NET community for the local developers. The aim is to be the communication portal to Microsoft regarding .NET developer events and information.

The website address -> http://pedotnet.blogspot.com

Regards,

Dave Coates

Port Elizabeth .NET Community

http://pedotnet.blogspot.com

# July 28, 2008 11:11 AM

Jan Schreuder said:

Thanks Nathan. Interesting read, those Philips Coding Standards. I noticed also that a lot of the rules are found in FxCop. A number of them are also checked by StyleCop. Using those tools might help you enforce the coding standards.

# July 28, 2008 3:52 PM

Jan Schreuder on .Net said:

Some of you brought another solution for importing text files to my attention. Thank you for that! For

# July 29, 2008 3:42 PM

Problem in deployment said:

I deploy the crystal report.  My application runs fine but when clicking the button which tries to launch a crystal report my problem.  It gives a Microsoft C++ Runtime Library Runtime Error! Program: C:/windows/Microsoft.Net/Framework/v.2.0.50727/aspnet_wp.exe    and if clicked finally it takes me to the Service Application Unavailable.

Please advice.  This is very urgent and because of this problem we did not deploy this in client for the past two months.

# July 30, 2008 1:05 PM

jsibrahimeye said:

report uses charts.  works fine on development machine

when I call from FlexBuilder, the chart report does not work

note: other reports which only display data records work fine.

the space where the charts should be displayed contain the following two lines

CrystalReportViewer - CrystalReportViewer1

Error: Fail to render the page.

please help me

# July 30, 2008 1:08 PM

Jan Schreuder on .Net said:

Because I blog about Crystal Reports occasionally, and created a helper class to assist in integrating

# July 30, 2008 1:42 PM

Jan Schreuder said:

I'm really sorry, but I don't have all the answers to problems you all may have with Crystal. But check out this bloggingabout.net/.../need-help-with-crystal-reports-look-here.aspx" or this bloggingabout.net/.../sap-is-annoying-me.aspx". These posts contain links to web sites that may help you solve the problems you might have.

# July 30, 2008 1:45 PM

Arun Sabat said:

Download merge modules for VS2005 link is not working.

The businessobject site redirects mr to

www.businessobjects.com/.../default.asp

Can you please give me the latest link to download merge module for VS2005

# July 31, 2008 9:09 AM

Jan Schreuder said:

The people from SAP have changed the entire website, so the links don't work anymore. Please check this link for updates: bloggingabout.net/.../need-help-with-crystal-reports-look-here.aspx

# July 31, 2008 11:55 AM

Rahn said:

While normally I'd agree with Ashely above about not using exceptions to control flow, in the case of a file being in use by another process, I've never found another way of doing it.

So, I'd do it your way.

The other thing I added to yours was:

 catch (UnauthorizedAccessException)

      { return false; }

below the IOException catch. I hit this when copying whole directories over to the site I'm watching, and I have the watcher set to monitor subdirectories.

Thanks for the article.

# August 1, 2008 3:12 PM

Karl Proctor said:

Excellent article. This was just what the doctor ordered. Worked first time, and allowed me to integrate into the project I was working on.

Thanks

# August 4, 2008 4:22 PM

Nancy Forbes said:

I was able to deploy a report in a .NET 2003 project.  There were some issues with the graphic images and since we are upgrading to VS 2008 in a month I went ahead and downloaded VS 2008 eval early.  I ran the redistributable msi on my development web server but I'm getting 'OBJECT REFERENCE NOT SET TO AN INSTANCE OF AN OBJECT' error on the report.  In my 2003 project I had to create a virtual directory that pointed to the Crystal dll's. to resolve this.  I've tried that on my 2008 project but no joy.  I've problaby have named the virtual wrong as I can't find any documentation for 2008.  I found the 2003 documentation here:  boc.sdn.sap.com/.../235   Ideas?

# August 6, 2008 11:16 PM

Jan Schreuder said:

I have no idea. My best guess is to post this question either in the sap Crystal Reports forum (for links see here: bloggingabout.net/.../sap-is-annoying-me.aspx) or in the Microsoft Crystal Forum: forums.msdn.microsoft.com/.../threads

# August 7, 2008 8:34 AM

Eddie said:

Thank you for posting this. It works very well. The VB.NET 2008 version is:

   Private Sub HideCrystalViewerTab()

       Dim tempcontrol As TabControl = crtPDFView.Controls(0).Controls(0)

       With tempcontrol

           .ItemSize = New Size(0, 1)

           .SizeMode = TabSizeMode.Fixed

           .Appearance = TabAppearance.Buttons

       End With

   End Sub

# August 8, 2008 10:11 AM

pzkpfw said:

Thanks!

# August 14, 2008 6:33 AM

shree said:

mergemodule for Crystal report 2008 required

# August 14, 2008 6:56 AM

Jan Schreuder said:

Check the links in the post. And look at the download section of the SAP portal for Crystal Reports.

# August 14, 2008 8:27 AM

Anita B. said:

The problem is occurring because you have to check out the bin and obj folders in your project.  When you check out the project, it doesn't automatically checkout the bin and obj folders.   I hope this helps

# August 14, 2008 7:55 PM

Jan Schreuder said:

yes, that usually locks the files. I never check in objects or binaries. So still don't understand why this happened. It only happened once.

# August 14, 2008 8:32 PM

Nancy Forbes said:

This is how you deploy Crystal to a Web Site with Visual Studio 2008.

1.Install the CRRedist2008_x86.msi on the web server

2.You will also need to copy a directory and its contents from your computer to the root web of any web site that you create Crystal Reports in.  On my computer this directory was located at:  C:\Inetpub\wwwroot\aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer4  You will need to copy it in the aspnet_client\system_web\2_0_50727 folder of the root web you are installing the Crystal Report application.  See forums.asp.net/.../992330.aspx for additional information - this fixes problems with the Crystal Toolbar.

3. When you create a report within your asp.net application, it will not publish by default.  You need to change the properties on the report.  I haven't experimented a lot with these but changing the Build Action to "Content" and the Copy to Output Directory to either "Copy on Newer" or "Copy always" worked for me.  

4.  I also experienced fewer problems if when I published, I chose to Delete existing files.

The following VB code sample is provided for anyone else who is struggling with passing parameters via a querystring.  This is much simpler than most of the examples that I found on the net.

Imports CrystalDecisions.Shared

Imports CrystalDecisions.CrystalReports.Engine

Partial Public Class myASPNETPAGE

   Inherits System.Web.UI.Page

   Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

       Dim myReport As New TheReportName

       myReport.Load(Server.MapPath("TheReportName.rpt"))

       myReport.SetParameterValue("@Par1", CInt(Request.QueryString("P1")))

       myReport.SetParameterValue("@Par2", Request.QueryString("P2"))

       'Connection Info

       Dim myConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo

       Dim myTableLogOnInfo As New CrystalDecisions.Shared.TableLogOnInfo

       Dim myDatabase = myReport.Database

       Dim myTables = myDatabase.Tables

       Dim myTable As CrystalDecisions.CrystalReports.Engine.Table

       myConnectionInfo.ServerName = "DatabaseServer"

       myConnectionInfo.DatabaseName = "Database"

       myConnectionInfo.UserID = "UserAccount"

       myConnectionInfo.Password = "Password"

       For Each myTable In myTables

           myTableLogOnInfo = myTable.LogOnInfo

           myTableLogOnInfo.ConnectionInfo = myConnectionInfo

           myTable.ApplyLogOnInfo(myTableLogOnInfo)

       Next

       CrystalReportViewer1.ReportSource = myReport

   End Sub

   Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

   End Sub

   Protected Sub CrystalReportViewer1_Init(ByVal sender As Object, ByVal e As EventArgs) Handles CrystalReportViewer1.Init

   End Sub

End Class    

# August 15, 2008 12:08 AM

cbiggs said:

Have you ever seen this error: The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception.

I have installed the Redist. and the Merge Modules, changed the web.config, but get this error.

Any suggestions?

# August 15, 2008 8:24 PM

haint83vn said:

Thank you so much! It helps me a lot!

# August 17, 2008 6:29 AM

George said:

How to change the CrystalReportViewer to read MyProject/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer3/html ,not root/aspnet_client?

thanks

# August 19, 2008 9:27 AM

Jan Schreuder said:

Post your questions here www.sdn.sap.com/.../businessobjects-forums

or here forums.msdn.microsoft.com/.../threads.

I'm sure someone knows the answer and perhaps you can even find the answer to your question there already.

# August 19, 2008 9:38 AM

RaviSimha said:

Excellent job... how u solve all this. how much experienced u r.

# August 22, 2008 7:22 AM

Christopher Steen said:

Link Listing - August 21, 2008

# August 22, 2008 1:56 PM

Warren Leslie said:

Your listings above talk about the visual studio 6 family but the links go to newer versions (probably due to Microsoft changing the content)

# August 26, 2008 8:31 PM

Henry said:

thanks god...for the link, i've been waiting for anyone to show me that link, i hate Business Objects

own Crystal Reports..

# August 27, 2008 5:27 AM

Henry said:

i was able to deploy CR in VS .Net 2003, but also have

got another problem. the export, print, and other CR View toolbar doesn't appear corectly. the condition was:in my form i'm using tab control that have view tabpage and there's a CR view for each tab page...it doesn't happen before i deploy it...why is it possible...ideas???????????

# August 27, 2008 5:59 AM

Jan Schreuder said:

Is it an ASP.Net of WinForms application

# August 27, 2008 9:18 AM

Jan Schreuder said:

The links point to pages for Visual Studio .Net versions, and show the short-cuts when you select one of the predefined schemes.

# August 27, 2008 9:21 AM

Yusif Yahya said:

I need to know how can i make my c# windows application works on any machine including it's crystal reports

the other thing that how can i make ready to work from my USB Flash (Pen )

greetings

# September 1, 2008 3:04 PM

Jan Schreuder said:

Yusif, please take time to follow the links in the post. they will point you to forum sites about Crystal reports where you can get answers to your questions.

# September 1, 2008 4:15 PM

How to change the CrystalReportViewer to read MyProject/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer3/html ,not root/aspnet_client? said:

How to change the CrystalReportViewer to read MyProject/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer3/html ,not root/aspnet_client?

thanks

# September 5, 2008 1:05 PM

Marichamy said:

Hi i tried to work in crystal report project deployment.Please send step by step deployment process...Advance thanks

# September 8, 2008 9:28 AM

Ahmad Jamal Alvi said:

I have been searching these links for many days.

You have saved my time .

Thanks Again !!!

# September 8, 2008 7:06 PM

Daniel said:

Hello, first of all thank you for the code.

I'm getting this error: "These columns don't currently have unique values" so i still can't work with the column information :( please help

# September 10, 2008 3:08 AM

sushma said:

i need a link to download crystal report mergemodule for 2005.The link is redirected to sap.i could not find that.can u help me out

# September 11, 2008 7:46 PM

Nikhil Joshi said:

The download link for VS2005 and CR12 Redist is as follows.

websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/bobj_download/main.htm

You might need to register and then download.

# September 12, 2008 11:14 AM

shafeeq said:

how i set a parameter manually in code

# September 13, 2008 9:39 AM

Bags said:

Hi,

I used the steps above and disabled some options in the settings. But even after i do apply and ok, it seems the settings are not saved. When i open the settings file next time, everything is checked and enabled. What could be the problem?

# September 15, 2008 5:50 AM

Hitesh said:

Good work, I have used it and it has copied the DLLs from the GAC. Thanks

# September 23, 2008 11:49 PM

Dhyanesh said:

I have search fo a lot and your link works for me

partilcularly

C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\CrystalReports on your machine

Thanks

# September 24, 2008 7:06 PM

bds said:

I want to build a small program that will allow me to hide my ip and browse anonymously. Any help ?

thanks in advance

# September 25, 2008 3:37 PM

Richard Kline said:

Good Article!  and timely!

I am trying to use the Jet engine to import a text file using a pipe (|) as the delimiter.

Have you had the opportunity to try "HDR=Yes;FMT=Delimited(|)" ?

OleDbDataAdapter.Fill seems to insist that the delimiter must be a comma. Using a pipe causes the entire header row to be considered the header of the first and only column.

# September 25, 2008 7:48 PM

Jan Schreuder said:

No, I never have. But perhaps you should look at filehelper.com. They have excellent (FREE) component that handles this.

# October 1, 2008 8:56 PM

Mahendra said:

Great !!

I am really happy to know that you care others.

Programmer vs Good human being

Thanks a lot !!!

# October 3, 2008 4:56 PM

Sandra L. said:

Really helpful.

# October 5, 2008 6:21 PM

Sumuri said:

I got the same problem too! but on crystal reports on windows forms and your explanations helped resolved this issue.  

Error:

"Error occured creating the form. See exception.innerexception for details. Error is :the type initializer for 'crystaldecision.crystalreports.engine.reportdocument' threw an exception."

Solution:

Deployment machine did not have the "Crystal Reports for .NET Framework 2.0" installed, which is required by Crystal Reports configured on forms using Visual Studio.NET 2005.  

Copy over the file "CRRedist2005_x86.msi" in the development machine's directory "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\CrystalReports" and paste it in your bin folder of your solution directory. When you create the setup files for you application, On the solution explorer, right-click you application setup and click properties > Prerequisites, check Crystal Reports for .NET Framework 2.0, and select second option down for the location. In you File system under your bin folder for your setup add file "CRRedist2005_x86.msi" in from the location copied to earlier, rebuld your solution and try installing.

Note that it worked for me my development & deployment environment, it may or may not work for you. Main thing though is to cnfirm all  prerequisites before rushing into deployment.

# October 7, 2008 8:40 AM

Recent URLs tagged Pocketpc - Urlrecorder said:

Pingback from  Recent URLs tagged Pocketpc - Urlrecorder

# October 9, 2008 8:17 AM

Nitin said:

Agreed the commandbuilder auto generates the commands, but after deployment if the table design changes you will still have to create new paramters for the command text. Having said that this is not a bas solution at all, just not ideal.

# October 9, 2008 8:31 PM

Jan Schreuder said:

Not quite true. The commands are generated, but so are the parameters. As long as the design only adds new columns, then the only reason for changing the code is when non null columns have been added.

# October 9, 2008 11:15 PM

Piet Koole said:

It looks like a bug. As soon as you check one optionbox the root optionbox is checked also. It should be greyed out.

I am now looking for a solution. Do you know anything more?

# October 14, 2008 11:38 AM

Jan Schreuder said:

Make sure you stylecop is not running. Perhaps even close Visual Studio and try again. I have no problems with changing the settings. If you continue to keep these problems, access this link (blogs.msdn.com/sourceanalysis) and go from there.

# October 14, 2008 12:28 PM

priyan said:

In registry, I forced tabdelimter (TABDelimited) which I was used for one of my project. Now for requirement i need to process comma delimiter file. i used following code,

OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\;Extended Properties=\"text;HDR=YES;FMT=Delimited(,)\"");

it returns only first column.

If i change the registry then it workd fine.

pls. help me to fix.

Thanks,

Priyan

# October 15, 2008 1:39 PM

Jan Schreuder said:

You need to remove the entry from the registry and think about implementing filehelper. For information, look here: bloggingabout.net/.../another-solution-to-import-text-files-tab-csv-custom.aspx

# October 15, 2008 8:34 PM

swetha said:

i am working on .net 1.1, crystalreports.

i develop a pie chart,

when i run application in my local meachine cr navigation button images, chart images are not displaying. i am getting red cross mark in place of chart.

pl help me, very urgent

# October 16, 2008 8:52 AM

Jan Schreuder said:

Try to download the redistributables for .Net 1.1 from the SAP site and re-install them onto your development machine.

# October 16, 2008 11:58 AM

matthew said:

Jan, for your second scenario you could do the following:

1. Remove the protected variables for the controls from the normal code behind cs file.

2. Delete the designer.cs file

3. Right-click on the aspx file, and select Convert to Web Application.

This technique also works for the dreaded "Unable to connect to undo manager of source file...".

# October 17, 2008 4:55 PM

Moershwar said:

Thanks for you solution, it works!

Moreshwar

# October 20, 2008 4:48 PM

Reflective Perspective - Chris Alcock » The Morning Brew #206 said:

Pingback from  Reflective Perspective - Chris Alcock  » The Morning Brew #206

# October 22, 2008 9:33 AM

archana said:

need link for merge module for visual studio 2005

# November 3, 2008 2:20 PM

Wim said:

Because [s]he doesn't know the correct syntax or workings of the ?: construction ?

Wim

# November 4, 2008 8:04 AM

Wim said:

Some 'developers' have no clue about what they are doing. So they become project managers and complain about projects not finished in time ;-)

# November 4, 2008 8:17 AM

Kim said:

Hi

great article.

I tried to to load tab delimited files, and it works fine, but when I think big, theres something wrong. When I load a 270Mb file wih 1.7 mio rows the memory for the process is about 3 times the file, going up to aroung 850Mb.

How can I prevent that? or should I go for another solution? I only need to view, not edit the file. and I'm totally new to C#.

Thanks

Kim

# November 4, 2008 2:38 PM

Jan Schreuder said:

# November 4, 2008 3:56 PM

Salim Jendoubi said:

Thanks, it was helpfull :)

# November 5, 2008 10:38 AM

Raj said:

I am installing an application of C# . Have installed Crystal 9.0 Redistributable but getting an error of

Failed to load database information ?

Can anyone help ?

# November 6, 2008 6:47 AM

Gaurav Pandey said:

Thanks Jan Schreuder for this great topic. :)

# November 6, 2008 11:26 AM

conrado said:

Crystal Report's Merge Modules can be found here:

www.sdn.sap.com/.../wiki

# November 9, 2008 6:46 AM

Benjamin Howarth said:

This is really useful! I'm debugging two services at the moment (one is dependent on the other but isn't configured as such) so this is much appreciated.

# November 14, 2008 12:07 PM

Abhay said:

A very good information provided.. thanks a tonn for the same..

Regards,

Abhay

# November 14, 2008 1:26 PM

Kareen said:

Thanks for the solution but the FileStream is locking the file for reading and you cannot move it anyway…. So I’m getting the same error…. (IO the file is used by another program)

# November 14, 2008 9:32 PM

ai said:

how to clear on a crystal report

# November 17, 2008 6:31 AM

cebastos said:

how can I generate description information into the generated .chm file?

[source code]

/// <summary>

/// Gets a value that is used to convert twips to pixels based on screen settings.

/// <returns>The conversion factor.</returns>

/// </summary>

public float TwipsPerPixelY

[generated information]

Name Description

TwipsPerPixelY    - an empty description -

# November 17, 2008 10:08 PM

Matthieu said:

Thanks a lot!!!!!!!!!!!!!!!!

# November 19, 2008 10:41 AM

reetika said:

the code worked for me

Thnx ya.

# November 24, 2008 12:50 PM

Common Assembly Attributes « Coding for Fun and Profit said:

Pingback from  Common Assembly Attributes « Coding for Fun and Profit

# November 26, 2008 4:25 AM

Jemson Sentillas said:

Thank you for this wonderful article. This is what i need for my windows application.

Thanks,

jemtech007

# December 2, 2008 1:44 AM

Writer4Geeks said:

I need to document web services and xml schemas.

Any suggestions?

# December 16, 2008 12:38 AM

Arun said:

How to pass?

# December 18, 2008 7:49 AM

Jan Schreuder said:

Pass what?

# December 18, 2008 12:12 PM

Kalyan said:

Thanks for sharing

cheers

# December 19, 2008 11:26 AM

Jed Fletcher said:

Hello I have downloaded the Crystal Reports for VS .NET 2005 - Redistributable from the link you provided however i am unable to pass parameters to my reports. Is there any way to fix this

# January 9, 2009 7:58 AM

Ankush Bindlish said:

Hi,

I need to make it running inside the build script. What would be the SandcastleBuilderConsole.exe parameters?

# January 12, 2009 9:56 AM

Jan Schreuder said:

Check my Crystal helper class at www.codeproject.com/.../CrystalHelper.aspx or post your problem here: https://boc.sdn.sap.com/ which is the SAP help site

# January 13, 2009 2:06 PM

Jan Schreuder said:

Not sure. But why not check out the forum at the CodePlex or switch to DocProject. DocProject allows you to create a .Net project inside your solution and generate the documentation from inside Visual Studio. And since it is a .Net project, you can simply build the project created using a build script.

# January 13, 2009 2:14 PM

Justin Crutchfield said:

NDoc is giving me problems.  I installed the GUI version from the link above.  It will build XML documentation, but it is not very readable.  I tried to generate the othe forms of documentation, but I got errors.  I was most interested in the Linear HTML.  Does anyone have any advice?

Justin

# January 14, 2009 2:00 PM

Jan Schreuder said:

Switch to SandCastle. Read my topics on this.

# January 14, 2009 5:40 PM

Furqan Iqbal said:

Thanx for the article.....

I was wondering what happens when there are multiple files being uploaded to the directory that is being monitored? How is that handled? Does the created event get fired multiple times at the same time.

I have a situation where I have to monitor a Directory where Incoming Fax Files are being saved by the Fax Server. I have to examine every file and figure out if its a multipage Tiff, if it is then I have to split the file into multiple files ( I have got the Tiff part going ) but I'm wondering about multiple fax files being written to the directory.

Can someone please explain....Appreciate all the help.

Thanx

# January 19, 2009 6:13 PM

Arjan Douwes said:

NDoc had and my still even have the limitation that it requires an XML file to be generated by Visual Studio in order to generate the documentation file. This tend to be a problem with ASP.NET websites.

Alternatively you could take a look at Doxygen (www.doxygen.org) in combination with graphviz (www.graphviz.org). Both are open source tools.

With doxygen you can add additional information to your documentation such as a to do list, a test list, a bug list and additional documentation pages. It can even prepare the output so that it can be directly compiled into CHM file using the HTML Help WorkShop.

Graphviz is used to generate things like the call and caller graphs for a given method.

DoxyGen can be used for any C#.NET project as it scans the source files outside the IDE for XML documentation. Not sure how it performs on VB.NET project though.

Arjan

# January 22, 2009 4:57 PM

Anderson Imes said:

I know this is an old post, but I thought I would throw my 2 cents in here.  You really should hold onto your reference to the FileStream, rather than closing it immediately.  What is something else comes along and gets a hold of your file between the time you return from "FileUploadCompleted" and your call to "Process"?

# January 23, 2009 9:51 PM

Oleg said:

How come I can't find the TabControl type, what namespace do I need? Thanks

# January 23, 2009 10:07 PM

Jan Schreuder said:

You have a point there. The solution here is simply to explain the principle. Depending on your needs, you should keep the FileStream reference. In this case, the method was just to see if the file was in use. And then you don't really need to keep the reference.

# January 25, 2009 11:12 PM

Jan Schreuder said:

depends on which tab control you need, the Windows version or the Crystal version. If you have VS 2005, try resolve to find the namespace.

# January 25, 2009 11:13 PM

Bas Lijten said:

Jan,

for some reason, both links don't work for me.

# January 26, 2009 9:20 AM

Jan Schreuder said:

The links are correct. But I'm experiencing problems as well. It looks as if blogs.msdn.com is not responding

# January 26, 2009 10:40 AM

Bane said:

Just what I was looking for.. Thanks!!

# January 29, 2009 6:55 PM

Santhosh Reddy said:

Hi,

Could you please add an example or a link to add a User Defined tag in the compiled CHM file.

santosh

# February 3, 2009 9:36 AM

Jan Schreuder said:

Santosh. Can you check this link blogs.msdn.com/.../supporting-custom-tags-in-sandcastle.aspx. If that is not the information you need, please post your question on the Developer documentation and Help System forum: social.msdn.microsoft.com/.../threads

# February 3, 2009 10:15 AM

Santhosh Reddy said:

Thanks Jan,

am able to add the new tag by modifying the main_sandcastle.xsl and the configuration files available in the Program Files\Sandcastle\Presentation\vs2005\Content folder.

# February 11, 2009 1:41 PM

sachin said:

what happens when there are multiple files being uploaded to the directory that is being monitored? How is that handled? Does the created event get fired multiple times at the same time.

Answer to the Furqan Iqbal's question is yet not been posted. Can someone answer this? appreciate all the help.... greatly awaited..

# February 13, 2009 1:03 PM

Tim Roper said:

Thank You!

I spent a lot of time trying to solve this issue. Your solution works perfectly.

# February 13, 2009 4:40 PM

Arturo said:

I recently read this wich I haven't probed yet:

I have the professional edition of Visual Studio 2008.  After poking around in VS 2008 Setup and Deployment project I found a the following:

1) Right Click on setup project in the solution explorer

2) Click Properties

3) There is a button called "Prerequisites" click it

4) in the list you will find "Crystal Reports Basic for Visual Studio 2008(x86, x64)

5) Check it off

After doing that your project will now include the CRRedist Files.

When you run the install it will install them and everything works fine.

# February 24, 2009 8:04 PM

Arturo said:

Hello: Now I have tested the above steps and It worked fine, all the crystal reports included in the project showed perfectly.

There are a lot of people running the Crystal .msi program separately and even trying to integrate in the setup program manually.

So I thank the author of the above comment: Robert McArthur from MSDN.

# February 24, 2009 9:34 PM

anony said:

thanks i needed this

# February 25, 2009 8:10 AM

Pat R said:

I am deploying a windows VS 2008 C# app that includes CR and Business Objects 12.0 as well.  I don't understand how this CR and Business Objects 12.0 relationship works, but I'm having a problem.  

I have installed the CR runtimes (tried small version, full version and both together) on the target windows server 2003 server.

When the app consumes the rpt file, the CR app throws an error saying u25azalea.dll is missing.  I find this dll in the Business Objects 12.0 folder on my development machine and try to include it on the deployment but no luck.

I guess Business Objects 12.0 in not a part of any of the CR runtimes, does that mean I need to buy Business Objects 12.0 for every target server?  I have also tried to embedd the CR rpt in the C# app and deploy, same error.

Thx,

# February 26, 2009 8:56 PM

Matt said:

The first monday of the month was great for me

# March 2, 2009 12:50 AM

Ryan said:

Thank goodness for your article.  I could not for the life of me figure out how to make these tools work.  You are a God-send! :)

# March 7, 2009 12:09 AM

Xavina said:

Thanks mate.

In my scenario Crystal was running within a System Service (service generates and send reports via email). The problem was with those reports that has a graphic.

I just added in my app.config this lines:

<add key="CrystalImageCleaner-AutoStart" value="true"/>

<add key="CrystalImageCleaner-Sleep" value="60000"/>

<add key="CrystalImageCleaner-Age" value="120000"/>

# March 10, 2009 10:29 AM

Crist said:

How can I strip the date off of a time, so I can compare two times?

# March 10, 2009 6:41 PM

Jan Schreuder said:

strip time from date works fine for that purpose

# March 10, 2009 7:12 PM

Igor said:

Thanks for your work. I've got 1 question: what event i should process to change name of subreport?

# March 12, 2009 11:40 AM

santhose said:

should i work only with "CRRedist2005_x86.msi"

but i have CRRedist2005_X64. Error occurs.

C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\CrystalReports

solution please

# March 17, 2009 7:26 AM

Dilip Tiwari said:

Hi,

I am using the .net inbuild Crystal Report.In this When I click on the Print button in Toolbar print dialog box is not comming. It is Just showing a White dialogbox and it shuold be get disappear after some time. Please mail me if anybody have a solution on diliptkumar14 --- hotmail.com

Thanks in advance

Regards,

Dilip Tiwari

# March 18, 2009 9:45 AM

Sathish said:

Close ur Running Application and Delete the /obj/ folder.

# March 19, 2009 8:46 AM

nsuresh said:

Thank you very much. It was pretty useful.

# March 24, 2009 11:49 AM

Dheeraj said:

Same problem

# March 26, 2009 10:30 AM

Sudonim said:

Many thanks.  just started getting that error after editing a fiddely page in (which has been upgraded from .Net1.1 )in VS 2008 - the protected / delete designer.cs and convert to web app solved it for me!

Thanks for taking the time to put this solution up there...

i suggest you go:

connect.microsoft.com/.../ViewFeedback.aspx

and let them know the solution :)

# March 26, 2009 12:09 PM

ravindra joshi said:

thanks

# March 30, 2009 9:26 AM

Robert said:

Ugh... sorry, Sandcastle is the biggest piece of crap since Mac OS X. Here's why: userunfriendly.wordpress.com/.../sandcastle-built-on-quicksand

# April 1, 2009 11:20 PM

Kuljit said:

Very useful.. exactly what I was looking for.

# April 5, 2009 11:00 AM

sheraz said:

I have a problem opening the report in crystalreportviewer. whenever i first time open the report it goes to sleep. alomst takes 45 secs - 1 minute or more to open it.

but in the same run if i open the report again it shows like it has everything in it.

is there any way to speed up the first time loading time of the viewer in dot net 2005.

i am using csharp code.

msherazkhan@gmail.com

# April 15, 2009 6:52 PM

Jan Schreuder said:

I think, judging by your comment, that the queries that retrieve the data take long to run. The second time, the data will be in the system cache, so it will be returned to your report faster. Try checking the time it takes to retrieve the data for your report, and see if the queries can be optimized.

If you use DataSet objects, try populating them in a separate thread. That will allow you to load the data while your application is waiting for the user to select the report.

# April 15, 2009 7:28 PM

Chris said:

Very nice, but is there any way to do something like this for C++ code in Visual Studio?

# April 16, 2009 3:13 PM

Jan Schreuder said:

I don't know, but you could try to use this solution in C++. Perhaps it works in VS 2005 and up. I know that XML and ASPX can be formatted in these versions using the same trick as the C# code.

# April 16, 2009 4:24 PM

Sekhar Aripaka said:

How can I do this in VS 2008 VB.net project?

I don't see Build tab / Conditional compilation symbols in the project properties.

Appreciate your quick reply.

Thank you,

Sekhar Aripaka

# April 20, 2009 5:10 PM

Jose Escalona said:

great article !! great explanation, it worked at the first try, thanks!

but in case of web projects or web services how it works?

# April 21, 2009 2:34 AM

Maran said:

An error has occurred while attempting to load the Crystal Reports runtime.

Either the Crystal Reports registry key permissions are insufficient or the Crystal Reports runtime is not installed correctly.

Please install the appropriate Crystal Reports redistributable (CRRedist*.msi) containing the correct version of the Crystal Reports runtime (x86, x64, or Itanium) required.  Please go to www.businessobjects.com/support for more information.

# April 23, 2009 12:47 PM

Dusan Hudecek said:

Thanks for your article.

I was pleased to use FileSystemWatcher to monitor my application directory. But when I tried to copy a couple of files there some of them did not reflected in my application. Then I found that I had some problem like you and files were still creating.

I will use your solution because it solves the problem very well I think.

Thanks

# April 24, 2009 12:05 PM

Md. Mizanur Rahman said:

I have followed all the procedures to deploy a reporting site on win 2008 server but the chart images

are not showing up. instead it is showing [X]image.

# May 4, 2009 7:01 AM

gever said:

# May 5, 2009 9:04 AM

Pickle Pumpers said:

You can also do this:

Select All: [CTRL] + A

Cut: [CTRL] + X

Paste: [CTRL] + Y

# May 12, 2009 6:03 PM

Sekhar Aripaka said:

I got the required information from blogs.msdn.com/.../559149.aspx

It works!!

Thank you,

Sekhar Aripaka

# May 13, 2009 6:57 PM

Narendra said:

Greate it really works !

# May 15, 2009 2:17 PM

Anon said:

I opened up some code today to find that a coworker who needed to change something decided to have ReSharper remove most of the parenthesis when if/else blocks had a single statement...

# May 15, 2009 7:20 PM

Jan Schreuder said:

having parenthesis on if/else blocks with a single statement is a matter of opinion. I myself would smack the person that removed them, I always add parenthesis. It can prevent errors.

# May 15, 2009 7:30 PM

Micky Toms said:

Hi all,

I got the crystal report problem solved by installing Crystal Report 2008. Their is no other ways. You don't need to convert the crystal reports done in 10.0.3600.0 to crystal report 2008, the only thing you have to do is

After installing Crystal Report 2008 make changes in the web config like this

<compilation debug="true">

<assemblies>

<add assembly="CrystalDecisions.CrystalReports.Engine, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

<add assembly="CrystalDecisions.ReportSource, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

<add assembly="CrystalDecisions.Shared, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

<add assembly="CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

<add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

<add assembly="CrystalDecisions.Enterprise.Framework, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

<add assembly="CrystalDecisions.Enterprise.InfoStore, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

</assemblies>

</compilation>

You need to change in http handler section also

<httpHandlers>

<add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

</httpHandlers>

After making these changes the next step is you have to change the web form from where the report is calling

ie,

<%@ Register Assembly="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"

   Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

Change it to

<%@ Register Assembly="CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"

   Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

Remember that DisplayGroupTree option will not support in source for CR 2008

So if any thing exists you should remove that thing like

<cr:crystalreportviewer id="crvPayGraph" runat="server" autodatabind="true" DisplayGroupTree="False" EnableDrillDown="False" OnDataBinding="crvPayGraph_DataBinding"></cr:crystalreportviewer>

You should omit that part DisplayGroupTree="False"

Instead you can provide it in the code section as

crvPayGraph.DisplayGroupTree=false;

crvPayGraph.PageZoomFactor=100;

Why I gave this thing crvPayGraph.PageZoomFactor=100 is sometimes the graph will load with zoom factor 150%.

Hope this article will help everyone struggling with Crystal Report problem.

# May 19, 2009 9:06 AM

Shuvankar said:

Hugely helpful application. Thanks for this.

# May 27, 2009 9:31 AM

Vijay said:

Thank a lot... for an wonderful article.  

# May 27, 2009 1:23 PM

Murat said:

Thanks For The code....

I convert it  to subtraction method...

It subtracts the given number only if its a working day.

DateTime SubtractWorkingDays(DateTime beginDate, int Num)

       {

           DateTime procDate = new DateTime();

           procDate = beginDate;

           int realDays = 0;

           while (Num > 0)

           {

               switch (procDate.DayOfWeek)

               {

                   case DayOfWeek.Saturday:

                       realDays++;

                       procDate = procDate.AddDays(-1);

                       continue;

                   case DayOfWeek.Sunday:

                       realDays++;

                       procDate = procDate.AddDays(-1);

                       continue;

                   default:

                       procDate = procDate.AddDays(-1);

                       Num--;

                       realDays++;

                       continue;

               }

           } return beginDate.AddDays(-realDays);

       }

# June 2, 2009 4:20 PM

mohammad said:

thanks...

# June 8, 2009 1:44 AM

dotnetguy said:

Thank you Jan !

that was helpful, was working on a tight timeline.

it saved me some of it.

# June 17, 2009 1:08 PM

Dave said:

I like the code and the event support.  Thanks!

1. I believe the search pattern solution will cause an individual file to be processed N times in the event that N of the search patterns match the file.

2. Does *.* search pattern behave the same as * with regard to extensionless files?

Cheers,

Dave

# June 19, 2009 3:57 AM

Dave said:

RaiseDirectoryEvent has some File/Directory inconsistency.

1. Should "if (FileEvent != null)" be "if (DirectoryEvent != null)"

2. Should "for the file event" be "for the directory event".

Cheers,

Dave

# June 19, 2009 4:42 AM

Dave said:

If you are interested, here is a revision of the code that...

1. fires events for UnauthorizedAccessException and continues scanning subsequent directories

2. fixes file/directory inconsistencies in RaiseDirectoryEvent()

  a. changed FileEvent to DirectoryEvent

  b. changed "for the file event" to "for the directory event"

3. initializes the _searchPattern = _patternAllFiles

(to avoid "System.NullReferenceException: Object reference not set to an instance of an object." in certain cases)

4. added a note about the search pattern logic fallout (redundant file processing)

Note:

The construction of the new try/catch blocks is critical (i.e., not bracketing more code than is necessary).  This ensures proper processing when 1. scanning directories only and 2. scanning directories and files.

namespace ScanDirectoryDemo

{

   /// <summary>

   /// Defines the action on a directory which triggered the event

   /// </summary>

   public enum ScanDirectoryAction

   {

       /// <summary>

       /// Enter a directory

       /// </summary>

       Enter,

       /// <summary>

       /// Leave a directory

       /// </summary>

       Leave

   }

   #region Event argument definition for ScanDirectory.FileEvent

   /// <summary>

   /// Information about the file in the current directory.

   /// </summary>

   public class FileEventArgs : EventArgs

   {

       #region Constructors

       /// <summary>

       /// Block the default constructor.

       /// </summary>

       private FileEventArgs() {    }

       /// <summary>

       /// Initializes a new instance of the <see cref="DirectoryEventArgs"/> class.

       /// </summary>

       /// <param name="fileInfo"><see cref="FileInfo"/> object for the current file.</param>

       internal FileEventArgs(FileInfo fileInfo)

       {

           if (fileInfo == null) throw new ArgumentNullException("fileInfo");

           // Get File information

           _fileInfo = fileInfo;

       }

       #endregion

       #region Properties

       private bool            _cancel;

       private FileInfo        _fileInfo;

       /// <summary>

       /// Gets the current file information.

       /// </summary>

       /// <value>The <see cref="FileInfo"/> object for the current file.</value>

       public FileInfo Info

       {

           get { return _fileInfo; }

       }

       /// <summary>

       /// Gets or sets a value indicating whether to cancel the directory scan.

       /// </summary>

       /// <value>

       /// <see langword="true"/> if the scan must be cancelled; otherwise, <see langword="false"/>.

       /// </value>

       public bool Cancel

       {

           get { return _cancel; }

           set { _cancel = value; }

       }

       #endregion

   }

   #endregion

   #region Event argument definition for ScanDirectory.DirectoryEvent

   /// <summary>

   /// Event arguments for the DirectoryEvent

   /// </summary>

   public class DirectoryEventArgs : EventArgs

   {

       #region Constructors

       /// <summary>

       /// Block the default constructor.

       /// </summary>

       private DirectoryEventArgs() {    }

       /// <summary>

       /// Initializes a new instance of the <see cref="DirectoryEventArgs"/> class.

       /// </summary>

       /// <param name="directory"><see cref="DirectoryInfo"/> object for the current path.</param>

       /// <param name="action">The action.</param>

       internal DirectoryEventArgs(DirectoryInfo directory, ScanDirectoryAction action)

       {

           if (directory == null) throw new ArgumentNullException("directory");

           // Get File information

           _directoryInfo = directory;

           _action = action;

       }

       #endregion

       #region Properties

       private DirectoryInfo        _directoryInfo;

       private ScanDirectoryAction    _action;

       private bool                _cancel;

       /// <summary>

       /// Gets the current directory information.

       /// </summary>

       /// <value>The <see cref="DirectoryInfo"/> object for the current directory.</value>

       public DirectoryInfo Info

       {

           get { return _directoryInfo; }

       }

       /// <summary>

       /// Gets the current directory action.

       /// </summary>

       /// <value>The <see cref="ScanDirectoryAction"/> action value.</value>

       public ScanDirectoryAction Action

       {

           get { return _action; }

       }

       /// <summary>

       /// Gets or sets a value indicating whether to cancel the directory scan.

       /// </summary>

       /// <value>

       /// <see langword="true"/> if the scan must be cancelled; otherwise, <see langword="false"/>.

       /// </value>

       public bool Cancel

       {

           get { return _cancel; }

           set { _cancel = value; }

       }

       #endregion

   }

   #endregion

   #region Event argument definition for ScanDirectory.UnauthorizedAccessExceptionEvent

   /// <summary>

   /// Event arguments for the UnauthorizedAccessExceptionEvent

   /// </summary>

   public class UnauthorizedAccessExceptionEventArgs : EventArgs

   {

       #region Constructors

       /// <summary>

       /// Block the default constructor.

       /// </summary>

       private UnauthorizedAccessExceptionEventArgs() { }

       /// <summary>

       /// Initializes a new instance of the <see cref="UnauthorizedAccessExceptionEventArgs"/> class.

       /// </summary>

       /// <param name="directory"><see cref="DirectoryInfo"/> object for the current path.</param>

       /// <param name="action">The action.</param>

       internal UnauthorizedAccessExceptionEventArgs(DirectoryInfo directory, UnauthorizedAccessException exception)

       {

           if (directory == null) throw new ArgumentNullException("directory");

           _directoryInfo = directory;

           _exception = exception;

       }

       #endregion

       #region Properties

       private DirectoryInfo _directoryInfo;

       private UnauthorizedAccessException _exception;

       private bool _cancel;

       /// <summary>

       /// Gets the current directory information.

       /// </summary>

       /// <value>The <see cref="DirectoryInfo"/> object for the current directory.</value>

       public DirectoryInfo Info

       {

           get { return _directoryInfo; }

       }

       /// <summary>

       /// Gets the current UnauthorizedAccessException.

       /// </summary>

       /// <value>The <see cref="UnauthorizedAccessException"/> exception value.</value>

       public UnauthorizedAccessException Exception

       {

           get { return _exception; }

       }

       /// <summary>

       /// Gets or sets a value indicating whether to cancel the directory scan.

       /// </summary>

       /// <value>

       /// <see langword="true"/> if the scan must be cancelled; otherwise, <see langword="false"/>.

       /// </value>

       public bool Cancel

       {

           get { return _cancel; }

           set { _cancel = value; }

       }

       #endregion

   }

   #endregion

   /// <summary>

   /// Scan directory trees

   /// </summary>

   public class ScanDirectory

   {

       private const string _patternAllFiles = "*.*";

       #region Handling of the FileEvent

       /// <summary>

       /// Definition for the FileEvent.

       ///    </summary>

       public delegate void FileEventHandler(object sender, FileEventArgs e);

       /// <summary>

       /// Event is raised for each file in a directory.

       /// </summary>

       public event FileEventHandler FileEvent;

       /// <summary>

       /// Raises the file event.

       /// </summary>

       /// <param name="fileInfo"><see cref="FileInfo"/> object for the current file.</param>

       private bool RaiseFileEvent(FileInfo fileInfo)

       {

           bool continueScan = true;

           // Create a new argument object for the file event.

           FileEventArgs args = new FileEventArgs(fileInfo);

           // Now raise the event.

           FileEvent(this, args);

           continueScan = !args.Cancel;

           return continueScan;

       }

       #endregion

       #region Handling of the DirectoryEvent

       /// <summary>

       /// Definition for the DirectoryEvent.

       /// </summary>

       public delegate void DirectoryEventHandler(object sender, DirectoryEventArgs e);

       /// <summary>

       /// Event is raised for each directory.

       /// </summary>

       public event DirectoryEventHandler DirectoryEvent;

       /// <summary>

       /// Raises the directory event.

       /// </summary>

       /// <param name="directory"><see cref="DirectoryInfo"/> object for the current path.</param>

       /// <param name="action">The <see cref="ScanDirectoryAction"/> action value.</param>

       /// <returns><see langword="true"/> when the scan is allowed to continue. <see langword="false"/> if otherwise;</returns>

       private bool RaiseDirectoryEvent(DirectoryInfo directory, ScanDirectoryAction action)

       {

           bool continueScan = true;

           // Only do something when the event has been declared.

           if (DirectoryEvent != null)

           {

               // Create a new argument object for the directory event.

               DirectoryEventArgs args = new DirectoryEventArgs(directory, action);

               // Now raise the event.

               DirectoryEvent(this, args);

               continueScan = !args.Cancel;

           }

           return continueScan;

       }

       #endregion

       #region Handling of the UnauthorizedAccessExceptionEvent

       /// <summary>

       /// Definition for the UnauthorizedAccessExceptionEvent.

       /// </summary>

       public delegate void UnauthorizedAccessExceptionEventHandler(object sender, UnauthorizedAccessExceptionEventArgs e);

       /// <summary>

       /// Event is raised for each UnauthorizedAccessException.

       /// </summary>

       public event UnauthorizedAccessExceptionEventHandler UnauthorizedAccessExceptionEvent;

       /// <summary>

       /// Raises the UnauthorizedAccessException event.

       /// </summary>

       /// <param name="directory"><see cref="DirectoryInfo"/> object for the current path.</param>

       /// <param name="exception">The <see cref="UnauthorizedAccessException"/> action value.</param>

       /// <returns><see langword="true"/> when the scan is allowed to continue. <see langword="false"/> if otherwise;</returns>

       private bool RaiseUnauthorizedAccessExceptionEvent(DirectoryInfo directory, UnauthorizedAccessException exception)

       {

           bool continueScan = true;

           // Only do something when the event has been declared.

           if (UnauthorizedAccessExceptionEvent != null)

           {

               // Create a new argument object for the UnauthorizedAccessException event.

               UnauthorizedAccessExceptionEventArgs args = new UnauthorizedAccessExceptionEventArgs(directory, exception);

               // Now raise the event.

               UnauthorizedAccessExceptionEvent(this, args);

               continueScan = !args.Cancel;

           }

           return continueScan;

       }

       #endregion

       #region Public methods

       /// <summary>

       /// Walks the specified path.

       /// </summary>

       /// <param name="path">The path.</param>

       /// <returns><see langword="true"/> when the scan finished without being interupted. <see langword="false"/> if otherwise;</returns>

       public bool WalkDirectory(string path)

       {

           // Validate path argument.

           if (path == null || path.Length == 0) throw new ArgumentNullException("path");

           return WalkDirectory(new DirectoryInfo(path));

       }

       /// <summary>

       /// Walks the specified directory.

       /// </summary>

       /// <param name="directory"><see cref="DirectoryInfo"/> object for the current path.</param>

       /// <returns><see langword="true"/> when the scan finished without being interupted. <see langword="false"/> if otherwise;</returns>

       public bool WalkDirectory(DirectoryInfo directory)

       {

           if (directory == null)

           {

               throw new ArgumentNullException("directory");

           }

           return WalkDirectories(directory);

       }

       #endregion

       #region Overridable methods

       /// <summary>

       /// Processes the directory.

       /// </summary>

       /// <param name="directoryInfo">The directory info.</param>

       /// <param name="action">The action.</param>

       /// <returns><see langword="true"/> when the scan is allowed to continue. <see langword="false"/> if otherwise;</returns>

       public virtual bool ProcessDirectory(DirectoryInfo directoryInfo, ScanDirectoryAction action)

       {

           if (DirectoryEvent != null)

           {

               return RaiseDirectoryEvent(directoryInfo, action);

           }    

           return true;

       }

       /// <summary>

       /// Processes the file.

       /// </summary>

       /// <param name="fileInfo">The file info.</param>

       /// <returns><see langword="true"/> when the scan is allowed to continue. <see langword="false"/> if otherwise;</returns>

       public virtual bool ProcessFile(FileInfo fileInfo)

       {

           // Only do something when the event has been declared.

           if (FileEvent != null)

           {

               RaiseFileEvent(fileInfo);

           }

           return true;

       }

       #endregion

       #region Private methods

       /// <summary>

       /// Walks the directory tree starting at the specified directory.

       /// </summary>

       /// <param name="directory"><see cref="DirectoryInfo"/> object for the current directory.</param>

       /// <returns><see langword="true"/> when the scan is allowed to continue. <see langword="false"/> if otherwise;</returns>

       private bool WalkDirectories(DirectoryInfo directory)

       {

           bool continueScan = true;

           if (continueScan = ProcessDirectory(directory, ScanDirectoryAction.Enter))

           {

               // Only scan the files in this path when a file event was specified

               if (this.FileEvent != null)

               {

                   continueScan = WalkFilesInDirectory(directory);

               }

               if (continueScan)

               {

                   DirectoryInfo[] subDirectories;

                   try

                   {

                       subDirectories = directory.GetDirectories();

                   }

                   catch (UnauthorizedAccessException e)

                   {

                       Console.WriteLine("UnauthorizedAccessException in " + directory.FullName + "("+e.Message+")");

                       subDirectories = null;

                   }

                   if (subDirectories != null)

                   {

                       foreach (DirectoryInfo subDirectory in subDirectories)

                       {

                           // It is possible that users create a recursive directory by mounting a drive

                           // into an existing directory on that same drive. If so, the attributes

                           // will have the ReparsePoint flag active. The directory is then skipped.

                           // See: blogs.msdn.com/.../332704.aspx

                           if ((subDirectory.Attributes & FileAttributes.ReparsePoint) != 0)

                           {

                               continue;

                           }

                           if (!(continueScan = WalkDirectory(subDirectory)))

                           {

                               break;

                           }

                       }

                   }

               }

               if (continueScan)

               {

                   continueScan = this.ProcessDirectory(directory, ScanDirectoryAction.Leave);

               }

           }

           return continueScan;

       }

       /// <summary>

       /// Walks the directory tree starting at the specified path.

       /// </summary>

       /// <param name="directory"><see cref="DirectoryInfo"/> object for the current path.</param>

       /// <returns><see langword="true"/> when the scan was cancelled. <see langword="false"/> if otherwise;</returns>

       private bool WalkFilesInDirectory(DirectoryInfo directory)

       {

           bool continueScan = true;

           // Break up the search pattern in separate patterns

           string [] searchPatterns = _searchPattern.Split(';');

           /**

            *  tempdt

            *    This search pattern strategy will cause files to be hit in order of

            *    the search pattern.  Also, is it possible we get dups when a file matches

            *    more than 1 of the patterns?

            */

           // Try to find files for each search pattern

           foreach (string searchPattern in searchPatterns)

           {

               if (!continueScan)

               {

                   break;

               }

               // Identify all files in the current path

               FileInfo[] files;

               try

               {

                   files = directory.GetFiles(searchPattern);

               }

               catch (UnauthorizedAccessException e)

               {

                   Console.WriteLine("UnauthorizedAccessException in " + directory.FullName + "(" + e.Message + ")");

                   files = null;

               }

               // Scan all files in the current path

               if (files != null)

               {

                   foreach (FileInfo file in files)

                   {

                       if (!(continueScan = this.ProcessFile(file)))

                       {

                           break;

                       }

                   }

               }

           }

           return continueScan;

       }

       #endregion

       #region Properties

       private string _searchPattern = _patternAllFiles;

       /// <summary>

       /// Gets or sets the search pattern.

       /// </summary>

       /// <example>

       /// You can specify more than one seach pattern

       /// </example>

       /// <value>The search pattern.</value>

       public string SearchPattern

       {

           get { return _searchPattern;  }

           set

           {

               // When an empty value is specified, the search pattern will be the default (= *.*)

               if (value == null || value.Trim().Length == 0)

               {

                   _searchPattern = _patternAllFiles;

               }

               else

               {

                   _searchPattern = value;

                   // make sure the pattern does not end with a semi-colon

                   _searchPattern = _searchPattern.TrimEnd(new char [] {';'});

               }

           }

       }

       #endregion

   }

}

# June 19, 2009 6:00 AM

Nandhini said:

Hello sir,

I want to the required coding.

             Thanking you

# June 19, 2009 8:02 AM

Kuhl said:

Just wanted to know...what is this "SELECT TOP 1 1 FROM DELETED" in the trigger....what does it do......

# June 19, 2009 4:45 PM

Jan Schreuder said:

the code is in this blog post.

# June 23, 2009 2:48 PM

Jan Schreuder said:

What that does is returning 1 when there is at least one entry in the Delete table. It's an indication that data is removed from the table on which you have created the trigger.

# June 23, 2009 2:54 PM

shawn said:

Be aware that Title casing isn't correct linguistically, particularly for non-English languages.  (In English we don't title case words like "of" and "a").

# July 9, 2009 11:02 PM

Fadzai Chamba said:

Funny I came across this when I was about to do this as my first blog here.

I often find myself writing code to bridge the little differences between VB (my preferred langauge) and C# for other developers so that we can all be on the same page.

VB has always had the StrConv() method/function which accepts as a parameter the type of conversion you want to make.

With the advent of .NET 3.5 and extension methods, I have written this into a class library for my C# based colleagues so that we can do the same kind of processing for certain fields in our applications.

We always Title Case (Proper Case in VB) customer names and job titles but the C# guys had no way of doing this. I then wrote a little utility class for them with extension  methods that look like so..

//This is air-code so excuse any errors

   public static class StringExtensions

   {

       public static string ToTitle(this string input)

       {

           return input.ToTitle(System.Globalization.CultureInfo.CurrentCulture);

       }

       public static string ToTitle(this string input, System.Globalization.CultureInfo culture)

       {

           return culture.TextInfo.ToTitleCase(input);

       }

       public static string ToTitleInvariant(this string input)

       {

           return input.ToTitle(System.Globalization.CultureInfo.InvariantCulture);

       }

   }

You would then call this like a method on the string class and it gets everyone on the same page.

# July 14, 2009 2:42 PM

Tom said:

thanks for sharing!

# July 20, 2009 11:26 AM

Anon said:

Thanks so much...

You've saved me a lot of time!

# July 23, 2009 10:56 PM

Dan said:

I'm sure you've heard of thedailywtf.com?  To some developers, index=speed, so why not index every column to make it as fast as possible.

# August 6, 2009 3:25 PM

Srikanth said:

If you are looking for the physical location where your GACed DLL is saved in the file system, try this:

start-->run-->c:\windows\assembly\gac

If you don't find your DLL related folder in there, you can do a "Up" folder in windows explorer to display everything in c:\windows\assembly as folder structures. You can then look for your DLL under GAC_MSIL or any other folder out there....

Once, you identify your DLL, you can copy it as you normally do with windows explorer. Hope this helps!

Cheers,

Srikanth

# August 6, 2009 8:53 PM

Michael said:

This worked for me:

In *.csproj files, change

<DebugType>pdbonly</DebugType> and <DebugType>full</DebugType>

to <DebugType>none</DebugType>

# August 6, 2009 11:58 PM

Tariq Ahmed said:

nice post...

# August 9, 2009 1:22 PM

Alex Paranko said:

What if a new field is added to a table?

# August 13, 2009 4:30 PM

Jan Schreuder said:

Then this version of the trigger is going to break. You have to consider two options here.

You could modify the script to select the columns by name, rather then a simple *. When you add a column, the trigger will not break, but changes made to the new column will not be audited.

Or leave it as it is, and ensure you add the new column to both tables. You'd have to make sure the columns in both tables are in identical order.

# August 13, 2009 9:36 PM

Alex Paranko said:

Having to maintain two set of tables could be a headache.

I just modified the trigger so now it can create and audit new columns on the fly. I removed both "update" and "insert" logic since I'm only using on-delete

There are still some issues, like if TRG_ACTION and TRG_DATE are removed from the audit table, or if the datatype is changed in a column.  But that could be easily added.

Thank you very much for the code.

CREATE TRIGGER ##YOUR_TABLE##_Delete

ON [DBO].[##YOUR_TABLE##]

AFTER DELETE

AS

-- JUST CHANGE ##YOUR_TABLE## INTO YOUR OWN TABLENAME TO MAKE IT WORK

DECLARE @SQLSTRING VARCHAR(2000)

DECLARE @SQLColumns VARCHAR(2000)

DECLARE @CUR INTEGER

DECLARE @MAX INTEGER

DECLARE @SQLSTR AS VARCHAR(8000)

DECLARE @CURCOL SYSNAME

DECLARE @COLUMN_NAME SYSNAME

DECLARE @COLUMN_TYPE AS VARCHAR(10)

DECLARE @COLUMN_LENGTH INT

DECLARE @MEMTABLE TABLE

(

    ID INT

   ,COLUMN_NAME SYSNAME

   ,COLUMN_TYPE VARCHAR(20)

,COLUMN_LENGTH int

)

IF NOT EXISTS (SELECT * FROM SYSOBJECTS WHERE ID = OBJECT_ID(N'[DBO].[AUDIT_##YOUR_TABLE##]') AND OBJECTPROPERTY(ID,N'ISUSERTABLE') = 1)

BEGIN

-- CREATE A MEMORY TABLE CONTAINING THE FIELDS AND TYPES OF THE TABLE

-- INSERT THE COLUMNAMES AND THE DATATYPES

INSERT @MEMTABLE

   (ID,COLUMN_NAME,COLUMN_TYPE)

   SELECT row_number() OVER (ORDER BY SYS.ID), SYS.NAME,TYPE_NAME(SYS.XTYPE)

   FROM  SYSCOLUMNS SYS WHERE SYS.ID = OBJECT_ID('##YOUR_TABLE##')

   ORDER BY SYS.COLID

-- SETUP VARIABLES

SET @SQLSTR = ''

SET @CUR=1

SELECT @MAX = ISNULL(MAX(ID),0) FROM @MEMTABLE

-- LOOP EVEY FIELD

WHILE @CUR <= @MAX

BEGIN

   -- GET VALUES FROM THE MEMTABLE    

   SELECT @COLUMN_NAME = COLUMN_NAME,@COLUMN_TYPE = COLUMN_TYPE FROM @MEMTABLE WHERE ID = @CUR

   IF @COLUMN_TYPE = 'INT' OR @COLUMN_TYPE = 'BIGINT' OR @COLUMN_TYPE='UNIQUEIDENTIFIER'

       -- WE DO WANT TO COPY INT/BIGINT/UNIQUEIDENTIFIER FIELDS BUT IF THEY ARE AN

       -- IDENTITY OR A ROWGUIDCOLUMN WE DO NOT WANT TO COPY THAT ATTRIBUTES

       SET @SQLSTR = @SQLSTR + ' CAST('+@COLUMN_NAME + ' AS '+@COLUMN_TYPE+') AS [' + @COLUMN_NAME +'] '

   ELSE

       -- ANOTHER FIELD DO NOTHING JUST COPY IT AS IT IS

       SET @SQLSTR = @SQLSTR + ' '+@COLUMN_NAME + ' AS [' + @COLUMN_NAME +'] '

   IF @CUR <= @MAX - 1

SET @SQLSTR=@SQLSTR + ','

   SET @CUR = @CUR + 1

END

-- ADD THE HIST FIELDS

SET @SQLSTR = @SQLSTR +',CAST(''      '' AS CHAR(6)) AS TRG_ACTION,CAST(GETDATE() AS DATETIME) AS TRG_DATE'

-- SET UP THE SELECT FOR CREATING THE HIST TABLE

SET @SQLSTR = 'SELECT TOP 0 ' + @SQLSTR + ' INTO [DBO].[AUDIT_##YOUR_TABLE##] FROM [DBO].[##YOUR_TABLE##]'

EXEC(@SQLSTR)

--SELECT @SQLSTR

END

--FIND MISSING COLUMNS IN AUDIT TABLE AND STORE THEM IN @MEMTABLE

IF     (SELECT COUNT(*) FROM  INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '##YOUR_TABLE##'

AND COLUMN_NAME NOT IN (SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'AUDIT_##YOUR_TABLE##' )) > 0

BEGIN

DELETE @MEMTABLE

INSERT @MEMTABLE

   (ID,COLUMN_NAME,COLUMN_TYPE,COLUMN_LENGTH)

   SELECT row_number() OVER (ORDER BY SYS.ID),SYS.NAME,TYPE_NAME(SYS.XTYPE),SYS.[LENGTH]

   FROM  SYSCOLUMNS SYS WHERE SYS.ID = OBJECT_ID('##YOUR_TABLE##')

AND SYS.NAME NOT IN (SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'AUDIT_##YOUR_TABLE##' )

   ORDER BY SYS.COLID

SET @SQLSTR = ''

SET @CUR=1

SELECT @MAX = ISNULL(MAX(ID),0) FROM @MEMTABLE

-- LOOP EVEY FIELD

WHILE @CUR <= @MAX

BEGIN

SELECT @COLUMN_NAME = COLUMN_NAME,@COLUMN_TYPE = COLUMN_TYPE, @COLUMN_LENGTH = COLUMN_LENGTH FROM @MEMTABLE WHERE ID = @CUR

IF @COLUMN_TYPE = 'varchar' OR @COLUMN_TYPE ='char' OR @COLUMN_TYPE='nvarchar'

SET @SQLSTR = @SQLSTR + @COLUMN_NAME + ' ' + @COLUMN_TYPE + '(' + CAST(@COLUMN_LENGTH AS VARCHAR(10)) + ')'

ELSE

SET @SQLSTR = @SQLSTR + @COLUMN_NAME + ' ' + @COLUMN_TYPE

IF @CUR <= @MAX - 1

SET @SQLSTR = @SQLSTR + ','

SET @CUR = @CUR + 1  

END

--SELECT N'ALTER TABLE AUDIT_##YOUR_TABLE## ADD ' + @SQLSTR

EXEC(N'ALTER TABLE AUDIT_##YOUR_TABLE## ADD ' + @SQLSTR )

--SELECT 'ALTER AUDIT_##YOUR_TABLE## ADD (' + @SQLSTR + ')'

END

--COPY DELETED RECORDS TO MEMORY TABLE SO IT CAN BE USED WITH DYMANIC QUERY

IF OBJECT_ID('###YOUR_TABLE##_DELETED') IS NOT NULL

DROP TABLE ###YOUR_TABLE##_DELETED

SELECT * INTO ###YOUR_TABLE##_DELETED FROM ##YOUR_TABLE## WHERE TABLEID = (SELECT MAX(TABLEID) FROM ##YOUR_TABLE##)

--GET STRING FOR COLUMNS EXISTING IN BOTH ##YOUR_TABLE## AND AUDIT_##YOUR_TABLE##

SELECT DISTINCT @SQLColumns = STUFF(

(SELECT ',' + COLUMN_NAME FROM

(SELECT DISTINCT COLUMN_NAME FROM

INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'AUDIT_##YOUR_TABLE##' AND

COLUMN_NAME IN

(SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '##YOUR_TABLE##') )

AS SC FOR XML PATH('')),1,1,'')

EXEC(N'INSERT INTO [DBO].[AUDIT_##YOUR_TABLE##] (' + @SQLColumns + ',TRG_DATE) SELECT ' + @SQLColumns + ',GETDATE() FROM ###YOUR_TABLE##_DELETED')

DROP TABLE ###YOUR_TABLE##_DELETED

# August 14, 2009 8:04 PM

Alex Paranko said:

In the query I recently submitted,

SELECT * INTO ###YOUR_TABLE##_DELETED FROM ##YOUR_TABLE## WHERE TABLEID = (SELECT MAX(TABLEID) FROM ##YOUR_TABLE##)

needs to be changed by:

SELECT * INTO ###YOUR_TABLE##_DELETED FROM DELETED

I was testing :)

# August 14, 2009 8:08 PM

Jan Schreuder said:

I wonder how this performs. It's a lot more database actions, I think, compared to the original code. Especially since you need to check for changes in columns every time the code is triggered.

# August 14, 2009 9:56 PM

Max said:

Thanks for posting your code and comments Jan (and to everyone who commented on this article). I have a similar problem that everyone is facing, but with a slight twist. Here's the scenario:

My company has been using an Ftp program called RoboFtp to drop text data files into a folder. As soon as the files are there, a program utilizing the FileSystemWatcher object then launches an exe to process the files. This process has been working like a charm for the past 5 years or so. However, recently we tried to change the process to take out the RoboFtp program out of the equation. The files now are being dropped by some legacy mainframe programs using their own Ftp program. And since we switched, we have encountered a file access violation issue twice in the past 2 weeks. The odd thing is that this process works most of the time, but fails occasionally.

Does anyone know how to explain this problem?

Thanks

Max

# August 19, 2009 10:19 PM

joven said:

tnx your solution works :)

# August 20, 2009 8:43 AM

shahzad said:

Can I hide business object button on top right corner?

# August 24, 2009 10:53 PM

reza said:

if condition1 then

statment1

if condition2 then

statment2

end if

end if

is it a true ? pls?

# August 25, 2009 4:29 PM

Yumi Nanako said:

Heh, thanks. It's a really useful tip.. Mostly I use it to re-align my code in ASP.NET where my HTML tags really get messy.

# August 26, 2009 5:13 PM

Jan Schreuder said:

Yes you can. But you'll have to find the control to disable yourself. What my code does is walk through the tree of controls in the viewer control and disables the ones I recognize. A similar trick needs to be done for the BO button.

# August 26, 2009 7:31 PM

Evan Richardson said:

This may just be exactly what I'm looking for, but I don't know much about SQL, so let me run this by you for clarification so that I fully understand what this does, and if it's what we need.    I've got an application I wrote that manages our site installation data, and that syncs with a central SQL server over the internet whenever a user hits a "Sync" button. (bi directional).   One of the features that our field engineers asked for was to have a log of any changes made, and by who made them.  Am I correct in understanding that this trigger will copy ANY column updated in your table to a new table?  so say for example, I update device serial number, and maybe device description on one item... and then update device location, and device IP for a different device, will it record just that data in the audit table?  or doe this copy the whole row?    I need something that just logs a date/time someone updated something, and then records old value/new value.

Thanks.

# August 27, 2009 5:59 PM

Jan Schreuder said:

This trigger will simply copy the entire row into an audit table. If you're looking at logging only changed data, then this is not for you.

# August 28, 2009 8:20 AM

Dave said:

Elegant in both simplicity and usefulness - thanks for posting this.

Dave

# September 1, 2009 7:55 PM

rowter said:

I have a winforms application.

When i deploy and run the application, i get error:Report failed to load.

I have the CRRedist2008_X86 on the test machine. What other files do i need to install on the test machine for successfully running the application.

Do i need to install the crystal report runtime on the test machine?

Thanks

# September 2, 2009 4:38 AM

Gaurav said:

Thanks, really helpful.

# September 4, 2009 7:10 AM

rajeshw said:

I am facing same error as Maran ie. cr working fine on local server but on production side it throws an exception as 'An error has occurred while attempting to load the Crystal Reports runtime.

Either the Crystal Reports registry key permissions are insufficient or the Crystal Reports runtime is not installed correctly.

Please install the appropriate Crystal Reports redistributable (CRRedist*.msi) containing the correct version of the Crystal Reports runtime (x86, x64, or Itanium) required.  Please go to www.businessobjects.com/support for more information.'

any clues for this?

# September 14, 2009 7:02 AM

Jan Schreuder said:

As the message already states, you need to install the CR runtime on the production server. You can download the redistributables for this from the business objects web site.

# September 14, 2009 12:46 PM

K said:

There's no need to write a separate program just to view the service names.  Just right click and look at the properties of any service in the Services window (from admin tools) and the service name is right there.

# September 16, 2009 4:25 PM

Jan Schreuder said:

Yep, that's true. But the code was fun to write and is used to show how you can access the information using .Net.

# September 16, 2009 5:36 PM

jacques said:

its not working. please try again.

copying and pasting that into the compact framework code produces a not support exception

# September 29, 2009 4:33 PM

Jan Schreuder said:

Very likely, since the code was not written for the compact framework :-)

# September 29, 2009 8:41 PM

David said:

Micrsoft just does not understand the concept of simplicity. It's 2009 and it still takes 3+ downloads/tools to generate a damn help file(s). what is wrong with them!?

I click on their documentation to using SandCastle and it still doesn't help. It's just ridiculous.

# October 1, 2009 6:11 AM

Usman Javed said:

Good Approach, but it takes almost 1 second you can sleep that thread as well e.g Thread.Sleep(1000)

Regards,

Usman Javed

# October 2, 2009 1:38 PM

Jim Gamble said:

I have tried all of the suggestions that I have found on this topic, and I have had my web provider install the CR runtime on the server, but I still get the error message.  Everything works fine on my computer, but the error occurs when I try it on the server.

Has anyone found any other tricks to solve this problem?

# October 3, 2009 12:00 AM

basha said:

This is nioe just one line of code...i was looking at other articles which shows to read the registry and edit ...which is risky...

# October 8, 2009 3:26 PM

dani said:

thx, always appreciate such timesaving snippets!

# October 20, 2009 3:10 PM

Binoj Antony said:

How about doing this with an additional SectionGroup then Section. How will this be implemented

# October 26, 2009 10:27 AM

maansi said:

Thanks Very Much I was a bit bit rusty about it but thanks a lot it has helped

# November 11, 2009 11:45 AM

newbie said:

And what about writing back the file ?

Thanks.

# November 15, 2009 8:30 PM

Hasan said:

Thanks it is works.

# November 18, 2009 7:26 AM

Jan Schreuder said:

That can be done using the Jet engine as well. But you'd have to look at the documentation for that. Haven't implemented that.

# November 18, 2009 9:44 AM

Nelson said:

Me sirvió de mucho, Gracias

# December 2, 2009 4:11 PM

Raja said:

Thanks for the code.

It was helpful.

# December 22, 2009 5:15 PM

pawan said:

i created a windows project..but when i need to install it in the client computer i need to intsall the visula studio project setup and crystal report 9.0(manually)...but i need CR 9.0 to get installed with visula studio project setup

# December 23, 2009 6:34 AM

Jan Schreuder said:

You will need to add the merge modules to the setup.

# December 23, 2009 1:17 PM

Richard said:

Brilliant, work around. Saved me a lot of time.

# December 30, 2009 11:19 PM

arshad said:

How i have installed both 2.0 and 3.5 . how i can copy crystal reports dlls for version 2.0

# December 31, 2009 7:23 AM

RobinDotNet said:

3 years after you wrote this, it's STILL helpful. Thanks.

# January 12, 2010 7:14 PM

oldovets said:

Standard Label class has a property named AutoEllipsis which do the same

# January 19, 2010 1:55 PM

Tejas said:

Thank you for the time to post this article.

I am new to Sql. I tried using the above code and made the changes for the update section as I want to record the updated fields. I am not able to insert the code that you provided at the end of the main code. I am getting errors related to columns not found. StatusID, STATUS, Alerted, etc...

Thanks again

# January 19, 2010 4:00 PM

Jan Schreuder said:

I know, but it was an old version of ASP.Net for which we did this.

# January 19, 2010 4:27 PM

Ewan said:

He should also have added an index for each possible combination of columns.

# January 25, 2010 3:11 PM

Reaksmey said:

Thank you so much, this has help me a lot.

# February 4, 2010 10:38 AM

Chris said:

Hi There,

Can I reuse the parameters when the refresh button is clicked? Please advice,

Thank you

# February 9, 2010 1:50 AM

Prajakta said:

I need to display exact no of pages instead of 1+. Can anybody help me?

# February 9, 2010 10:03 AM

Jan Schreuder said:

@Chris: yes that should be possible.

@Prajakta: Problem is that CR only knows the exact number of pages once it has rendered all pages. So the only option is to do a navigate to the last page and then back to the first. Which could be time consuming.

# February 9, 2010 11:58 AM

Andy said:

Your created event handler is doing way too much, and may cause multiple file creations to be missed.  Have the created spawn off a new thread to do the rest of the processing so that the event handler returns almost immediately.

# February 10, 2010 5:58 PM

Jan Schreuder said:

Never really noticed a missing file creation to be quite honest, but handling the code in a seperate thread is a useful addition.

# February 10, 2010 7:33 PM

Robin Thomas said:

Thank you sooooooooooooo much.. its working fine for me.. thanx :)

# February 24, 2010 8:13 AM

Phil said:

I tend to hand off processing to the thread pool as andy suggests. I think the created events get buffered and a mixture of a high volume of events and a long processing time migh t result in events getting lost.

# February 28, 2010 8:56 PM

e-portfolio said:

Thanks for the links. They are really helpful for the learners.

# March 2, 2010 9:50 AM

sir_steve75 said:

Thanks for this great article!

I think a small but very important switch is missing in the batch command:

WSDL /language:CS NAME.WSDL

generates a client by default.

To generate a dummy WS, the /server switch has to be used:

WSDL /language:CS /server GeneratePDFService.wsdl

Do you agree?

# March 4, 2010 12:00 PM

Matt said:

Thanks a lot, this worked great as is.

# March 14, 2010 3:22 PM

Kiran Kodati said:

Hi

I have VS2005 installed and default crystal reports. I have developed a windows applications project using crystal reports.

Now I uninstalled default crystal reports and installed CR9.0. But when I open my project and add new crystal report,it is still old one. How should I configure in VS to use new CR 9.0? any idea will be appreciated.

# March 15, 2010 1:00 PM

Martin said:

I coundnt agree more, what a useless piece of crap!!

# March 16, 2010 4:54 AM

Arnold Boersma's Weblog said:

Creating MSDN like documentation of your C# project

# March 16, 2010 8:32 PM

Jon said:

Regarding:

veljkoz said:  

If you are using Crystal Reports for Visual Studio 2008, in order for your application to work when you deploy it, the most simple way to do it is to install on client computer the "Crystal Reports Basic for Visual Studio .NET 2008" msi package - see support.businessobjects.com/.../runtime.asp

After it installs, applications can use CR... very painless, and no need to use the merge modules

-- A few people complained of not being able to download from the link given.  A quick Google search for "Crystal Reports Basic for Visual Studio .NET 2008" msi pointed to the new address - for those interested:

resources.businessobjects.com/.../runtime.asp

# March 17, 2010 2:37 PM