TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abolfazl
NA
184
81.3k
problem in call a method from class
Mar 24 2014 5:31 AM
hi
i have a class and a method that fill a listview with database records.when i call the method in form load it not works without any error.
but when i write method body in form load it works.i need to write this method and use it from another class.what should i do?
it's class and method code:
class accountinfo_show
{
public void main_list()
{
frm_main frm1 = new frm_main(); //object of main form
databaseDataContext db = new databaseDataContext();
var query = db.accountinfos;
for (int i = 0; i < query.Count(); i++)
{
var field = db.accountinfos.Where(c => c.id == i + 1).Single();
ListViewItem item = new ListViewItem(field.bankname.ToString());
item.SubItems.Add(field.banklocation.ToString());
item.SubItems.Add(field.accountnumber.ToString());
item.SubItems.Add(field.mojoodi.ToString());
frm1.lstv_main.Items.Add(item); //lstv=listview
}
}
}
in form load of frm_main i call main_list.
thanks
Reply
Answers (
4
)
Image Display in Listview
How Crop Human image from scan image