|
i want to update the listview selected item from Exited event but everytime i got this error:
Cross-thread operation not valid: Control 'listview1' accessed from a thread other than the thread it was created on.
here is the error code :
void exited_event(object sender, EventArgs e)
{
listview1.Items[0].SubItems[0].Text = "abc";
}
any solution ?
thanks
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Look at Control.Invoke and Control.InvokeRequired. You cannot change UI stuff on a non-UI thread.
|
|
|
|
|
but i can change it by timer that is also non-UI thread, but if i enable it from that event it also gave same error
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
The timer Tick event runs on the UI thread.
|
|
|
|
|
oh..anyway my problem has been solved by Control.Invoke() and Control.InvokeRequired
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I'm using this piece of code to dump my config settings to disk. Only problem is it seems to break on certain machines. No error gets thrown but when i try to read the file back out I get an "invalid padding" error I assume that for some reason the entire stream isn't getting written out.
Do i need to flush the stream prior to closing it? Should i save it as config.new and then overwrite the origianl veraion?
public static void EncryptToFile(string ConfigData, string FilePath)
{
FileStream fStream = File.Open(FilePath, FileMode.OpenOrCreate);
Rijndael RijndaelObject = Rijndael.Create();
ICryptoTransform encryptor = RijndaelObject.CreateEncryptor(key, IV);
CryptoStream csEncrypt = new CryptoStream(fStream, encryptor, CryptoStreamMode.Write);
StreamWriter sw = new StreamWriter(csEncrypt);
sw.WriteLine(ConfigData);
sw.Close();
csEncrypt.Close();
fStream.Close();
}
Thanks for any ideas you can give me
Russell
modified on Tuesday, June 3, 2008 10:19 AM
|
|
|
|
|
I think make a detailed log for this function.Then you can identify where the function if failed.
Sudhir Kumar
|
|
|
|
|
what do you mean by 'break' ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
The safest way to do this would be to save it as a new file and then overwrite the original. You also want to wrap the streams in a using statement to ensure that they get disposed of properly. Finally, you want to add some try...catch handling.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Russell Jones wrote: it seems to break
Russell Jones wrote: RijndaelObject.CreateEncryptor(key , IV );
Those parameters are not declared or initialized anywhere in the code you posted. Since the method is static I would hold them highly suspect.
Also you are doing nothing in the code you posted to verify a valid FilePath
led mike
|
|
|
|
|
Hi All,
I m using the infragistics ultraChart to show some data.
The problem is that the values on the X line, wil show automatically in decimal format. How can i change this to integers?
Thanx.
|
|
|
|
|
|
Chances to get a good answer are high on infragistics forumn
|
|
|
|
|
In C/C++, we may code:
union aa {
double bb;
char cc[8];
} a;
In this way we may verify the actual data stored in memory for the double. How do I do that in C#?
Thanks.
|
|
|
|
|
Does this [^] help (see Attributes on Structs paragraph at the bottom of the page)?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: Does this [^] help
No, documentation is not helpful.
Well at least to those who refuse to read it. Yet somehow reading the same information in a forum post is helpful, go figure.
led mike
|
|
|
|
|
It really helps, thanks a lot.
Seems it doesn't take arrays as follow:
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Explicit)]
struct TestUnion
{
[FieldOffset(0)]
public double d;
[FieldOffset(0)]
public char[] c;
}
workaround would be:
[StructLayout(LayoutKind.Explicit)]
struct TestUnion
{
[FieldOffset(0)]
public double d;
[FieldOffset(0)]
public char c0;
[FieldOffset(2)]
public char c1;
[FieldOffset(4)]
public char c2;
[FieldOffset(6)]
public char c3;
}
|
|
|
|
|
cyh_cyh wrote: Seems it doesn't take arrays as follow:
Yes. I guess it is because arrays are allocated on the heap.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Yes, but not in the same way. You need to use the StructLayout and FieldOffset attributes on the struct and fields, respectively. For your example, the equivalent in C# would be
[StructLayout(LayoutKind.Explicit)]
struct aa
{
[FieldOffset(0)]
public double bb;
[FieldOffset(0)]
char[] cc;
}
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Do you know how can I change the windows mouse pointer. I can chage it on my application form ... but i waould like to change it on all windows. I want to simulate a selection rectangle but on all applicationn that allows the user to select a region of the screen. Thanks a lot.
|
|
|
|
|
|
hi
i using reporting service(report viewer) in my app, but i don't how to set paper size,landScape, ... in my report at designTime and runTime, can anyBody help me ?
thanks
|
|
|
|
|
Hi,
I need to build a application where I have a mainform and multiple runtime generated forms.
There are many good methods to pass data between 2 winforms but I have a problem to get it work with runtime generated forms.
Is there someone who have a simple sample where i can start from.
Thanks
|
|
|
|
|
redspiderke wrote: There are many good methods to pass data between 2 winforms but I have a problem to get it work with runtime generated forms.
I don't quite understand what you mean. What is the difference between a "winform" and a "runtime generated form"?
|
|
|
|
|
Sorry,with a winform I mean a standard form
|
|
|
|