473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

passing callback to method in Win app

VM
How can I pass a callback to another method? In my code, i update my
datagrid with the datatable after the method loadAuditFileToTable is
finished executing. Instead, I'd like to be able to to update the grid
continuously (while the table's filling) and someone suggested I pass a
callback to loadAuditFileToTable and run it every X records. How can I do
this? This is a summary of my code:

loadAuditFileToTableDelegate LoadAuditFileToTable = new
loadAuditFileToTableDelegate(loadAuditFileToTable) ;
LoadAuditFileToTable.BeginInvoke (new AsyncCallback(yourCallback), null);
}
delegate void GUIUPdate();
void yourCallback(IAsyncResult iar)
{
if (iar.IsCompleted)
{
dataGrid_auditAddress.Invoke (new GUIUPdate(guiUpdateMethod),null);
}
}
private void guiUpdateMethod()
{
this.dataGrid_auditAddress.DataSource = _table_auditAddress;
}
private void loadAuditFileToTable()
{
ZMMatch.Audit zmAudit = new ZMMatch.Audit(NONE, NONE);
_table_auditAddress = zmAudit.OpenAuditAZMFileToView(_SFileName);
}
public DataTable OpenAuditAZMFileToView(string sFileName)
{
/* ZMMatch class
// open file, create table/columns,etc...
sAuditRecord = sr.ReadLine();
while (sAuditRecord != null)
{
/* Parse/process line, fill row, and add row to table. Loop will add
500,000 rows */
sAuditRecord = sr.ReadLine();
}
return myTable;
}
Nov 16 '05 #1
0 836

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Philippe C. Martin | last post by:
Hi, I have he following need and do not find an easy way out: I have many menu items and would like them all to call the same method -However, I need the method called to react differently...
2
by: Nick | last post by:
Is there a way that if I host my remoted object in IIS (not having to mess with encryption & authentication via a custom sink) that the server can raise events and the clients can detect them? If...
6
by: keepyourstupidspam | last post by:
Hi, I want to pass a function pointer that is a class member. This is the fn I want to pass the function pointer into: int Scheduler::Add(const unsigned long timeout, void* pFunction, void*...
0
by: Jeffrey B. Holtz | last post by:
Has anyone used the multimedia timere timeSetEvent in C#? I'm trying to use it to get a 1ms accurate timer. All the other implementations are far to inaccurate in their resolution. 1ms Timer =...
3
by: Malcolm | last post by:
Hi. I am attempting something new in my coding and need some direction. I have a web service that I am attempting to return a custom colleciton of custom objects of a single type. When I call...
2
by: TN | last post by:
I have a bit of C code, that creates an instance of a .Net class that has been built as a type library. Everything is working as expected, I can pass strings to methods in the object. What I...
3
by: Bit Byte | last post by:
Must be the time of the day, but I seem to get my head in a spin over this ... I have a base class B, from which I have a derived class. In class B, i have a (public access) typedef of a...
1
by: m2i3k | last post by:
Hi I have C code with requires me to register a python callback. I am able to get the callback working well using ctypes if I use global functions without any context argument for the callback. ...
0
bartonc
by: bartonc | last post by:
I'm working on a scheme which reduces the interface between classed to a single method and a list messages that the co-operative class knows. I invite all comments and/or critiques/improvements: We...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.