|
I'm surprised that no one has pointed to MSDN for this: http://msdn.microsoft.com/en-us/library/system.windows.forms.application.doevents.aspx[^]
I know MSDN isn't always helpful, but it tells you what it does as well as when to use it and when not to use it.
Realistically, most circumstances where it is not safe to call DoEvents indicates that you are doing something wrong (such as raising the event in its own handler). Note: the emphasis is on "most" since there are exceptions to almost every rule.
I don't claim to be a know it all, for I know that I am not...
I usually have an answer though.
|
|
|
|
|
MSDN unforunately doesn't say HOW it does it, which was what I wanted to know.
I pretty much always check MSDN; I find it very helpful.
I already have a lot of experience using DoEvents in a correct way in VB6. With .NET I much prefer a worker thread though, for many reasons.
Thanks for all the responses
|
|
|
|
|
Hello All ,
I have used a CalendarExtender in my page with textboxes. When I press enter key in another textbox, calendar's popup is appearing.
I have used defaultbutton attribute in form tag and tried keeping my button id as defalut button but this is also not working.
Please help me out in same..
Thanks In Advance
|
|
|
|
|
Sorry, but you chose the wrong forum for your repost. You should be asking this in the ASP.NET[^] forum.
|
|
|
|
|
Hi all,
I am doing a very simple operation via c#.
1 I just copy an existing JPEG file in temp directory.
2 Then I open the copied Jpeg file from temp directory.
3 I try to delete the original Jpeg file and application crashes.
Please see below c# function for this:
using System.IO;
public void DeleteAfterCopyingOriginalImageFile(string strOriginalJpeg)
{
string strTempFolder = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "JpegTemp");
if (!Directory.Exists(strTempFolder))
{
DirectoryInfo directory = Directory.CreateDirectory(strTempFolder);
directory.Attributes = directory.Attributes | FileAttributes.Hidden;
}
string strTempJpeg = System.IO.Path.Combine(strTempFolder, "TempImage.jpg");
if (!File.Exists(strTempJpeg))
{
File.Copy(strOriginalJpeg, strTempJpeg);
}
Process.Start(strTempJpeg);
File.Delete(strOriginalJpeg);
}
I need to follow exactly these steps (cannot delete original file before opening TempImage.jpg). Can anybody help in knowing why copy and opening of temp file lock the original file. How can I prevent original jpeg file from being locked. I am new in .Net. Please help me.
More Info about the user case: The user case is that user cannot perform any operation on original file. So a temporary copy of original file is created in temp folder. User can then open/edit temp file. And if he thinks that he can replace original file with that of edited (copied in temp directory) one or he does not need original file any more, he can delete original file (and if required, can make temp file as the original one). So I strictly need to follow the same steps.
Regards
Aseem
Thanks in Advance
|
|
|
|
|
DO NOT cross post or repost you question.
You have received responses to your original post. Posting again will not allow others to see all the context and what has been tried already.
Read "How to get answers..." at the top of this forum!
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|
You can't. THe image is represented in memory as a 32-bit full resolution bitmap in memory. In the file, it's compressed down to whatever the JPEG encoding settings are. For example, an image that is 3000x2000 pixels will take up 24MB of memory at full resolution. The resulting image on screen will not be that large, so it'll get painted scaled down to whatever size is visible. There is no class in the .NET Framework that will reduce the memory size by representing the image in its file format. You'd have to either write your own class to do this or find a 3rd party library that does this. I don't know of any.
|
|
|
|
|
if, I repeat: if, your PictureBox is significantly smaller than the original image, then you could solve your problem by creating a new and smaller image, like so:
Bitmap bm1=Bitmap.FromFile(filespec);
Bitmap bm2=new Bitmap(bm1, myPictureBox.Size);
bm1.Dispose();
myPictureBox.Image=bm2;
if not, there's nothing much you can do about it, as .NET keeps images in RAM as real bitmaps (normally 4B/px).
|
|
|
|
|
|
Probably because it implemented a custom class to represent the image in its native file format in memory. That would also mean it has to have custom rendering code to parse the image data, as needed, and only the sections of it that are required to render the visible part of the image on screen.
|
|
|
|
|
Hi,
Hope this is the right place to post this question. If not please let me know the right place.
I've an application in .net 3.5 framework. I would like to create a setup for the application, which will install the .net framework also(if it doesn't present in client machine). Please guide me how to achieve this. Thanks in advance.
|
|
|
|
|
YOu can use VS to create a setup program. It will automatically detect dependencies such as the .NET Framework and offers an option to include it with the setup or download it.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thanks for your reply. I created setup project for the application and it detected .Net framework dependency automatically. But could you let me know where can I find the option to include framework so that it will install framework while installing the application. Thanks in advance
|
|
|
|
|
View the properties for the setup project then click the Prerequisites button
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|
Navigate the given link to know how to deploy application along with .Net Framework
deployment guides[^] and click on this Link[^] to download The guide provides information on deploying all types of Framework application using a variety of mechanisms, including no-touch deployment, and Windows Installer package deployment.
Hope it will work for you.
|
|
|
|
|
MEMSG.To = GetData(tsqlemail)
the ERROR i get is: Property 'To' is 'ReadOnly'.
how do i correct this???
deepshikha
|
|
|
|
|
Hi,
which type is MEMSG from? Maybe there is a static method for the MEMSG-type to pass "To" to.
Regards
Sebastian
|
|
|
|
|
This means that there is no public setter for the To property. There will be another mechanism for adding the data, maybe via the constructor - unfortunately, without the 1000 mile telepathic link available, I have no idea what MEMSG is so can't tell you what this mechanism is.
|
|
|
|
|
Maybe this helps: in System.Net.Mail.MailMessage class, the recipient properties (To, Cc, Bcc) are collections, that cannot be set, however they can be operated upon, using methods such as Clear() and Add(). I suggest you read the documentation...
|
|
|
|
|
Luc Pattyn wrote: I suggest you read the documentation...
That's just too much trouble. It's much easier to ask then rant when no one understands or gives you the answer you want. Then it's their fault, not yours.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Sorry, I am aware I sometimes repeat myself.
|
|
|
|
|
I didn't catch that. Could you say it again?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I will. Someday. You'll notice I'm sure.
|
|
|
|