C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » General »

Dropdownlist


Posted Date: 04 Nov 2009    Resource Type: Code Snippets    Category: General
Author: subhashiniMember Level: Silver    
Rating: 1 out of 5Points: 5



Description :



This is the code for adding the items into the dropdownlist when the button is clicked without duplication.The controls used here is:Drodownlist,Textbox and button


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i, n, j As Integer
j = 1
n = DropDownList1.Items.Count

If n = 0 Then
DropDownList1.Items.Add(TextBox1.Text)

Else
For i = 0 To n - 1
If TextBox1.Text = DropDownList1.Items(i).Text Then
j = j + 1
End If
Next
If j = 2 Then
MsgBox("Already available")
Else
DropDownList1.Items.Add(TextBox1.Text)
End If
End If
End Sub


Attachments

  • Dropdownlist ()


  • Responses


    No responses found. Be the first to respond and make money from revenue sharing program.

    Feedbacks      
    Popular Tags   What are tags ?   Search Tags  
    Sign In to add tags.
    Dropdownlist  .  Add item into the Dropdownlist without duplication  .  

    Post Feedback


    This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
    You must Sign In to post a response.
    Next Resource: Reflection
    Previous Resource: How to display image from database to asp.net
    Return to Discussion Resource Index
    Post New Resource
    Category: General


    Post resources and earn money!
     
    More Resources



    dotNet Slackers

    About Us    Contact Us    Privacy Policy    Terms Of Use