|
Yikes... yes, it seems the Columns are only available in the WebControlsDataGrid .
If the DataGrid is bound to a DataTable , you can use the Caption property of the DataColumn objects in the table to set the header text.
Or, you can create a DataGridColumnStyle with the desired HeaderText for each column, add them to the DataGridColumnStyles collection of a DataGridTableStyle , and add that to the DataGridTableStylesCollection of the DataGrid .
And THAT'S why I like DataGridView .
--
I've killed again, haven't I?
|
|
|
|
|
I've looked at some sample code and used the MSDN Library but its not really helping me. I'd like to be able to have code change the MaxLocksPerFile setting in the registry located Under HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Jet/4.0/Engines/Jet 4.0.
I can manually change this value but i would like to change it in the code. This needs to be increased because Microsoft Access has problems handling large amounts of data. I have an access database that has hundreds of thousands of records in it and when a user wants to update data in the database there is an error stating "File sharing lock count exceeded. Increase MaxLocksPerFile registry entry." Increasing the value significantly does fix the problem but it would be nice to change this value automatically with code when the user wants to update the database instead of having to go change the registry manually. Any help would be greatly appreciated.
|
|
|
|
|
Simple.
Use the Registry classes in the Microsoft.Win32 namespace.
Or you can refer to this[^]!
Hope this helps!
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
I have same problem. Can you help me?
acdb.ExecuteSQL($@"ALTER TABLE {tableName} ADD COLUMN ROW_NUMBER AUTOINCREMENT");
|
|
|
|
|
Hi,
I did not find answer to my question so why I here.
I try to write program that will load (bitmap,jpg-file, etc.) than I'd like to change this image (draw line, point, circle etc. on it) and than save it to disk. Has someone example of this issue?. I know how to load such image draw something on it but when I save it to disk I get file that is orginal image without changes. Moreover changes disapear when I minimize my image.
Thanks for help.
JM
|
|
|
|
|
|
Hi everyone,
I'm using the System.Web.Mail classes to email users.
The problem is that when I send to an Yahoo recipient, my email goes
straight into the bulk folder.
Is there a way to make sure that my email will go to the recipient's
inbox?
Danny
|
|
|
|
|
I have written a multithread program using lock(this) to realize sync.
I hung up the other day and i was told lock(this) is not a good way.
Can anyone give me some advice and tell my why?
Thank you!
|
|
|
|
|
Bob_Sun wrote: i was told lock(this) is not a good way.
And why didnt he back up his claim? It all depends what you need lock'd, but more important where the locking takes place.
|
|
|
|
|
|
What was wrong with the question you posted only half an hour before? Don't spam the forum.
---
b { font-weight: normal; }
|
|
|
|
|
Soory for made a mistake to post 2 messages.
I think it is better to use this thread only
|
|
|
|
|
Bob_Sun wrote: I think it is better to use this thread only
I already replied in the first thread.
---
b { font-weight: normal; }
|
|
|
|
|
Thank you very much.
I have read your following reply.
Who told you that it wasn't a good way, and what was the arguments for that?
I was just told so, and I found the following forum.
http://msdn.microsoft.com/msdnmag/issues/03/01/NET/[^]
Locking should of course be kept as a minimum, and to avoid deadlocks a thread should never lock more than one object at a time. Still, for sharing data between threads there is hardly any alternative.
I wrote a class for statemachine, whenever a event is dispatched, the whole statemachine should be locked in the thread. As for number of objects locked in this thread, it is always more than 2. As this is a statemachine, state changes must be sent to upper class. As the so called upper class collects messages from many child classes, messages are first enqueued before processed.
So, in this thread
lock(this)
{<br />
...<br />
lock(this)
{<br />
...<br />
}<br />
}
When several events occured in different threads, I suppose all of them will be locked at the first
lock(this) // Statemachine
before processed. Will this cause a deadlock in my program ?
|
|
|
|
|
If those are the only lock statements in the code, and they always get called in that order, it won't cause a deadlock. But if they always get called in that order, the inner lock is of no use at all.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: If those are the only lock statements in the code, and they always get called in that order, it won't cause a deadlock. But if they always get called in that order, the inner lock is of no use at all.
First, the second lock(this) is not necessarily called every time, but when called the order is always the same. Second, the second lock(this) may also be called directly from other threads which have no relation to StateMachine(outside statemachine).
|
|
|
|
|
lock(this) can bring you in a deadlock
instead create a field like this:
private object syncRoot = new object();
and use
lock(syncRoot)
[EDIT] Not static field will be static only for static methods
|
|
|
|
|
Thank you very much.
lock( a private object )
was the good way introduced to avoid deadlock.
But why lock(this) brings about deadlock?
I want to find the case in which my program falls into a deadlock.
|
|
|
|
|
This article seems to mention a DeadLock
http://www.codeproject.com/csharp/lockmanager.asp
|
|
|
|
|
I need a guru's advice: I am porting datagrids over to gridviews, and have the following old code:
<br />
foreach (DataGridItem dgItem in dgClicks.Items)<br />
{<br />
CheckBox chkSelected = (CheckBox)dgItem.FindControl("chkSelection");<br />
if (chkSelected != null && chkSelected.Checked)<br />
{<br />
if (dgClicks.DataKeys[dgItem.DataSetIndex] != System.DBNull.Value)<br />
{<br />
int nTopupRequestID = (Int32)dgClicks.DataKeys[dgItem.DataSetIndex];<br />
<br />
BL.receipts.BlockCapturedTransaction(nTopupRequestID, edBlockReason.Text);<br />
}<br />
}<br />
}<br />
But I can't seem to figure out how to fix the second conditional in what I have written to convert.. I keep getting an operator overload error..
<br />
foreach (GridViewRow gvRow in gvClicks.Rows)<br />
{<br />
CheckBox chkSelected = (CheckBox)gvRow.FindControl("chkSelection");<br />
if (chkSelected != null && chkSelected.Checked)<br />
{<br />
if (gvClicks.DataKeys[gvRow.DataItemIndex] != System.DBNull.Value):confused:<br />
{<br />
int nTopupRequestID = Convert.ToInt32(gvClicks.DataKeys[gvRow.DataItemIndex]);<br />
<br />
BL.receipts.BlockCapturedTransaction(nTopupRequestID, edBlockReason.Text);<br />
}<br />
}<br />
}<br />
I'm sure this is an easy fix for some of yu guys.. so what did I do wrong? Is there a better way to approach this with the GridView??
Hoping for someones kind assistance!
-Eric
Practice sesquipedalianism!
-- modified at 8:27 Friday 24th March, 2006
LETS SHORTEN MY QUESTION.. HOW WOULD YOU WRITE THIS WITH A GRIDVIEW, NOT A DATAGRID??
if (dgClicks.DataKeys[dgItem.DataSetIndex] != System.DBNull.Value)
|
|
|
|
|
I have a problem about lock in C#.
I have written a multithread program, but the other day, the program hung up suddenly.
I have checked the code throughly but i could find nothing wrong.
In order to realize sync., i use lock(this) at several places.
But to my dismay, i was told this is not a good way at all recently.
Can anyone give me some information about this?
Thank you
-- modified at 6:57 Friday 24th March, 2006
|
|
|
|
|
Who told you that it wasn't a good way, and what was the arguments for that?
Locking should of course be kept as a minimum, and to avoid deadlocks a thread should never lock more than one object at a time. Still, for sharing data between threads there is hardly any alternative.
---
b { font-weight: normal; }
|
|
|
|
|
Why this methid AcceptTcpClient() takes much time to connectd and i can't connect.
Any idea????
_____________________
Proud to be Albanian
_____________________
|
|
|
|
|
Looks like your client is not trying to connect properly.
Ed
|
|
|
|
|
I never had that experience. Maybe something wrong with your code!
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|