|
Hi,
Using "AsReadOnly" method ReadOnlyCollection<MyClass> type property can be exported without having to declare and initialize a ReadOnlyCollection<MyClass> type object, so more simple way to do the same. I like it.
Anyway, I realize that the List object is ReadOnly but the objects that it contains are not. So I can't offer a Read-only access for my List of objects. It seems like I have to make my own wrapping code to export the objects with ReadOnly access too. Right?Another solution?
thanks a lot
|
|
|
|
|
I have developed an application that takes a photo. I have a fixed path that the photos are saved to. I am able to save just one and after that unless I restart the whole application I am not able to save to overwrite the file because it sees the file as being in use. Any idea how I can overwrite or delete file in use?
a novice
|
|
|
|
|
It sounds like the actual issue is that you're not actually closing the file when you're done with it.
|
|
|
|
|
yeah, what happens it I add other things like signature and name to the photo and same them as one image,I don't need to close the program after the process is complete. I have to be doing for a lot of photos.
a novice
|
|
|
|
|
You probably are not closing the file you previously opened for writing. If you are using the StreamWriter to write the contents, make sure you call Dispose after you're done with it. Or wrap it in a "using" block like
using (StreamWriter writer = new StreamWriter(...))
{
writer.blah();
}
|
|
|
|
|
Hi, there may be two issues:
1.
Most ways to load an image keep the image file open as long as the Image object is not
Disposed() off. The only exception I am aware of is when reading an image through
Image.FromStream()
Remedy: use FromStream() or make sure you call Dispose().
remark: I don't think it is sufficient to Dispose() of a PictureBox if it is the only
thing refering to the Image that got loaded from your file.
2.
When a file, any file, is freshly written chances are some other utility is investigating
it, prohibiting you from immediately renaming, deleting or overwriting it; candidate
utilities are abything that works in the background on new files, such as file system
indexers, and ativirus tools.
Remedy: retry a couple of times, 1 second apart.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Hi all,
I'm trying to change the ForeColor and BackColor of each component on the form without having to call each on their name. Is there a way I can do this. I know that in C++ one can use dynamic_cast but what about C#
Thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
foreach (Control myControl in this.Controls)
{
myControl.BackColor = Color.DarkGoldenrod;
}
|
|
|
|
|
Thanks you very much for the help, just one question, how can I get hold of the Color 'ControlDarkDark', I cannot find it in the Color class
Thanks again
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
it's SystemColors.ControlDarkDark
|
|
|
|
|
|
Hi,
Sorry to bother again, but after I have pasted and tried the code snippet I noticed that the controls on the form like the tab control and the items within the splitcontainer does not change, why is this?
Thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
That's because some controls contain child controls, and you're only setting the colour at the root level.
Try something like:
private void SetFormBackground()
{
foreach (Control myControl in this.Controls)
{
myControl.BackColor = SystemColors.ControlDarkDark;
SetChildBackground(myControl.Controls);
}
}
private void SetChildBackground(Control.ControlCollection subControls)
{
foreach (Control myControl in subControls)
{
myControl.BackColor = SystemColors.ControlDarkDark;
SetChildBackground(myControl.Controls);
}
}
Calling SetFormBackground() will set the colour on all the controls at the root level (controls placed directly on the form) and then call SetChildBackground on any controls contained within the control itself (e.g. tab pages, splitter panes, controls placed on those pages, etc)
|
|
|
|
|
Thank you very much benjymous for the help.
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Hi there,
How do I fire the DropDown event of the DateTimePicker control?
I'd like to fire the event from another control.
Thanks,
J
|
|
|
|
|
i want to send a SMS to the pc thorugh infrared or bluetooth, which i received from some one. can any one tell me how do this ? i'm trying to do this,but i'm not an expert in this feild..
|
|
|
|
|
I'm not expert. But so far I know, if you are connected through infrared or bluetooth, then you get a new COM port. Just use class SerialPort to connect to this new COM port. Then you must go to the website of your mobile phone manufacturer. You can download API from support, how to receive / send SMS through PC. Just use that code.
|
|
|
|
|
Hello everybody!
I'm having a project:"Comunication between 2 PC by RS232(COM)".
I have not yet source code about this project!
I've just need a program in which I can comunicate between 2 PC by RS232 (send file or chat).So if everybody here have source code or a program about my project,please share it to me! Thanks very much!
Thanks for reading my message!
Regards,
|
|
|
|
|
I'm thinking, would it not be easier if we just sent you our paychecks directly? Saves all this messing around finding projects.
|
|
|
|
|
|
Thanks stancrm!
but download file on website you give to me is:communication with LCD device.
I need :"Commuication RS232".I think that program can't help me!
|
|
|
|
|
Hi All,
Prerequisites:
* VC#.NET and GDI+.
* Windows forms.
* A rectangle is drawn on the form along with rect tracker.
Problem:
How to rotate rect and rect tracker?
|
|
|
|
|
Hint:
Take a look at classes in System.Drawing.Drawing2D namespace, namely Matrix class.
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Write some code in C# that rotates the rectangle and tracker. Sheesh, come on. We don't write your code for you - if you want that try rentacoder.com. Write some code and if it doesn't work, show it to us so that we know that you've at least tried for yourself.
|
|
|
|
|
I have not asked anyone to write code for me, mister.
Some guy "dnh" has responded (about Matrix). Now i am trying to write the code. That's enough.
I think u have reacted like this after seeing my awful question format.
|
|
|
|