|
i have done that with simple debugging but the problem still persists and i do not know what should i do and what cause this problem
please explain me more
|
|
|
|
|
I have the same problem
|
|
|
|
|
and at last i get the answer:
in fact , there is a malicious thread that want to access my DataGridView !
some thing like a high frequently repeatable time tick or ...
in fact i had to use this.Invoke() with parameters that will rise the update DataGridView Method!
i used the fallowing solution!
delegate void AddDatevalueHandler(object[] newRow);
delegate void DeleteDatevalueHandler(string deletedRow);
.
.
.
private AddDatevalueHandler AddHandler;
private DeleteDatevalueHandler deleteHandler;
.
.
.
AddHandler = new AddDatevalueHandler(AddData);
deleteHandler = new DeleteDatevalueHandler(DeleteData);
.
.
.
object[] param ={ NewRow };
this.Invoke(AddHandler, param);
.
.
.
private void AddData(object[] NewRow)
{
dataGridAlarms.SuspendLayout();
ds_main.Tables[0].Rows.Add(NewRow);
dataGridAlarms.ResumeLayout(true);
}
private void DeleteRow(string ID)
{
dataGridAlarms.SuspendLayout();
this.Invoke(deleteHandler, parameter);
dataGridAlarms.ResumeLayout(true);
}
good luck
|
|
|
|
|
I have a question about GUID. I created a calender admin program that stores event data in an xml file. The xml file consist of an element called call ID. I am using ID as a key. Each event has a unique id.
My code generates a GUID for each new event. Currently I set up a method in my code behind to see if the GUID exist before I except the value of the new GUID. My understanding the sytem should generate a unique GUID each time you create one. I am thinking it is possible to get a duplicate GUID value, for example if I move the application to a new server.
Is this good practice or just a waste of resources?
Thanks,
David
|
|
|
|
|
Better safe than sorry.
I generally use a database, so the GUIDs I generate as primary keys gets checked by the database engine. But, yes, they do get checked and an Exception will be thrown if a duplicate is ever detected.
If you are creating your own database, you should perform the check.
|
|
|
|
|
According to MSDN (Remarks)[^], GUIDs are as globally unique as possible. The probability of seeing two the same in the world (universe?) is very low. The probability of seeing two the same on a single PC is infinitesimal. Your process looks fine, if you hit a duplicate then just generate a new one and continue. Alternatively you may like to consider a simpler key, such as time and date, sequence number, combination of the two etc. It all depends on how many items you expect to be storing.
|
|
|
|
|
I ended up rewriting an old calendar app because of the duplicate key problem. I will leave the duplicate check code in thier just in case, it seems like the fastest solution.
The amount of data depends on the client, I have some clients who enter large amounts of event, in those cases I push them to using sql server.
|
|
|
|
|
I once managed to get SQL 2005 to generate duplicate GUIDs. My insert statement managed to generate set of three identical GUIDs pretty consistently. Unfortunately we could never replicate this outside of our, rather large, application and so ended up just doing it differently. It was probably to do with the records being generated within the same millisecond, and so not that likely in most applications.
So, yes you should definitely check. While in theory you should never get duplicates I have had them to often.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
Hi,
How to Browse my Basic .aspx file with HTTPS instead HTTP, I come to know that it is possible through SSL, Is it any other way I can browse Page with Https.
I want to transfer a page which is cxml file with http how can i do it.
|
|
|
|
|
The only way to view any web page over https is to enable ssl connections to your webserver. That is what https means. However the resulting webpage will look the same either way so I would not bother to enable https connections on a development server, only on your live web server.
For details on how to set this up check out some of these sites[^].
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
|
that's three filled circles: big black, medium white, small black.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Thanks.
Couldn't we draw it with a circle command ?
|
|
|
|
|
what's a "circle command"?
I'd use Graphics.FillEllipse()
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
I suppose you could just use simple clipping when drawing these circles.
Life is a stage and we are all actors!
|
|
|
|
|
hi,
can anyone tell me that is it possible to generate report with crystal report from windows service.
thanks
tbhattacharjee
|
|
|
|
|
Hi,
I have to read an xlsx file in which there are multiple columns. One of it is a 'Date' column type. I am using OLEDB with Microsoft.ACE.OLEDB.12.0 as the provider. The problem is, suppose if there is a non date value (Error data) in the column the oledb is replacing the error data with null. I have a requirement to show the all data (good data as well as the error) to user who is reading the excel file into our database.i.e. i dont wnt the engine to convert the value to null
When reading xls file,which can be done by using Microsoft.Jet.4.0 provider, we can overcome this by changing property of IMEX=1 and changing the 'Typeguessrows=1' in the registry. But unfortunately this provider cannot be used for reading an xlsx file.
Can anyone help me how to overcome this problem??? I have also listed down the code below which i am using for reading the file
DataSet ds = new DataSet();
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + FileName + ";Extended Properties=\"Excel 12.0;HDR=YES;IMEX=1;MAXSCANROWS=0\"");
con.Open();
try
{
DataTable dt = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
string sheetname = dt.Rows[0]["TABLE_NAME"].ToString();
OleDbDataAdapter myCommand = new OleDbDataAdapter(" SELECT * FROM [" + sheetname + "]", con);
myCommand.Fill(ds);
}
catch (Exception ex)
{
string exce = ex.Message;
}
finally
{
con.Close();
}
return ds;
|
|
|
|
|
Hi,
I got same problem when i am reading Excel 2003 file with Excel 2007 connection string.It shows the values in data table as empty.But,it shows the Titles.
|
|
|
|
|
hi
i have problem with end of process.
i need to zip file - and after i zip - i need to do some thing with this zip file...
the problem is, although the messagebox appear - i noticed that the process is not end.
how i can know for sure that the process is end ?
my zip sample:
try{
if (File.Exists(@"c:\DaZIP\Bind.sdf"))
File.Delete(@"c:\DaZIP\Bind.sdf");
File.Copy(Application.StartupPath + @"\Bind.sdf", @"c:\DaZIP\Bind.sdf");
byte[] sampleBuffer = null;
ZipEntry sampleZipFile = null;
FileStream sampleFileStream = null;
ZipOutputStream sampleOutputStream = new ZipOutputStream(File.Create(Application.StartupPath + @"\Bind.zip"));
sampleOutputStream.Password = "12345";
sampleOutputStream.SetLevel(9);
foreach (string sampleFile in Directory.GetFiles(@"c:\DaZIP")) {
sampleZipFile = new ZipEntry(Path.GetFileName(sampleFile));
sampleOutputStream.PutNextEntry(sampleZipFile);
sampleFileStream = File.OpenRead(sampleFile);
sampleBuffer = new byte[sampleFileStream.Length];
sampleFileStream.Read(sampleBuffer, 0, sampleBuffer.Length);
sampleOutputStream.Write(sampleBuffer, 0, sampleBuffer.Length);
}
sampleOutputStream.Finish();
sampleOutputStream.Close();
}
catch (Exception ex){ MessageBox.Show(ex.Message ,"",0, MessageBoxIcon.Exclamation);
return;}
MessageBox.Show("End ZIP");
i work on VS2008 C# WinForm
i know that the process still work, because when i try to do somthing with the zip
file, i get error that the file is in use. and if i wait for 1-2 minute, i can do what i
want with this zip file.
|
|
|
|
|
E_Gold wrote: i know that the process still work, because when i try to do somthing with the zip file, i get error that the file is in use
That may well be a wrong conclusion. The one way to know whether a process is (still) running or not, is by looking at the Task Manager's list.
Here is what is probably going on:
if you want write or delete access (anything other than read access) to a file that just got created (by yourself or someone else, does not matter), chances are you will find the file is being accessed by some other process, and your access is not granted.
The other process very likely is some server code that is there to assist you somehow. Candidates are:
- anti-virus software (Norton, McAfee, whatever)
- indexing software (Google Desktop, MS Office, whatever)
The common thing is these packages are looking all the time for new files, so they can inspect them.
Microsoft is aware of the consequences; Windows Explorer will try rename and delete attempts up to five times (with one-second interval), and only reports failure if the action continues to fail for that time.
The solution:
1. either use a different file name (not always acceptable)
2. or remove all background reader candidates (bad idea)
3. or implement the retry loop as Explorer has it (use a Windows.Forms.Timer for this)
BTW: if all you need is Read, make sure to allow others to read as well, i.e.
use File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read)
Remark: in my experience, trying to open/append/close a file more often than once a second succeeds all the time, seems like the inspectors allow for at least one second of inactivity before opening the files themselves.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Hey everyone,
I'm looking for a way to either hook my C# application to a instant messenger (like msn) or make a full C3 instant messenger application with which I can talk with a friend of mine that I will give the same application.
Basicly I'm trying to make me a own chat enviroment but I want it to be save against hackers (no needless open ports) and it has to be not lan since my friend lives about 40 km away from me
Any help will be usefull.
ps. So far i have not yet found anything that can tell me if C# can execute events on MSN receieved messages and/or C# can send messages via msn. Have not looked in to other messengers (like aim or icq.. or whatever)
|
|
|
|
|
Hey again everyone,
I found out it's easy to use a mircbot as between me and my friend for communication
Cheers
|
|
|
|
|
Hello,
I need to develop one application say, if i speak "run notepad", notepad should be opened.
For that i have use following code to implement speech recognition,
SpeechRecognitionEngine recognizer = new SpeechRecognitionEngine();
DictationGrammar gram = new DictationGrammar();
recognizer.LoadGrammar(gram);
recognizer.SetInputToDefaultAudioDevice();
recognizer.RecognizeAsync(RecognizeMode.Multiple);
void recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
MessageBox.Show(e.Result.Text);
}
I don't know how to add grammer, please help me out.
Thank you in advance.
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:18am.
|
|
|
|
|
Hello,
Thank you for reply.
But i don't understand that msdn dictationgrammer(), so please tell me in details what should i do.
And if i write in vista will it be work in xp too?
Please help me.
Thank you.
|
|
|
|