The first thing you need is to keep a list or similar of the bugs you are creating as you read them from the DB. Otherwise you cannot add them to anything!
I would suggest at class level you use a List<T>:
private List<Bug> myBugs;
public void GetBugs()
{
MySqlDataReader reader = Database.Reader("select * from bugs");
myBugs = new List<Bug>();
while (reader.Read())
{
Bug bug = new Bug();
bug.id = reader.GetInt32("id");
...
bug.lastUpdate = reader.GetDateTime("lastupdate");
myBugs.Add(bug);
}
}
What you have to do to add the bugs to a List box depends on what you want to display in the list box. You say you know how to populate a ListBox - what is stopping you from adding your Bug information?
Ok, but now I can just add the list to my listbox/listview. Like this:
BugFinder finder = new BugFinder();
finder.GetBugs();
recentlyBox.Items.Add(""); (What should I put here?)
It depends on what you think you need to display. I would be tempted to go for a couple of small changes:
1) Make your GetBugs method return the list of bugs:
public List<Bugs> GetBugs()
{
MySqlDataReader reader = Database.Reader("select * from bugs");
myBugs = new List<Bug>();
while (reader.Read())
{
Bug bug = new Bug();
bug.id = reader.GetInt32("id");
...
bug.lastUpdate = reader.GetDateTime("lastupdate");
myBugs.Add(bug);
}
return myBugs;
}
You can then use them directly.
2) Make Bugs return something the user might want to read as the ToString method:
public override string ToString()
{
return name;
}
You can then add your bugs:
BugFinder finder = new BugFinder();
foreach (Bug bug in finder.GetBugs())
{
recentlyBox.Items.Add(bug.ToString());
}