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
 

Adding Strings in DomainUpDown control on run time using .net 2.0

Author: Zunnair
Download Source Code : 811_DomainUpDownControl.zip

In this simple article you will learn that adding strings in DomainUpDown control on run time

 create new c# project. Drag one Domainupdown control, one textbox and one button.

 

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");

        }

 

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")

    End Sub

 

Now write following code on button click event

 

C#

private void button1_Click(object sender, EventArgs e)

        {

            try

            {

                if (textBox1.Text.Length > 0)

                {

                    domainUpDown1.Items.Add(textBox1.Text);

                }

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }

VB

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

        Try

            If textBox1.Text.Length > 0 Then

                domainUpDown1.Items.Add(textBox1.Text)

            End If

        Catch ex As Exception

            MessageBox.Show(ex.Message)

        End Try

    End Sub

 

This is the simple code for adding String in DomainUpDown control.

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< Adding check box in checkboxlist control on run time using .net 2.0.

Disclaimer - Privacy
© 2002-2017 DevASP.net