d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > C# Problem > Can't See :x Source Inside
Add Reply New Topic New Poll
Member
Posts: 129
Joined: Dec 7 2012
Gold: 0.00
Jan 24 2013 09:35pm
So basicaly I have this code :

Code

private void buttonGetVideoInfo_Click(object sender, EventArgs e)
       {
           buttonGetVideoInfo.Enabled = false;
           string url = textBoxVideo.Text;
           if (url != "")
           {
               try
               {
                   currentVideoInfos = DownloadUrlResolver.GetDownloadUrls(url);
               }
               catch
               {
                   //err bad url
               }
           }
           else
           {
               //err url empty
           }
           foreach (VideoInfo info in currentVideoInfos)
           {
               comboBoxVideoInfo.Items.Add(info.ToString());
           }
           comboBoxVideoInfo.SelectedItem = comboBoxVideoInfo.Items[0];
           currentVideoArray = currentVideoInfos.ToArray<VideoInfo>();
           buttonGetVideoInfo.Enabled = true;
       }

       private void buttonAddVideo_Click(object sender, EventArgs e)
       {
           if (comboBoxVideoInfo.SelectedItem != null)
           {
               selectedVideoArray[array_tracker] = currentVideoArray[comboBoxVideoInfo.SelectedIndex];
               array_tracker++;
           }
           else
           {
               // error combobox empty
           }
           RefreshListBox(listBoxVideo, selectedVideoArray);
       }

private void RefreshListBox(ListBox list, VideoInfo[] selected)
       {
           list.Items.Clear();

           for (int i = 0; i< array_tracker; i++)
           {
               list.Items.Add(selected[i].ToString());
           }
       }


It's pretty messy atm, was using a List before, tried an array with a tracker. don't work either.

The first method is called to analyse a youtube url from a textbox and store its infos.
The second method is used to add the infos of the selected video from the combo box to a queue.
And the third method is called to update the list box with the selected items.

this picture may help you understand.



MY PROBLEM IS :

When I enter an url etc, all works just fine, I can add videos etc.
When I enter a second url (calls method who points arrays to null etc) and I add a video, all the previous ones change to that video.

It's kinda messy to explain since english is not my primary language. If you want full source send me a pm. can't see what's wrong.

Ty all :)
Member
Posts: 129
Joined: Dec 7 2012
Gold: 0.00
Jan 24 2013 10:51pm
PROBLEM SOLVED :
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll