try this
public class mydatatableinfo
private m_pkid as integer = 0
private m_name as string = ""
sub new()
mybase.new
end sub
sub new(byval pkid as integer, byval name as string)
m_pkid = pkid
m_name = name
end sub
public property pkid as integer
get
return m_pkid
end get
set(byval value as integer)
m_pkid = value
end set
end property
public property name as string
get
return m_name
end get
set(byval value as string)
m_name = value
end set
end property
end class
man i hate typing properties ohh <serializable>public class must make it wire friendly
public class dblayer
public function dbgetdata as mydatatableinfo()
dim c as new arralylist
do something to get your data into a datareader, or any collection
using dr as datareader
while dr.read
dim x as new mydatatableinfo
x.pkid = IIF(IsDbNull(d("pkid")), 0, d("pkif"))
x.name = IIF(IsDbNell(d("name"), "', d("name")
c.add(x)
return ctype(gettype(c.toarray), mydatatableinfo,mydatatableinfo())
end function
end class
to implement this in your UI
private m_mydatatableinfo as mydatatableinfo
private m_mydatatableinfoList as mydatatableinfo()
private sub load
dim db as new dblayer
m_mydatatableinfoList = db.getdata
mycontrol.datasource = m_mydatatableinfoList
or
for each i as mydatatableinfo in m-mydatatableinfoList
next
or m-mydatatableinfo = new mydatatableinfo
m_mydatatableinfo = m_mydatatableinfoList.getvalue(0)
mytextbox.databinding.add('text",m_mydatatableinfo,"name")