473,405 Members | 2,338 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,405 software developers and data experts.

Updating grid from custom delegate

VM
How can I update a grid from within a delegate call?

Here's some of my code:

delegate void loadFileDelegate(string sFileName);
public void DisplayAuditFile(string sFileName)
{
loadFileDelegate LoadAuditFileToTable = new
loadFileDelegate(loadAuditFileToTable);
LoadAuditFileToTable.BeginInvoke (sFileName, null, null);
}

private void loadAuditFileToTable(string sFileName)
{
rowAudit = zmAudit.OpenAuditAZMFileToView(ref isEndOfFile, ref
iRowsProcessed);
if (!isEndOfFile)
{
_table_auditAddress.Rows.Add(rowAudit);
ShowProgress(iRowsProcessed);
}
}
private void ShowProgress(int iRowsProcessed)
{
if(domainUpDown_goTo.InvokeRequired == false )
{
domainUpDown_goTo.Text = iRowsProcessed.ToString();
if (iRowsProcessed % 1000 == 0)
{
/* I want to update the grid with these 1000 records in the
table */
}
}
else
{
ShowProgressDelegate showProgress = new
ShowProgressDelegate(ShowProgress);
BeginInvoke(showProgress, new object[] {iRowsProcessed });
}
}
Thanks.
Nov 16 '05 #1
2 1202
Hi,

You should use similar code as for ShowProgress (check if invoke is
required...).

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"VM" <vo******@yahoo.com> wrote in message
news:uU**************@TK2MSFTNGP09.phx.gbl...
How can I update a grid from within a delegate call?

Here's some of my code:

delegate void loadFileDelegate(string sFileName);
public void DisplayAuditFile(string sFileName)
{
loadFileDelegate LoadAuditFileToTable = new
loadFileDelegate(loadAuditFileToTable);
LoadAuditFileToTable.BeginInvoke (sFileName, null, null);
}

private void loadAuditFileToTable(string sFileName)
{
rowAudit = zmAudit.OpenAuditAZMFileToView(ref isEndOfFile, ref
iRowsProcessed);
if (!isEndOfFile)
{
_table_auditAddress.Rows.Add(rowAudit);
ShowProgress(iRowsProcessed);
}
}
private void ShowProgress(int iRowsProcessed)
{
if(domainUpDown_goTo.InvokeRequired == false )
{
domainUpDown_goTo.Text = iRowsProcessed.ToString();
if (iRowsProcessed % 1000 == 0)
{
/* I want to update the grid with these 1000 records in the
table */
}
}
else
{
ShowProgressDelegate showProgress = new
ShowProgressDelegate(ShowProgress);
BeginInvoke(showProgress, new object[] {iRowsProcessed });
}
}
Thanks.

Nov 16 '05 #2
VM
How would I actually display the 1000 records in the grid? Should I use
datagrid.datasource or refresh or...?

Thanks,
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:eY*************@TK2MSFTNGP12.phx.gbl...
Hi,

You should use similar code as for ShowProgress (check if invoke is
required...).

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"VM" <vo******@yahoo.com> wrote in message
news:uU**************@TK2MSFTNGP09.phx.gbl...
How can I update a grid from within a delegate call?

Here's some of my code:

delegate void loadFileDelegate(string sFileName);
public void DisplayAuditFile(string sFileName)
{
loadFileDelegate LoadAuditFileToTable = new
loadFileDelegate(loadAuditFileToTable);
LoadAuditFileToTable.BeginInvoke (sFileName, null, null);
}

private void loadAuditFileToTable(string sFileName)
{
rowAudit = zmAudit.OpenAuditAZMFileToView(ref isEndOfFile, ref
iRowsProcessed);
if (!isEndOfFile)
{
_table_auditAddress.Rows.Add(rowAudit);
ShowProgress(iRowsProcessed);
}
}
private void ShowProgress(int iRowsProcessed)
{
if(domainUpDown_goTo.InvokeRequired == false )
{
domainUpDown_goTo.Text = iRowsProcessed.ToString();
if (iRowsProcessed % 1000 == 0)
{
/* I want to update the grid with these 1000 records in the table */
}
}
else
{
ShowProgressDelegate showProgress = new
ShowProgressDelegate(ShowProgress);
BeginInvoke(showProgress, new object[] {iRowsProcessed });
}
}
Thanks.


Nov 16 '05 #3

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

Similar topics

6
by: Christian H | last post by:
Hi! I've created a custom control (myDrawControl) that deals with drawing. This control is then added to a form( myMainForm) Now, whenever something is dragged and dropped onto myDrawControl ,...
2
by: Geir Sanne | last post by:
hi!! how am i supposed to update the db witht he changes the user make in webpage am trying to make a simple page that have a grid bound to a table the user can delete,add or update the grid...
14
by: Lars Netzel | last post by:
A little background: I use three Datagrids that are in a child parent relation. I Use Negative Autoincrement on the the DataTables and that's workning nice. My problem is when I Update these...
1
by: sklett | last post by:
I have been doing research on updating the UI while doing time intensive processing. Basically, I have a click event in my Form that will call a member function on one of my business objects, that...
6
by: Mike Wilson | last post by:
Dear Group, I have a heirarchical set of database tables, say - "order" and "order_type" and want to display a series of orders in a grid control, and in place of the order_type foreign key...
5
by: Mark R. Dawson | last post by:
Hi all, I may be missing something with how databinding works but I have bound a datasource to a control and everything is great, the control updates to reflect the state of my datasource when I...
1
by: batista | last post by:
Hello all, I have a third praty grid control...named C1grid. Im using it in one of my apps.. Now, I have bind this grid to a custom dataset class named "DataViewEx". The code of the class is...
2
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Hi All! I am with a situation where I am not getting the right updating to the form's fields. The situation is the following one: I have one combobox and one textbox. I am using the...
1
by: asharda | last post by:
I have a custom property grid. I am using custom property grid as I do not want the error messages that the propertygrid shows when abphabets are entered in interger fields. The custom property...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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.