-
Active Member
Last edited by uzzy13u; 03-24-2022 at 07:26 AM.
-
1. This is the entirely wrong section, surely you must have noticed that this section says "WoW EMU Questions & Requests".
2. We do have a programming section.
3. Your actual problem: You keep writing over "nr" in your forloop and then AFTER the loop you try to add the nr-th element of savenames to the grid. You have to do that inside your loop. And that's only half of the problem, you do the same thing in your first for-loop so that savenames will only contain cat and nothing else.
Given the simplicity of this problem I believe that you should read up on loops, variable initialization and about general programming control flow.
Last edited by Willy; 02-21-2017 at 08:29 AM.
-
Post Thanks / Like - 1 Thanks
uzzy13u (1 members gave Thanks to Willy for this useful post)
-
Active Member
Why do you need savenames, nr, or countHowManynamesAre? Is this a specific assignment requirement?
Can you just do:
Code:
foreach (string n in name) dataGridView1.Rows.Add(n);
Apologies if not, I don't work with Winforms much at all, mostly .Net backend stuff.
Problems I can see at a glance:
"savenames" is just the last item in your List, since you're reassigning it every time you iterate.
You don't need "countHowmanynamesAre" at all, you can just directly reference name.Count.
The entire for loop is just counting your list length, and then assigning the current count to another number... again you can just reference name.Count directly, although I don't know if that's what you're trying to do.
-
Post Thanks / Like - 2 Thanks
-
Active Member
Last edited by uzzy13u; 03-24-2022 at 07:26 AM.