Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

Sort all Strings in DomainUpDown control on run time using .net 2.0

Author: Zunnair
Download Source Code : 813_DomainUpDownControl.zip

In this simple article you will learn that how to sort all strings in DomainUpDown control on run time

 Create new c# project. Drag one Domainupdown control, one button on the windows form.

 

Now write following code on form load event:

 

C#

private void Form1_Load(object sender, EventArgs e)

        {

            this.Text = "DevAsp DomainUpDown APP";

            domainUpDown1.Items.Add("www.devasp.net");

            domainUpDown1.Items.Add("www.devasp.com");

            domainUpDown1.Items.Add("www.google.com");

            domainUpDown1.Items.Add("www.orkut.com");

            domainUpDown1.Items.Add("www.gmail.com");

            domainUpDown1.Items.Add("www.abc.com");

            domainUpDown1.Items.Add("www.efgabc.com");

            domainUpDown1.Items.Add("www.ijkefgabc.com");

        }

VB

 

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)

        Me.Text = "DevAsp DomainUpDown APP"

        domainUpDown1.Items.Add("www.devasp.net")

        domainUpDown1.Items.Add("www.devasp.com")

        domainUpDown1.Items.Add("www.google.com")

        domainUpDown1.Items.Add("www.orkut.com")

        domainUpDown1.Items.Add("www.gmail.com")

        domainUpDown1.Items.Add("www.abc.com")

        domainUpDown1.Items.Add("www.efgabc.com")

        domainUpDown1.Items.Add("www.ijkefgabc.com")

    End Sub Now write following code on button click event

 

C#

 

private void button1_Click(object sender, EventArgs e)

        {

            try

            {

                domainUpDown1.Items.Sort();

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }

 

VB

 

Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)

        Try

            domainUpDown1.Items.Sort()

        Catch ex As Exception

            MessageBox.Show(ex.Message)

        End Try

    End Sub

This is the simple code for Sorting Strings in DomainUpDown control.

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< Getting Value from a checkedListBox on click using .Net 2.0

Disclaimer - Privacy
© 2002-2017 DevASP.net