|
Unfortunately, the ThreadStart delegate's signature has been defined to take zero parameters, so you're out of luck.
The only way I know of is to use a member variable to pass parameters. Ugly, but it works.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
|
How can I read Paradox files from C# web application...
Regards
|
|
|
|
|
Hello Dears!
i m working with windows Datetimepicker control i have to save the Starttime and Endtime for a scheduled shift.From fromnt end i did it right by setting the following properties Format=Custom and Custom=hh:mm tt but when i save this time in the Sql data base it is saved with complete date and time and when i retrieve it in a list view from database in start and end time Date is also mentioned that i dont want. Is there any way to display or save only the Time irregard of its Date.
Thnx in advace!
Majid Bhutta
Learning to work in C#.Net
|
|
|
|
|
From the SQL Online Books for MS SQL Server 2000:
Date and Time Data
Date and time data consists of valid date or time combinations. For example, valid date and time data includes both "4/01/98 12:15:00:00:00 PM" and "1:28:29:15:01 AM 8/17/98". Date and time data is stored using the datetime and smalldatetime data types in Microsoft® SQL Server™ 2000. Use datetime to store dates in the range from January 1, 1753 through December 31, 9999 (requires 8 bytes of storage per value). Use smalldatetime to store dates in the range from January 1, 1900 through June 6, 2079 (requires 4 bytes of storage per value).
So, in MS SQL Server 2000, you can't just store time as a data type. You have to figure out your own solution.
You could create INSERT and UPDATE triggers on the table that set the date portion of the time value to some goofy date like Jan 1, 1901 and, then, all times would relate to one another. But, that doesn't solve the problem of your list view.
I hope that it helps a little.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hello...
u can save the time something like this :
here i am nt saving i m just displaying data in messagebox.
MessageBox.Show(Convert.ToDateTime(cmbxStartTimeList.Text).ToShortTimeString())
where cmbxStartTimeList.Text = 07:00 AM
and while retriving u can retrive by using ur old query den using the same
Convert.ToDateTime(UrRtriveString).ToShortTimeString()
and pass it to ur control.
hope it will help u.
Regards,
Praveen Solanki
|
|
|
|
|
Can someone please tell me how to deploy a msi app that executes the exe files in the package?
Illegal Operation
Making Computer Software Talk
|
|
|
|
|
If you just want to use the Deployment Project found in VS, then you have to do some things by hand. And, it ain't fun, but it works.
First, get a copy of the Windows Platform SDK and install the Windows Installer SDK.
Now, install Orca.
In your deployment project, add a commit custom action and set it to the EXE that you want to execute.
Build your project.
Open the MSI file with Orca.
In the custom actions table, add 192 to the custom action type for the EXE file.
Now it will work the way that you want it.
I know that this has no reason as to why it works. It's a long and silly discussion that you can read about in the Windows Installer SDK Help or in the book "Windows Installer" by Phil Wilson (ISBN: 1-59059-297-2).
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
hi
How will i add module in windows application using c#.net.
My requirement is :
I need to access a variable globally where the changes are done dynamically and that has to be reflected in all the other forms in that solution file.
example:
A variable a=10 is accessed globally.
During runtime i ll change the variable,a=20 in a different form.
how will this reflect in all the other forms unless i declare the globle variable in a module.
if i declare the variable by giving
public static a
i can access globally, but i cannot do the changes dynamically.
hope i ll get help.
thanks,
sarayu.
|
|
|
|
|
The public static approach should work, unless you are using it across AppDomains.
class Global
{
public static int a = 20;
}
class C
{
void Method1()
{
Global.a = 30;
Console.WriteLine(Global.a);
Method2();
Console.WriteLine(Global.a);
}
void Method2()
{
Global.a = 100;
}
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I have had an email from one of our equipment suppliers complaining that I am using event handlers incorrectly.
We have an app that uses MVC and switches in various controllers, forms, etc. As a form is switched in, it is attached to the relevant hardware and GUI events using the += syntax... when the form is switched out, the events are unbound using -=.
Now, I thought this was OK to do, but then I had this email from the supplier (modified to protect identities)
"You should only ever add/remove an event handler once in most applications. It is not designed by Microsoft to have event handlers added and removed continuously as a method to controlling these things. This is because an event handler is usually dealt with in another thread (or how else could it be generated for the application) and adding/removing notifications to the other thread can easily be the subject of racetrack timing errors."
Now, I'm pretty sure that adding and removing event handlers is thread safe, and even if it wasn't, I can't see how a 'racetrack' condition could occur. (Also, if the event was raised in the GUI thread, surely it will be handled in the GUI thread?)
So, may I ask the panel this question?
Is there a Microsoft publication somewhere that details the design philosophy behind the .Net 1.1 event handlers?
Thanks in advance!
Gizz.
|
|
|
|
|
It's crap what he is telling you. Events have per se nothing to do with threading. When an event is called all bound functions are called within the same thread as the raiser of the event. An event is nothing more than a specialized way to deal with delegate (function pointer) lists. Binding and unbinding is nothing more than adding and removing from this list.
|
|
|
|
|
This I know!
But, is there a useful Microsoft sponsored document that explains this in words of 1 syllable?
TIA
|
|
|
|
|
Sorry I have no link at hand but when reading such things I just have to rant about it.
|
|
|
|
|
A race condition can occur when an event is fired incorrectly. It has nothing to do with how handlers are subscribed and unsubscribed. If you fire like this:
public event EventHandler HandleThis;
void OnHandleThis(EventArgs e)
{
if (HandleThis != null)
{
HandleThis(this, e);
}
}
A separate thread could unsubscribe the last handler from the HandleThis event between the time you check for null and the time you actually fire it.
You can eliminate the race condition by using a temporary variable.
void OnHandleThis(EventArgs e)
{
EventHandler handler = HandleThis;
if (handler != null)
{
handler(this, e);
}
}
This page[^] mentions the problem and the solution. It's for WinFX, not v1.1, but it's the same concept.
I'm not sure why your supplier thinks you should handle events you're not interested in, but he's wrong.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Gizz quoted his supplier: You should only ever add/remove an event handler once in most applications. It is not designed by Microsoft to have event handlers added and removed continuously as a method to controlling these things.
Well, I don't know about adding/removing event handlers "continuously," but I see nothing wrong with changing event handlers more than once. I've been exploring flow-based programming lately and have been experimenting with using events/delegates as a means of realizing it.
So I have no problem with adding/removing event handlers several times during the lifetime of an application as a means of controlling the flow of a program (or whatever). In fact, I think it's a pretty cool approach.
Gizz continued to quote his supplier: This is because an event handler is usually dealt with in another thread (or how else could it be generated for the application)
If you're receiving event notifications from another thread, then thread-safety is an issue to be concerned about. but that has nothing to do with this:
and adding/removing notifications to the other thread can easily be the subject of racetrack timing errors.
Adding and removing event handlers to an event is thread safe.
When compiling a field-like event, the compiler automatically creates storage to hold the delegate and creates accessors for the event that add or remove event handlers to the delegate field. To be thread-safe, the addition or removal operations are done while holding the lock on the containing object for an instance event or the type object for a static event.
The C# Programming Language - 10.7.1
As far as firing an event, see Charlie Williams' reponse. There is a thread safety issue there.
-- modified at 15:10 Monday 21st November, 2005
|
|
|
|
|
How to get embedded .jpeg from excel worksheet from C#?
|
|
|
|
|
Hi Guys,
I'm using a borderless form (BorderStyle = None)
In the form I have used 3 PictureBoxes as 'Minimize', 'Maximize/Restore', and 'Close' buttons.
I've done the coding in C# and the buttons are working perfectly.
However I couldn't minimize, maximize the form from the taskbar.
As for the Forms with borders it is possible to minimize and maximize the form when you click the title bar from the taskbar.
How can I achieve the same functionality in a borderless from.
Thank you.
|
|
|
|
|
Hello all,
I have an ASP.NET app (using C#.NET) that allows a user to upload a file, and then the program should parse certain info out of the file and insert it into a database. The file is a Word document, so when I try to just use a FileStream, there is so much junk in the file. Do you know of a good way to READ in a Word document without that document being converted into another format from the user?
-- modified at 0:02 Tuesday 22nd November, 2005
|
|
|
|
|
A way of using poiner types in .Net is the IntPtr class. Check MSDN[^] for more help.
I hope you understand...because is a rough world out there...
|
|
|
|
|
Hi Everyone,
How to use C# to call a traditional unmanaged C++ DLL which has many functions with pointer parameters?
For example,
[DllImport("FlyCAMm1_CF.dll", EntryPoint="Capture_A_Frame")]
public static extern bool Capture_A_Frame(LPBYTE pretBuff, DWORD *pdSize);
Thanks.
Tsung-Yu
|
|
|
|
|
Did you ever get an answer to this question Tsung-Yu?
I'm struggling with exactly this issue. It looks like you are using FlyCAMm1_CF.dll, not FlyCAMm1_AV.dll, how did you manage to get an entry point to this DLL? I know they exist, as I've done a dumpbin on the file.
Really hope you can help.
|
|
|
|
|
Hi
I have just created a windows application and when I hit the F1 key to bring up the .chm help i get the 'error' page and nothing can be viewed in my help file.
I know that winXP SP2 fixed some security issues with .chm files but how does anyone get the .chm to display when being called from the help provider using the F1 key? Is there a setting that can be changed?Anything?Anyone?
I am storing the help in a sub directory under the main application.
Thanks in advance.
Stephen
|
|
|
|
|
how to download or upload a file using C#.what is the code for it.I need to download or upload it from a remote server and my local computer
-- modified at 23:49 Sunday 20th November, 2005
|
|
|
|
|
Depends how how/where you want to download/upload it.
Christian Graus - Microsoft MVP - C++
|
|
|
|