23 Sep 2016

C# Program to count particular digit in a given number


In the previous posts, i have given C#.Net code to count the occurrences of a character in a string

This program is to count the occurrences of a digit in a given number.

I have written 3 different methods for the same thing.

8 May 2016

Check Uncheck All Checkboxes in Html Table Using JQuery

In this blog post, we will see a small example to check or uncheck all checkboxes in a html table using jquery. You can implement the same code in Asp.net gridview.

To make this work, first you need to use jquery in your web page.

18 Oct 2015

DataTable to Dictionary Conversion in C#.Net

In this post, here is the c# code to convert DataTable to Dictionary.
while working with DataSet or DataTable we may need key value pair to get Value by Id approach.
So you may need to convert your DataTable to key value type i.e, Dictionary.

you can also use Dictionary for data binding of controls like Dropdown list, Radio button list etc.

Here we will see a sample console program where we convert DataTable to Dictionary and print the Dictionary.
I have written 2 overrides for a method DataTabelToDictionary(). The Method code is given below:

29 Nov 2014

VB.Net Program to print Numbers 1 to N in Right Triangle Format

VB.Net Program to print Numbers 1 to N in Right Triangle Format

Module Module1

    Sub Main()
        Dim sum As Integer = 0, i As Integer, k As Integer, n As Integer
        Console.WriteLine("*** www.programmingposts.com ***")
        Console.WriteLine(vbLf & ">>> VB.Net Program to print Numbers 1..n as Right Triangle <<<")
        Console.Write(vbLf & " Enter the nth number of series: ")
        n = Convert.ToInt32(Console.ReadLine()) 'taking input, converting to Int
        For i = 1 To n

            For k = 1 To i
                Console.Write("{0} ", k)


    End Sub

End Module

Sample output Screen :