Guest Will Posted June 10, 2004 Report Posted June 10, 2004 scenario: I want to make a method, i can pass a filename and an object (combobox or listbox) returning the number of items added as an integer. . - the gubbins of making the listbox fill with the contents of the file is fine.. Problem: How do i specify the list/combobox in the method? ie destination is comboBox1 ??? private int getandfillfilecontents(string filename, object??? destination) { //here i open filename read contents line by line into destination : destination.Items.Add(nextline); }[/code] Hope this makes sense, i'm sure it's simple if you know the syntax!
Guest MrMagoo Posted June 10, 2004 Report Posted June 10, 2004 now i am not a .net fan and don't do a lot in c# that said, i think you can do this: private int getandfillfilecontents(string filename, System.Windows.Forms.ComboBox destination) { //here i open filename read contents line by line into destination : destination.Items.Add(nextline); }
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now