Copy file in LAN network


The mechanism of copying files in a local network is the same when you query data from a database. We get 3 basic steps: Map the network drive - as open connection Copy file - as query data Reject the above drive - as close connection The first and the last steps are done with … Continue reading Copy file in LAN network

How to get relative path in C# (absolute)


As I introduced in the past post "Cách lấy đường dẫn tương đối", we can get the relative path in Java. But, I could not use this way for such a case in Csharp. So, I introduce a new way to make Csharp can find the specified files as the same way you used in Java. … Continue reading How to get relative path in C# (absolute)

How to rotate a rectangle in WPF


When you want to rotate a rectangle in WPF. You can use the RenderTranform attribute of Rectangle. I give you an simple example on how to rotate a rectangle as following First I have a rectangle object named rect. You initiate this object like: Now the rest work is you indicate the point on the … Continue reading How to rotate a rectangle in WPF

How to draw something on canvas in C#


1. Create a canvas frame In design screen of WPF, you create a canvas frame like the image below: Don'd forget to name canvas frame to Name="canvas" Now, we practice to draw a line and a ellipse on the above canvas 2. Draw a line The ways to draw shapes on canvas are similar to … Continue reading How to draw something on canvas in C#

How to create a Timer in C#


In this post, I introduce how to create a timer for repeated execution with an validate on the screen. The case is when you create an function to draw and redraw something on canvas, and you want after an interval period of time, the function is executed again. My solution is using DispatcherTimer belongs to … Continue reading How to create a Timer in C#

Read and write a txt file in C#


In the case you want to read or write some short information from or into a text file, Csharp supports a simple way for you in System.IO.File. You create a text file in directory "C:\\config.txt" and then: Read file There are some lines in above file, and each line has its own meaning, so you … Continue reading Read and write a txt file in C#