Meditech NPR Reports / NPR Report Writing / NPR Report Writer / Meditech NPR / Non-Procedural Report / Meditech Consulting / Meditech Reports .NET 2.0: December 2006

Saturday, December 16, 2006

Dot Net Development Tools (Free)

http://www.nunit.org/
NUnit is a unit-testing framework for all .Net languages. Initially ported from JUnit, the current production release, version 2.2, is the fourth major release of this xUnit based unit testing tool for Microsoft .NET. It is written entirely in C# and has been completely redesigned to take advantage of many .NET language features, for example custom attributes and other reflection related capabilities. NUnit brings xUnit to all .NET languages.

http://testdriven.net/ (If used on a daily basis as a for profit developer, they request you buy the professional license for $95.00.)
TestDriven.NET allows a developer to run (or debug!) their tests from within Visual Studio with a single-click. Test Driven Development is the practice of writing unit tests for your code before you actually write that code. By writing a test and then writing the code to make that test pass you have a much better idea of what the goal and purpose of your code is. Test Driven Development encourages complete code coverage, which not only increases the quality of your code, but allows you to refactor the internals of a method or class and quickly and easily test the outside interface of an object.

http://ncover.org/site/
NCover provides statistics about your code, telling you how many times each line of code was executed during a particular run of the application. The most common use of code coverage analysis is to provide a measurement of how thoroughly your unit tests exercise your code. After running your unit tests under NCover, you can easily pinpoint sections of code that are poorly covered and write unit tests for those portions. Code coverage measurement is a vital part of a healthy build environment.

http://www.codeplex.com/MSBee
MSBee is an addition to MSBuild that allows developers to build managed applications using Visual Studio 2005 projects that target .NET 1.1.

Monday, December 04, 2006

MDI Interface to Child Form

To control the child form from the parent form; you need to implement an interface to the child form. The interface will have publicly available methods which are accessible via the interface.

1) For your application's namespace, implement a public interface.

:public interface IChildForm;
:{
: // All methods to be accessed via the MDI parent must be here.
: void OpenFile();
: void SaveFile();
:}

2) Your child form implements the IChildForm interface by adding it to the list of implemented interfaces. The public methods listed in the IChildForm interface must be implemented in the form class.

:public partial class frmViewer :Form,IChildForm
:{
: public frmViewer()
: {
: InitializeComponent();
: }
:
: // You can call this from the IChildForm interface reference.
: public void SaveFile()
: {
: SaveFileDialog saveFileDialog = new SaveFileDialog();
: saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
: saveFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
: if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
: {
: string FileName = saveFileDialog.FileName;
: // TODO:Add code here to save the current contents of the form to a file.
: }
:
: }
:
: // You can call this from the IChildForm interface reference.
: public void OpenFile()
: {
: // TODO:Add code here to open the file.
:
; }
:
:}

3) Access the active MDI child.

:private IChildForm GetActiveChild()
:{
: // Get the active MDI child.
: Form ChildForm = this.ActiveMdiChild;
: // Access the save method via the interface.
: IChildForm iForm = ChildForm as IChildForm;
: return iForm;
:}

4) Call the Active MDI Child's interface methods.

:private void SaveAsToolStripMenuItem_Click(object sender, EventArgs e)
:{
: IChildForm iForm = GetActiveChild();
: iForm.SaveFile();
:}
:
:private void OpenFile(object sender, EventArgs e)
:{
: IChildForm iForm = GetActiveChild();
: iForm.OpenFile();
:}

Convert Integer to String

// Track which window.
intChildFormNumber++;
strChildFormNumber = Convert.ToString(intChildFormNumber);

Saturday, December 02, 2006

C# MDI Child Form from Menu

;private void iViewerToolStripMenuItem_Click(object sender, EventArgs e)
;{
; // Make a new child window.
; frmViewer newViewer = new frmViewer();
;
; // Set the parent for the child to this frmMain.
; newViewer.MdiParent = this;
;
; // Display the new form.
; newViewer.Show();
;}

Meditech NPR Reports / NPR Report Writing / NPR Report Writer / Meditech NPR / Non-Procedural Report / Meditech Consulting / Meditech Reports