C#C
C#3y ago
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(); }
Was this page helpful?