There are a situations where you want to fill or populate dropdownlist of listbox using Enum.
Here are sample example for this.
C# Example :
VB.net Example :
Click Here to view "Populating or Fill dropdownlist from Database table with C# Examples and VB.Net Examples". Click Here...
This type of C# Tips is very useful in day to day programming life.
Note : Give Us your valuable feedback in comments. Give your suggestions in this article so we can update our articles accordingly that.
Here are sample example for this.
C# Example :
public enum ProgrammingLanguage { CSharp, VB, JAVA } foreach (ProgrammingLanguage enmLnaguage in Enum.GetValues(typeof(ProgrammingLanguage))) { cboProgrammingLanguage.Items.Add(new ListItem(enmLnaguage.ToString(), Convert.ToInt32( enmLnaguage).ToString())); }
VB.net Example :
Public Enum ProgrammingLanguage CSharp VB JAVA End Enum For Each enmLnaguage As ProgrammingLanguage In [Enum].GetValues(GetType(ProgrammingLanguage)) cboProgrammingLanguage.Items.Add(New ListItem(enmLnaguage.ToString(), enmLnaguage)) Next
Click Here to view "Populating or Fill dropdownlist from Database table with C# Examples and VB.Net Examples". Click Here...
This type of C# Tips is very useful in day to day programming life.
Note : Give Us your valuable feedback in comments. Give your suggestions in this article so we can update our articles accordingly that.
very nice . and short code. thanks.
ReplyDeleteHi,
DeleteI added new article related to LINQ To XML in this blog so check it out.