© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
48 replies
SAFE

❔ Help with Lists/Combobox

public partial class Form1 : Form
    {
        const decimal SALES_TAX_RATE = 0.15m;
        // private List<Order> orders = new List<Order>(){"Potatos"};
        // string[] genres = { "Blues", "Country", "Hip Hop", "Easy Listening", "Rock", "Pop" };
        // List<Order> order = new List<Order>(genres);
        string[] genres = { "Blues", "Country", "Hip Hop", "Easy Listening", "Rock", "Pop" };
        List<Order> orders = new List<Order>();
        public Form1()
        {
            InitializeComponent();
        }
        //string[] genres = new string[]
       //  {
        //        "Blues",
           //     "Country",
           //     "Easy Listening",
          ///      "Hip Hop",
         //       "Rock",
          //      "Pop"
       //   };

        #region Methods

        private void ResetForm()
        {
            cboGenres.SelectedIndex = -1;
            txtAlbumName.Text = "";
            txtArtistName.Text = "";
            txtQuantity.Text = "";
            txtPrice.Text = "";
            txtArtistName.Focus();
        }

        public void LoadGenres()
        {
            for (int i = 0; i < genres.Length; i++)
            {
                cboGenres.Items.Add(genres[i]);
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            LoadGenres();
        }
public partial class Form1 : Form
    {
        const decimal SALES_TAX_RATE = 0.15m;
        // private List<Order> orders = new List<Order>(){"Potatos"};
        // string[] genres = { "Blues", "Country", "Hip Hop", "Easy Listening", "Rock", "Pop" };
        // List<Order> order = new List<Order>(genres);
        string[] genres = { "Blues", "Country", "Hip Hop", "Easy Listening", "Rock", "Pop" };
        List<Order> orders = new List<Order>();
        public Form1()
        {
            InitializeComponent();
        }
        //string[] genres = new string[]
       //  {
        //        "Blues",
           //     "Country",
           //     "Easy Listening",
          ///      "Hip Hop",
         //       "Rock",
          //      "Pop"
       //   };

        #region Methods

        private void ResetForm()
        {
            cboGenres.SelectedIndex = -1;
            txtAlbumName.Text = "";
            txtArtistName.Text = "";
            txtQuantity.Text = "";
            txtPrice.Text = "";
            txtArtistName.Focus();
        }

        public void LoadGenres()
        {
            for (int i = 0; i < genres.Length; i++)
            {
                cboGenres.Items.Add(genres[i]);
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            LoadGenres();
        }
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ ComboBox | When in ComboBox1 "A" selected then show in combobox2 "B"
C#CC# / help
3y ago
❔ ComboBox event help
C#CC# / help
3y ago
❔ combobox with radioButtons
C#CC# / help
3y ago
Help with Lists and index.
C#CC# / help
3y ago