Working With Files in C#

In this tutorial we will be working with files. How to create a file, edit it, rename a file make a copy an existing file or move it etc.

First thing you should do is to reference the System.IO namespace.

All the classes that will help you handle files are located in this namespace.

using System.IO;

How to create a file and edit it?

You can create a file like this:

string path = @"C:\test.txt";
File.Create(path);

This will create a file “test.txt” in Continue reading

Simple Unity Game tutorial

Cubes game

In this tutorial I will teach you how to make a simple game. This tutorial is mainly aimed at users who are new to Unity. So let’s begin. Continue reading

Unity 3D Game Development tutorials coming soon!

I am currently working on an this game. I will post Unity tutorials in the next few weeks.

If I had time I would make a video serious which will teach how to make a game like that.

Image Viewer application using C#

A detailed tutorial about creating an Image Viewer or Picture Viewer application in C#. This application also converts Images from one type to another.

Following are the features of this application:

  • Open / Save images.
  • Convert images.
  • Rotate Images.
  • All popular image formats are supported.

Let’s get started! Continue reading

Screen Capture Class For C#

A class that will help you take screenshots quickly and easily.

ScreenCapture

Following are the features of this class:

  • Take screenshot of the whole screen
  • Take screenshot of a particular area using a Rectangle
  • Copy the screenshot to Clipboard.
  • Save the screenshot straight after it is captured.
  • All popular image formats are supported.

Continue reading

C# – Check if connected to internet

I was working on an application which checked for updates. I used WebRequest/WebResponse for checking updates. It showed a continuous Progressbar while checking for updates. But there was a problem. It worked properly when you were connected to internet but it  just showed the progressbar all the time if not connected.

The solution for that was to check for internet connection before checking for updates. If connected then check for updates otherwise show an error.

Checking for the state of internet connection is very simple. Let’s get started.

Continue reading

Crop Image – C# and VB.NET

For cropping an image in C# & VB.NET we can use the Graphics class. We’ll use a method (or function in VB.NET) which will take 2 parameters, a source image and a rectangle of the section that should be cropped.  Let’s code!

Continue reading

C# – Autocomplete Textbox

There are times when you’ll need an autocomplete textbox. Autocomplete textbox makes the user’s life easier. It shows suggestions as the user types. In case of a web browser, if you type “goo” it will automatically show all the suggestions starting with or containing “goo” like “Google, Goofy” etc. It really helps both you or your users when hunting for something. Of course, it seems difficult to set up, but the reality is very different. So whether they’re typing in “find O2 UK BROADBAND” or you’re hunting for “that holiday video”, then your users are likely to find it a lot faster. Enough talk! Lets get on with it.

Fortunately, textbox has a built-in autocomplete feature! We don’t have to do any coding.

You can either set it up from the Designer (if you are using Visual Studio or #Develop) or do it via code. It is simple both ways. Lets do it!
Continue reading