How to upload files to server using the new FileUpload control in C#/C-Sharp ?
Hi, For uploading files to server using the new FileUpload control in C#,
Hi, For uploading files to server using the new FileUpload control in C#,
Hi, For uploading files to server in C#/C Sharp,
Hi, Use the following simple lines of code to check whether a particular file exists or not using C#/C Sharp. It will return either True or False depending on whether your file exists or not. ๐
Hi, Sometimes you may need to convert string to double using C#, see the following lines of code to see how you could do it. ๐
Hi, Sometimes you may need to get all the characters in a string using C Sharp/C#. The following code gives you an example of how to get or display all the characters of a given string. Output: sampleString[0] = I sampleString[1] = sampleString[2] = L sampleString[3] = o sampleString[4] = v sampleString[5] = e sampleString[6]โฆ Read More »
Hi, Use the following code if you want to reverse the digits of a number using C Sharp/C #. Output : Given Number: 123 Reversed Number: 321 ๐
Hi, Use the following simple lines of code to check whether a particular file exists or not using C#/C Sharp. It will return either True or False depending on whether your file exists or not. ๐
Hi, For replacing a substring in C Sharp/C#, use the following lines of code.
Hi, In order to sort the elements in a string array in C Sharp/C#, we use the sort() method. Given below is a simple example using sort() method to sort the elements in a string array. It will print out, Sorted string Array: urStringArray[0] = apple urStringArray[1] = coderz urStringArray[2] = heaven123 urStringArray[3] = heaven777โฆ Read More »
Hi, As you know an exception is an error that occurs during the runtime. Here is a simple exception handling example using C Sharp/C#. ๐
Hi, This is how you can simply rename a namespace in C Sharp/C#, This will print out ‘Hello’! ๐
Hi, Given below is an example of a C#/C Sharp Random Access File. And the output will be… First value is A Second value is B Last value is E This example shows how you can randomly access data. ๐
Hi, Sometimes you need to check for whether the given string is Palindrome or not. Given below is a sample code to check whether the given string is Palindrome or not using C Sharp/C#. ๐
Hi, We have discussed here copying a file using FileInfo. Now we are going to see how we can do the same without using FileInfo in C Sharp/C#.
Hi, For copying a file using FileInfo in C Sharp/C#, use the following code. For copying a file without using file info check the example given here. ๐
Hi, Use the following code example to read a complete text file using C Sharp/C#.
Hi, Use the following example code, if you want to write to a text file using C Sharp/C#. ๐
Hi, It will be very useful to know how you can convert a given string into uppercase or lowercase using program. We are going to show you , how to convert a given string into uppercase or lowercase using C Sharp/C#. See the example given below. Output : Lowercase of sampleString : coderzheaven Uppercase ofโฆ Read More »
Hi, Sometimes you may need to check whether two strings are equal or not equal by checking case insensitive. See the example below to see how to achieve the same using C Sharp /C#. Output : heaven and HEAVEN are equal – Case Insensitive! ๐
Hi, Here is a simple program to generate Fibonacci series using C Sharp /C#. It will generate Fibonacci numbers < 100. [csharp] class MainClass { public static void Main() { int oldNum = 1; int presentNum = 1; int nextNum; System.Console.Write(presentNum + ","); while (presentNum < 100) { System.Console.Write(presentNum + ","); nextNum = presentNum +โฆ Read More »
Hi, Sometimes you may need to get the files from a specified directory using C# / C Sharp. See the sample code on how it works. using System; using System.IO; class MainClass { public static void Main() { string[] yourFiles = Directory.GetFiles("c:"); foreach (string fNames in yourFiles) Console.WriteLine(fNames); } } This code will get youโฆ Read More »
Hi, Let’s see a simple example of deleting a file in a folder using c#. using System; using System.IO; public class MainClass { static void Main(string[] args) { FileInfo sampleFile= new FileInfo(@"c:SamplestestFile.txt"); sampleFile.Create(); sampleFile.Delete(); } } sampleFile.Create() will create the file in the specified folder. sampleFile.Delete() will delete the file in the specified folder. ๐
Hi, How can you create a text file in C# and write to it? Sometimes you may need to create a text file using C sharp program. Here is how you can do that. using System; using System.IO; class MainClass { static void Main(string[] args) { StreamWriter yourStream= null; string yourString= "I Love Coderz Heaven!";โฆ Read More »
Hi, See how a very simple exception handling works with try-catch methods using C#. using System; class MainClass{ public static void Main(){ int divOne = 0; try { int ans = 79 / divOne ; } catch (Exception e) { Console.WriteLine("You got the exception-> " + e.Message); } } } Output- “You got the exception->โฆ Read More »
Hi, Sometimes you may need to find whether a particular year is leap year or not. But how can you find out whether a particular year is leap year or not in C# ? Use the following code. using System; class MainClass { public static void Main() { bool myResult= DateTime.IsLeapYear(2011); Console.WriteLine("Is the year 2011โฆ Read More »