|
Hy,
If you have the reading method in a separate thread the best way to cancel the reading is to kill the thread or abort it. You can try also to write something like:
int bytesRead = 0;
while ( (read = stream.Read(......)) !=0 )
{
//Process data
if (!stream.DataAvailable)
break;
}
Hope it helps
Do your best to be the best
|
|
|
|
|
For the thread to be killed when you close the application, all you need to do is set the IsBackground[^] property to true. For other situations, the best way is to use a flag to check if the thread is to be aborted, before attempting the next Read.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hello
I want to convert a string variable to Standard Time. My string is a personal time like "15:00" , How can i convert it to DateTime variable ?
Thank you
-- modified at 3:24 Wednesday 12th July, 2006
|
|
|
|
|
|
Hello again
Dear stancrm
But this code just returns current date without time !!!
I have to convert my string time to standard DateTime because I want to do some jobs like add 10 minutes to that or ...
please help.
|
|
|
|
|
I just tried it and it return current date and the time from your input.
For example :
DateTime d = DateTime.Parse("15:00");
Console.WriteLine(d.ToString());
Then you will see : 12.07.2006 15:00
|
|
|
|
|
You can use DateTime.Parse("15:00"). But in VS2005, it is better to use DateTime.TryParse(...). It is because,according to my info, if DateTime.Parse can't convert string to DateTime, it will throw exception. But DateTime.TryParse(...) will return boolean that indicates whether String is converted to DateTime and DateTime as second out parameter of TryParse. If it can't, it will simple return false.
Regards,
Wasif Ehsan.
|
|
|
|
|
Hello. I want to change an item from a datarow belong to a dataset. I tried below code but I couldn't. I have a dataset (ds) and I filled it from a database. Each row has two item and there are for example name and surname.How do I change an item. I want to code like below.
ds.Tables[0].Rows[0]..... = "aaaaaa";
Thanks.
|
|
|
|
|
|
try to use
ds.Tables[0].Rows[0]..... = "aaaaaa";
ds.Tables[0].AcceptChanges();
rahul
|
|
|
|
|
I tried below codes. It didn't show any error message but It couldn't change the value.
MessageBox.Show(ds.Tables[1].Rows[0].ItemArray[1].ToString());
ds.Tables[1].Rows[0].BeginEdit();
ds.Tables[1].Rows[0].ItemArray[1] = "akutumm";
ds.Tables[1].Rows[0].AcceptChanges();
MessageBox.Show(ds.Tables[1].Rows[0].ItemArray[1].ToString());
|
|
|
|
|
Use following:
ds.Tables[0].Rows[0][Column_Name]="aaaa";
Regards,
Wasif Ehsan.
|
|
|
|
|
|
hello all!
how to monitor the running processes while some virus/spyware is attacking on the system.
and what application/program is consuming what resources of the system.
muhammad mahmood ilyas
|
|
|
|
|
Hy,
Process processList = Process.GetProcesses();
foreach(Process p in processList)
{
p.PeakVirtualMemorySize;
p.PagedSystemMemorySize;
}
And there are many other properties that can help you
Do your best to be the best
|
|
|
|
|
i have a mdi form and a child form developed in C#. On form load of a child form i am retrieving data from data base ( i am using mysql).
my problem is when i load child form for the first time it takes around 5sec, there after if i open the same form again it only takes around 1sec.
Can any body tell my where it exactly taking time to load for the first time, and suggest me where should i check.
|
|
|
|
|
This is happening becouse initialy application is compiled in the form of IL(intermediate language) and when it is executed it is compiled in to machine
specific code on which it is running by JIT(just in time compiler),so when the application is executed first time the IL is compiled to machine specific code
that is why it takes some time but when reuse the sme part of application then
the compiled codes are already there,so it take less time becouse JIT compiles part of application called once,that is why initialy it takes more time then
later on.
rahul
|
|
|
|
|
Good one. And you can use NGen to pre JIT, or so I read, never tried it myself.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
Is there a link to read up on that? I have the same problem (or about the same anyway )
tnx.
I've found a living worth working for, but I haven't found work worth living for.
<marquee>
|
|
|
|
|
V. wrote: Is there a link to read up on that?
Well there are many try this[^] to start but do not stop there. Also Google : MSDN NGen
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
many thanks.
I've found a living worth working for, but I haven't found work worth living for.
<marquee>
|
|
|
|
|
MCPSAT32 wrote: Can any body tell my where it exactly taking time to load for the first time
Exactly? You are kidding right?
One wild guess would be that you are not creating the MySql connection until you load the child form. If so try loading it at application start-up, if that is the problem you should see the application take longer to load but the first child form should load faster.
Another wild guess is that the child form references several assemblies that are not loaded until the first child form is loaded but 5 seconds seems a bit extreme.
I am out of guesses for now.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
Thanks mike, ur second wild guess is working. i am importing couple of third party components, i tried by preloading those dll, its working.
satz32
|
|
|
|
|
1. How do you retrive data? If you use select directly from database tables then it is better to create views or stored procedures and select data from them using sql-command parameters. In this case server will already have compiled queries even at the firs time.
2. Look at this article[^]. It may help you.
|
|
|
|
|
how can i read a sms arriving at the usb port using c#.do i have to use win32 apis for that.if so could u plz tell me how to use them with some sample code.my requirment is that i want my application to read the sms arriving at the usb port using c#.plz reply asap.
thank u
urs sincerly
cynthia
|
|
|
|