❔ Help with Lists/Combobox

SSAFE1/26/2023
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(); }
SSAFE1/26/2023
for some reason, the list wont show up in my combobox
SSAFE1/26/2023
theres no actual errors in the code and it does run, so im not sure what it is
PPobiega1/26/2023
$codegif
PPobiega1/26/2023
and please remove the commented out duplicate code, it just makes reading really hard
PPobiega1/26/2023
at a glance, it seems okay. Are you sure the Form1_Load event is firing? use the debugger to make sure
SSAFE1/26/2023
ok ill try, also maybe its cause i havent got to a certain part of assignment yet where i have to do something else to add it idk
SSAFE1/26/2023
yes it form loads
SSAFE1/26/2023
but the combox has nothing
PPobiega1/26/2023
read that again
PPobiega1/26/2023
I didn't ask if the form loads. I asked if Form1_Load actually triggers.
PPobiega1/26/2023
If you have not wired up the event subscription for that method, it wont.
SSAFE1/26/2023
um.. how can i tell if it triggers
SSAFE1/26/2023
im new ish sorry
SSAFE1/26/2023
or could i just copy my code into a second downloaded copy of the starter file and it would work?
PPobiega1/26/2023
You would use your debugger.
PPobiega1/26/2023
Set a breakpoint in visual studio
PPobiega1/26/2023
$debug
SSAFE1/26/2023
ok so i believe that it is triggering
AACiDCA71/26/2023
can you amke a screenshot of how the brakpoint was reached inside LoadGenres
AACiDCA71/26/2023
because your last message doesnt sound really convincing
SSAFE1/26/2023
ok sure
SSAFE1/26/2023
also i just download the assignment starter again and copied everything and it still wont show the combobox list, so its the code i think but idk lol
SSAFE1/26/2023
all was the same but that
SSAFE1/26/2023
Image
SSAFE1/26/2023
loadgenres method
Image
AACiDCA71/26/2023
you are just showing your code.. i wanted you to show me that the breakpoint in the right spot is getting reached.. for that you have to start your app
AACiDCA71/26/2023
the red dot should go into loadgenre
SSAFE1/26/2023
thought you meant breakpoint in the code, what do you mean
SSAFE1/26/2023
ok
AACiDCA71/26/2023
now that its in there start your app
SSAFE1/26/2023
nothing in the combobox still
SSAFE1/26/2023
i put the dot at line 83 at the loadgenres method
AACiDCA71/26/2023
if you havent noticed any "weird" behavior i guess the method is never called
AACiDCA71/26/2023
that means the form_load method is never excecuted
AACiDCA71/26/2023
which means you have messed something up in the designer of the form
SSAFE1/26/2023
omg im dumb
SSAFE1/26/2023
i just double click form on the designer
SSAFE1/26/2023
so it would actually show up
AACiDCA71/26/2023
could you phrase it so that people who arent sitting right next to you understand what you mean
SSAFE1/26/2023
LOL
SSAFE1/26/2023
one more thing in it that needs to be fixed: '
SSAFE1/26/2023
Image
SSAFE1/26/2023
shows that it isnt valid no matter what
AACiDCA71/26/2023
i see that genre is populated now... for that problem someone else can help you if you need more assistance
SSAFE1/26/2023
alright okok
AAccord1/27/2023
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.