473,388 Members | 1,177 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,388 software developers and data experts.

GridView Exception: reentrant call to the SetCurrentCellAddressCore function

Hallo to everyone!

Problem:
--------
GridView Exception: reentrant call to the SetCurrentCellAddressCore function

System:
-------
WinXP Professional, english, .NET Framework 2.0 Beta Language C#

Simplified Architecture of my Porgram:

2 Forms:
--------
- MainForm
- DetailForm

2 Threads:
----------
- Main Thread which runs the MainForm //Application.Run(MainForm)
- Telegram Thread //receiving Socket Data for visualization

Scenario:
---------
Telegram Thread receives frequently (2s) socket data which forces the
Main Thread via Callback 'Visualization' to refresh the Data in
the GridView. Within the Callback function 'Visualization' the
Telegram Thread could return immediately, doing his job, by calling
this.Invoke(new VisualDelegate(MainFormVisual)).
'MainFormVisual' wires up the GridView.DataSource with a DataTable,
which is stored offline in memory, as shown in the following lines

1. gvMyGridView.DataSource = null;
2. gvMyGridView.DataSource = BuildActData(); //returning a DataTable

After a undifined and non reproduceable timespan (approx. 20 min)
repating this scenario, the following Exception will be thrown at line 1:
EXCEPTION: Operation is not valid because it results in a reentrant call to
the SetCurrentCellAddressCore function.

Thank you for every advice, bugfix or workaround

Martin
Nov 22 '05 #1
1 7471

I have the samilor problem,but I resolved it;
1. Do not remove the row you want to remove directly,just store it in
an array;
Codes are like below:
private int[] delIndex = null;
pushDelIndex(row.CurrentRow.Index);
private void pushDelIndex(int _index){
if(delIndex==null){
delIndex=new int[]{_index};
}else{
Array.Resize(ref delIndex,delIndex.Length+1);
delIndex[delIndex.Length - 1] = _index;
}
}

2. Then open a thread when the program start;
Codes are like below:
Thread delTh = new Thread(new ThreadStart(delRowThread));
delTh.Start();

3. Use the thread to check the array delIndex every 100 millseconds£¬if
it is not null,the call the function delRow;
Codes are like below:
void delRowThread() {
while (delFlag) {
if (delIndex != null) {
if (deling == false)
{
delRow();
}
}
Thread.Sleep(100);
}
}

private delegate void delRowCallBack();
void delRow() {
if (PlayList.InvokeRequired)
{
deling = true;
delRowCallBack o = new delRowCallBack(delRow);
this.Invoke(o);
}
else {
for (int i = 0; i < delIndex.Length; i++) {
PlayList.Rows.RemoveAt(delIndex[i]);
}
deling = false;
delIndex = null;
}
}

Martin B wrote:
*Hallo to everyone!

Problem:
--------
GridView Exception: reentrant call to the SetCurrentCellAddressCore
function

System:
Martin *


--
leinchu
------------------------------------------------------------------------
Posted via http://www.mcse.ms
------------------------------------------------------------------------
View this thread: http://www.mcse.ms/message1702096.html

Aug 31 '06 #2

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

Similar topics

0
by: Martin B | last post by:
Hallo to everyone! Problem: -------- GridView Exception: reentrant call to the SetCurrentCellAddressCore function System: ------- WinXP Professional, english, .NET Framework 2.0 Beta...
6
by: junky_fellow | last post by:
what are reentrant functions? What are the characteristics of a reentrant code ? what things should be kept in mind while writing a reentrant code ?
9
by: TheOne | last post by:
Would anyone please point me to a list of reentrant C library functions? I want to know which C library functions are safe to use inside a signal handler across all platforms. Does GNU C library...
1
by: John_H | last post by:
Re: ASP.NET 2.0 I would like suggestions or code examples on how to collect a variable length list of input data (item# & item quantity specifically). I thought that I could accomplish this...
0
by: news.microsoft.com | last post by:
I got this error when i bind dataview to datagridview data.Datasource= dt.DataView Error: Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function...
17
by: fmassei | last post by:
Dear all, I'm trying to put some old code in a portable, cross-platform library and I'm facing a big problem: is there a standard, platform- independent way to write a reentrant function that...
12
by: Bit Byte | last post by:
I am modifying some legacy code, to make the functions reentrant. I use lots of global data (large nested structs) to pass data around quicky. The global structures are far too large (in size) for...
11
by: Ed Dror | last post by:
Hi there, I'm using ASP.NET 2.0 and SQL Server 2005 with VS 2005 Pro. I have a Price page (my website require login) with GridView with the following columns PriceID, Amount, Approved,...
6
by: selvakumari | last post by:
i am getting an exception while end editing the 1st column 1st row of the cell(1,1) it is a combobox cell of datagridview everytime it showing following exception only on endedit dont know why...
0
by: ANILMOURYA | last post by:
private void FlexGrdRsltConv_CellEnter(object sender, DataGridViewCellEventArgs e) { if (blnRowenter) { return;} if...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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: 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
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,...

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.