Archive for the ‘C#’ Category

DataSet write XML

Wednesday, February 20th, 2008

When you working with dataset and you want to collect data to file such as .xml, .txt, .doc I recommend collect to xml file because easy to develop Dataset in C# has writeXML and readXML method for provide. I use this below code to collect my data.

configPath = ConfigurationSettings.AppSettings["dbconfig"];
dataSet = new DataSet();
dataSet.ReadXml(configPath);

Using the SaveFileDialog Control

Tuesday, February 19th, 2008

The SaveFileDialog control has the same properties as the OpenFiledialog does. In fact , to show you how you can utilize both, I have mode the code to use the SaveFileDialog a little more complicated;

string strFileName = openFileDialog1.FileName;
if(strFileName != "")
{
if(saveFileDialog1.ShowDialog() == DialogResult.OK)
{
strFileName= saveFileDialog1.FileName;
richTexBox1.SaveFile(strFileName);
}
}
else
{
richTexBox1.SaveFile(strFileName);
}

This code tests to see if the openFileDialog1 control’s FileName property has been set , through openin a file. If not and the FileName property is equal the name of the dialog box, which is the default, then the SaveFileDialog control is displayed , and the user can specify the file to Save As. If a file has been specified in the openFileDialog then that name is used This is show to Save Option for a new file generally behaves, by only asking for the filename if  it hasn’t been save before.

Dynamic-Link Libraries

Monday, February 18th, 2008

One of the features introduced with Windows programming are dynamic-link libraries. Prior to Windows, when applications were created , you could link libraries of routines into you own applications. The problem was that when a library changed that was used by many applications , all of those application had to be relinked and recompiled.

When the dynamic-link libraries, which usually have the extension .dll, you can change routines in the library itself and recompile them, and all the applications would then be able to utilize them without having to be relinked and recompiled . You can use those libraries in various application without having to rewrite the code.

Using DLLs is very convenient. However, as new versions of DLLs are introduced, problems can occur such as the application getting confused ad to which version of the DLl to use. This is known as DLL hell, another technical term. Fortunately, .NET has solved a number of these issues by introducing versioning and wrapping up system DLls for developers.

The Differences between C# and C# Express

Monday, February 18th, 2008

C# Express is acctually what is called an IDE , or integrated development environment. What this means in plain English , or whater language you are reading this in is that c# Express is a set of tools, including a special text editor that enables you to wirte computer programs in c#, the software development  language . It also handles other necessary thasks such as building you application to either test for errors or release for people to use.

Compile c# project with command line

Tuesday, January 22nd, 2008


I developed one c# project with .net visual studio 2005
I want compile it in command line I go to solution directory then type msbuild
e.g.

msbuild solutionFile.sln