|
I need to update certain controls on a form in C# while a test sequence is performed that lasts up to 90 seconds while keeping a running record on that same form of the test results. Basically, the top half of the form will be the data entry portion of the form with the relevant text and combo boxes while the bottom portion of the form contains the data being tested. Certain labels and text boxes on the bottom part of the form need to be updated as the test progresses, but I need to enable the user to enter new data in the top half of the form. I thought perhaps multi-threading would solve the trick, but would the threads be able to access the same resource, this one form, at the same time?
|
|
|
|
|
Multi-threading *will* solve the problem. You just need to read a bit about synchronizing access to shared resources. There are many articles on the internet that cover this topic. Take a look at this article: http://www.c-sharpcorner.com/Code/2002/April/MultithreadingP3.asp[^] and then do a search for "C# thread synchronization".
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
I develope desktop app and use develope dataaccess component to handel the sql server but every time i try to use the programes i got this exception. and i am sure that the component in the same folder with the programes and i refrenced it in the visual studio
"File or assembly name DataAccess, or one of its dependencies, was not found.
File name: "DataAccess""
Please help
hoho
|
|
|
|
|
Have you attempted debugging? Can you post code where the error message appears?
|
|
|
|
|
This exception is thrown when one or more assemblies is not located by Fusion using the standard, documented paths. Simply put: you are missing a file referenced at compile time but is no where to be found at runtime.
Find the assembly with DataAccess in it and make sure it can be located at runtime. Beyond that make sure that assembly has all of its dependant assemblies locatable as well.
|
|
|
|
|
Hi
I have various forms that are opened by a main form (SDI) and each form has its own context menu (for right clicking) that includes functions like copy, paste, delete, etc. But if I select Edit->Copy from the main menu of the main form, it should copy the right thing in the currently active form (the form with the focus) . What is the best way to accomplish this basic function? Is it through menu merge?
Thanx
|
|
|
|
|
Are you talking about MDI. If its a MDI, then Menu merge will work. Have the implementation of the menu clicks on the child form.
The parent window should provide the basic menu's like Exit, Open, Close arrange vertically etc.
|
|
|
|
|
i'm actually working with SDI, is there a way to merge it in SDI?
|
|
|
|
|
u should put the data to be copied in the active form in the somthing liake a clipboard (ie: an object) and pass this object to the main form
|
|
|
|
|
When you use File.CreateText and then pass a normal string to the resulting StreamWriter's Write method, does it automatically convert the text to UTF-8, or do I need to encode it first?
Thanks.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Strings in .NET are an abstract concept, they do not have any encoding but are just unicode (in their internal memory representation, they use UTF-16, but you'll never notice until you use unsafe pointers).
Encoding is always done when converting from String to bytes, so yes, the StreamWriter does this for you.
|
|
|
|
|
That's what I thought, but for some reason when I save out my file, it does not seem to be UTF-8 encoded. I know this because when you open a text file in notepad and then select File | Save As..., you will see in the "Encoding" combo box of the Save As dialog, the encoding of the current document. In this case it came up as ASCII. To test this, I saved the file out as the same file name using the UTF-8 encoding with notepad and then closed it and loaded it back into notepad again--once again selecting "Save As..." to see what the Encoding drop down defaults to. It came up as UTF-8 the second time.
Is it really writing it out as UTF-8? Any ides?
Thanks.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
It is writing a UTF-8 stream without any header. Unless you have multi-byte characters, you can't tell the difference between a UTF-8 document and a normal ASCII document.
To include the preamble header call: StreamWriter(fileName, System.Text.Encoding.UTF8);
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Suuuhweeet! Thanks. That's what I was looking for.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Hi...
I have created a normal color dialig like this:
ColorDialog cd = new ColorDialog();
cd.Color = Color.Black;
Color NewColor = Color.Empty;
if(cd.ShowDialog() == DialogResult.OK)
NewColor = cd.Color;
It works great, but my problem is, that i only wants
the SystemColors to be shown in the ColorDialog,
so the NewColor only can be a System Color.
Can anyone help me?
Thanks
QzRz
|
|
|
|
|
Try this,
ColorDialog colorDlg = new ColorDialog();
colorDlg.AllowFullOpen = false;
colorDlg.ShowDialog();
|
|
|
|
|
I tried it, but its still not giving me System
colors only.
My problem is, that i load the color using the
System.Drawing.Color.FromName and when i do that,
i must have the name, and not the code like ffff0080.
To get the name I use the pictureBoxSomething.BackColor.Name!
|
|
|
|
|
Well do you see the "Define Custom Colors>>" button as disabled. I think this is all you need.
colorDlg.AllowFullOpen = false;
exactly does what you want. I guess by doing this the user can select only named colors.
Can you please elaborate on what is not working? I guess I did not understand you question well enough.
|
|
|
|
|
The AllowFullOpen disabled the "Define Costom Colors" as you said.
But some of the colors which the user still can select are not named colors.
At my Dialog, the color on the fourth row in the right side(somekind of blue color i think)
does not return a name, it gives me this code insted "ff8000ff" when i try to get the name.
Basicly my problem is very simple, i wants the colordialog to show colors
which only return named colors, so i can use them through the System.Drawing.Color.FromName event.
Is that possible?
|
|
|
|
|
Hello guys,
Does anybody know where i could find a decent reference for configuration files for .net 2.0
besides msdn2.microsoft.com ?
|
|
|
|
|
Im trying now to get the coords of the mouse on the SCREEN out side my form
i was thinking to use win32 WindowProc function on the desktop handler
( using getDesktopWindow() )
im familiar with using external functions like getDesktopWindow
but i just have no clue how to use WindowProc function ..
it suposed to get callback function or something
how to do it in c# ???
thanks
|
|
|
|
|
Have a look at System.Windows.Forms.Cursor.Position.
|
|
|
|
|
But it will only give me the position can i make a function which will catch mousemove event outside the window?
|
|
|
|
|
Search for global hooks here on CodeProject and you'll find some articles that describe how to do what you're looking for.
www.troschuetz.de
|
|
|
|
|