Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
4
Reply
problem in call a method from class
Abolfazl
Mar 24 2014 5:31 AM
848
Reply
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
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
4
)
Next Recommended Forum
Image Display in Listview
How Crop Human image from scan image