|
The exception has a Message member. What is the message when you get this exception?
|
|
|
|
|
I don't see anything obviously wrong, so the next step should be to get more information about the bug.
See what the values are for OpenFileDialog.FileName and fname. If they look ok, put a try/catch around this, and display the message on the exception.
|
|
|
|
|
I have debugged the code i get proper values in filename and fname
|
|
|
|
|
Hi,
did you bother looking at the values of filename and fname?
IIRC OpenFileDialog.FileName returns a file path, so your fname would be garbage.
FYI: (sub)folders of a StartupPath may be write-protected.
You should consider using Environment.GetFolderPath()
|
|
|
|
|
I have debugged the code i get proper values in filename and fname.
Folders and file have all permissions
|
|
|
|
|
More of a FYI than an answer , but you should always put the checked for value first:
if (DialogResult.OK == openFileDialog1.ShowDialog())
{
string filename = System.IO.Path.GetFileName(openFileDialog1.FileName);
string fname = Application.StartupPath + "\\Temp\\" + filename;
File.Copy(openFileDialog1.FileName, fname, true);
}
that way if you mess up and only type one = you'll get an error during compile.
This show what I mean:
int num = 3;
if (num = 4)
{
} vs
int num = 3;
if (4 = num)
{
}
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
|
|
|
|
|
asma_panjabi wrote: I get Exception as
Unknown software Exception(0xe0434f4d) ocurred in application at location 0x7c59bcb1
It works for all files except for .bmp file
Ne help for it?
And if you try another .bmp, same effect? Maybe the BMP is malformed or something.
Does the Temp directory exists?
|
|
|
|
|
Other bmp files work properly even the temp folder exists only some bmp files dnt work
|
|
|
|
|
This is the error m getting
System.UnauthorizedAccessException: Access to the path "C:\Documents and Settings\abc\Desktop\Debug\Temp\mani.bmp" is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
|
|
|
|
|
All,
I would need to make an in memory copy of several datagridviews. Depending on a selection I need to check whether or not the list should be loaded from DB or (if already in memory) from memory.
Any good way to make a deep copy of your datagridview?
I can't believe you have to do it cell by cell... right?
thanks.
|
|
|
|
|
you can copy the dataTable that youve bound to the DataGridView, assuming thats where the data came from...
DataTable myNewDataTable = (DataTable)dataGridView.DataSource;
hope that helps
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
My bad, I forgot to mention that the source is loaded with an ancient ResultSet and the datagridview is built by setting the values, not via a DataTable or DataSet (which have Clone and Copy methods...)
thanks.
|
|
|
|
|
then ehy not build a DataTable with your result set and then bind it to the DataGridView?
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
more or less the road I'm heading to right now. thanks.
|
|
|
|
|
any time
good luck!
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Anyone know how I can validate the Add method of a List<> property I have on a class short of overriding the Add method with a custom class?
e.g.
private List<string> stringList
public List<string> StringList
{
get
{
return stringList;
}
set
{
// Want to do validation here but isn't fired by Add method....
}
}
Thanks for any help on offer....
|
|
|
|
|
You need to create your class which wraps List<<>. Write your own "Add" method, do validation there before you add to underlying list.
RichardContact-1 wrote: set
{
// Want to do validation here but isn't fired by Add method....
}
This won't fire. When you call YourObject.StringList.Add() , get is executing, not set. get returns List<> instance and you add item to that. If you were doing YourObject.StringList = new List<string> , set will get executed.
|
|
|
|
|
|
hey guys
how do i enable double buffering on a specific panel?
where exactly do i put this?
SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.DoubleBuffer |
ControlStyles.ResizeRedraw,
true);
thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
myPanel.SetStyle(....
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i tried that before posting... its not showing up in intellisence... is there some assembly i should be referencing(using blah.blahblah;)?
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
It's a protected method so usually it doesn't appear in Intellisense. If you're authoring a custom control then you typically put the code into the constructor:
public MyControl()
{
base.SetStyle();
}
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
|
Ed.Poore wrote: If you're authoring a custom control
indeed i am
i tried that but it didnt work... here is my constructor...
public BreakClockControl()
{
InitializeComponent();
base.SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.DoubleBuffer |
ControlStyles.ResizeRedraw,
true);
base.UpdateStyles();
}
note: im painting on a panel thats on the control, not the control itself, might that be the problem?
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Yes, in all likely hood. You'd have to enable it on the panel as well. You should be able to call it without having the intellisense - try it and see if it compiles.
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
|
i got it to work like so
public class doubleBufferPanel : Panel
{
public doubleBufferPanel()
{
this.SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.DoubleBuffer |
ControlStyles.ResizeRedraw,
true);
this.UpdateStyles();
}
}
then i replaced the panel with the doubleBufferPanel, renamed it to same name as the panel i used, hooked up the event handlers ect...
it wasnt flickering anymore but my drawings got all messed up... is that the only way to do it?
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|