|
I suspect that your problem is caused by trying to access the progressbar from a different thread.
Take a look at this[^] for one solution.
If you search the CP articles for InvokeRequired , you will find several good articles on the subject.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hello,
Everything is accessed from the main thread. InvokeRequired is false. I will look into other options.
Thanks for your reply.
Keith
|
|
|
|
|
Here's[^] one of my articles that may be helpful.
|
|
|
|
|
This looks promising. I will look into it and see how I can change it for my needs.
Thanks!
Keith
|
|
|
|
|
hi
i have my C# program that work with sql-server 2008 Enterprise Edition
i have 40 users that connect to this database.
i dont close the connection.
how many open connection is recommended to leave ? or is it better to close connection ?
thank's in advance
|
|
|
|
|
Close them - they are a finite resource. At present it works, but suppose they add another 10 users in six moths time. Will it work then? Or will you have to drop the top-priority task you are working on then and fit long nights into retro fixing your software? I know which I would prefer.
Do it right the first time: then you hopefully won't get any nasty shocks.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
|
Always dispose the connection once the work is done. In case of ODP.Net, close and Dispose. Never leave a connection open.
|
|
|
|
|
I close and open it again later -- why dispose?
|
|
|
|
|
Hello,
I wrote my own installer in C#. It's all finished, except I'm having trouble with file type association, specifically file icons. I made my installer extract .ico embedded resource from its own .exe into the installation directory and set the registry key's DefaultIcon value to the icon file's path. (e.g C:\Program Files\Moonlite Map Studio\FileIcons\gx.ico,0), however in Windows Explorer only the .txt file icon shows up, so something must obviously be wrong.
What is the normal method to do it, and would I be able to do it programmatically?
Thanks,
Theo
|
|
|
|
|
|
It seems Windows only likes icons if they're embedded in resource .dlls. How can I do this?
|
|
|
|
|
No , windows use icon from dll , and exe files
I think the Structer of EXE .NET resource is different than other EXE
May be you must add icon your exe 16*16 , 32*32 , 48*48
any way use resource hacker for this Resource Hacker[^]
to check your exe and icon location ,
I know nothing , I know nothing ...
|
|
|
|
|
Hi,
I don't have very specific answers, however:
1. I'm pretty sure it can all be done programmatically.
2. You will have to provide more than one resolution (all square, and multiples of 16). Windows will use different icons on different occasions (Windows Explorer, large icon/small icon; taskbar buttons; desktop shortcuts; etc); and it differs for different Windows editions (typically newer editions such as Vista/Win7 like to also have larger icons, up to 96*96).
|
|
|
|
|
I need to get an image from the system clipboard (Clipboard.GetImage()) and serialize it to a file. The end goal would be to, at a later time, deserialize this image and put it back in the clipboard.
I can't figure out how to successfully serialize the image. I tried creating a serializeable class that contains an image object, but I get the exception
"The type System.Drawing.Bitmap was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically."
I tried using XmlInclude but am either doing it wrong or it does not resolve the problem.
Has someone done this before?
Darryl Borden
Principal IT Analyst
dborden@eprod.com
|
|
|
|
|
|
Please avoid cross-posting questions across forums. You don't need to waste the time of one of the people trying to answer your question after somebody else has already answered it.
|
|
|
|
|
So you're saving an image as XML?
This is why we need 1TB+ harddisks these days.
|
|
|
|
|
Hi , have a good day
When I want to output some result to console, from a Windows Application ( GUI )
I do this :
Project -> Project Properties -> Application -> Output Type: "Console Application"
int a = 17.5;
int b =5;
a= a * b;
datagridview1.DataSource = datatable;
Console.WriteLine(datagridview1.Rows.Count);
Console.WriteLine(a);
Thank you
I know nothing , I know nothing ...
|
|
|
|
|
Very illuminating. Now, why did you post that?
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
And your question is...?
I prefer to attach a console like this[^].
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Thank you , I learned something new
I know nothing , I know nothing ...
|
|
|
|
|
|
I'm doing some work with Active Directory using C# and the DirectoryEntry object. I'm fairly new to C# and exceptions, go easy on me!
Some Code:
DirectoryEntry entry = new DirectoryEntry ( LDAPServer, domainAndUsername, Password );
try
{
Object obj = entry.NativeObject;
}
catch (Exception ex)
{
ErrorMessage = ex.Message;
return false;
}
Now, it seems that when binding to the DirectoryEntry fails, the exception is called. The error is returned as a string, which gives me an idea as to what happened, But how do I test what the error was programmatically? Is there some kind of numeric value as well in the exception that I can test?
Basically, I want to know if the connection failed because of a bad ldapserver, or a username/password mismatch etc. I'm trying to create code that does a fail-over to a second ldap server if the primary ldap server is offline. I don't want to jump to the second server to retry the authentication, if there was an error with the credentials.
Is there another exception I can test for here? How would I found out what other exceptions are available for this object?
Any help you could give would be great.. Heck, I'll buy you a beer!
Mike
|
|
|
|
|
One way to do this is to have a series of catch blocks.
try
{
Object obj = entry.NativeObject;
}
catch (System.UnauthorizedAccessException e)
{
MethodToDealWithThisTypeOfError(aParameterFromEventArgs, anotherParameter);
return false;
}
catch (System.DivideByZeroError e)
{
MethodToDealWithThisTypeOfError(aParameterFromEventArgs, anotherParameter);
return false;
}
finally
{
MeassageBox.Show("This happens regardless of errors", Application.ProductName);
}
and so on.
[Edit]
Here is a reasonable article[^]
[/Edit]
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|