i don't understand problem following simple code. take list , display in datagridview. error :
error 1 inconsistent accessibility: return type 'system.collections.generic.list' less accessible method 'windowsformsapplication10.form1.fillgridview()'
also, there way convert list, arraylist etc dataset type?
public partial class form1 : form { public form1 () { initializecomponent (); } public list<student> fillgridview () { list<student> l = new list<student> (); l.add (new student { fname="bloke", lname="lll", contact=293489485}); l.add (new student { fname = "dog", lname = "assdf", contact = 35345 }); l.add (new student { fname = "mary", lname = "sdff", contact = 6456 }); l.add (new student { fname = "john", lname = "sdfsdf", contact = 45656 }); return l; } private void form1_load ( object sender, eventargs e ) { datagridview1.datasource = this.fillgridview (); } private void button1_click ( object sender, eventargs e ) { } }
does method need public? looks student class not public, returning list of public caller inconsistent. looks, method can private.
private list<student> fillgridview()
Comments
Post a Comment