|
Besides what Richard above linked, I would also recommend this book[^]
If you think you can do a thing or think you can't do a thing, you're right - Henry Ford
Emmanuel Medina Lopez
|
|
|
|
|
Start by reading some books.
|
|
|
|
|
i prefer using Microsoft Expression Blend for design, styles and applying graphic effects and then continue work on project in Visual Studio for coding.
also if you don't know about WPF, you must reading some educational resources[^] or you can use some available components about metro style like "Telerik Rad Control" which with them you don't need any more WPF.
-Amir Mohammad Nasrollahi
/* LIFE RUNS ON CODE */
|
|
|
|
|
Sorry for the late reply, but thank you both very much, this helped me a lot and now I have a fully functioning Metro App up and going. It's a pity Microsoft is taking them down again though, I was just getting good at it.
|
|
|
|
|
I'm trying to design some classes that call base in the constructor. But I want to pass the derived class to the base class as it's parameter in the constructor. It's simple in C++ but I can't find a way to do it in C#. If anyone could tell me a way to convert the type in the constructor would help me keep my sanity.
public class CWebFormField
{
public CWebFormField(ref CWebFormField ff)
{
}
}
public class CWebRectFormField : CWebFormField
{
public CWebRectFormField(ref CWebRectFormField ff) : base(ff)
{
m_Rect = ff.m_Rect;
}
}
Because I try to pass ff to the base class I get an error of
Error 2 Argument 1: cannot convert from 'VSWebForm.CWebRectFormField' to 'ref VSWebForm.CWebFormField'
|
|
|
|
|
The problem is the ref requirement:
From the C# specification:
"When a formal parameter is a reference parameter, the corresponding argument in a method invocation must consist of the keyword ref followed by a variable-reference (§12.3.3) of the same type as the formal parameter"
http://www.jaggersoft.com/csharp_standard/17.5.1.2.htm[^]
And the problem is that your type isn't exactly the same type - it's derived. And you can't take a ref of a cast of a variable to prevent you from accidently changing the parameter to a different derived class from the same base and passing it back...
public void BuggerItUp(ref Control c)
{
c = new Label();
}
...
DataGridView dgv = new DataGridView();
BuggerItUp(ref (Control) dgv)
Do you really need the ref here?
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
|
|
|
|
|
|
You're welcome!
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
|
|
|
|
|
Is the idea behind your code a "copy constructor"? Then you might look at the IClonable interface and how to implement it in the .Net world.
|
|
|
|
|
It is. Thanks for the advice I'll check it out.
|
|
|
|
|
how to create a export xml file in SQL database using c# tnx..
|
|
|
|
|
There are a huge number of ways!
The easiest is to use a DataSet.
Easy write:
Create your data in a DataTable, then:
DataSet ds = new DataSet();
ds.Tables.Add(dt);
ds.WriteXml(@"D:\Temp\td.xml");
Easy Read:
DataSet ds = new DataSet();
ds.ReadXml(@"D:\Temp\td.xml");
dt = ds.Tables[0];
You can use DataTable.ReadXml instead, but it doesn't support schema inference, DataSet.ReadXml does.
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
|
|
|
|
|
Hi everyone,
My application was written in Visual Studio 2010.
After closing my application, there is still a running process that showed in the Task Manager.
Do you know, how to dispose all resources after I close my C# application ?
Thanks and regards,
Tai
|
|
|
|
|
taibc wrote: After closing my application, there is still a running process that showed in
the Task Manager. Do you know, how to dispose all resources after
I close my C# application ?
All .NET objects will be disposed of by the runtime. Did you launch a (non-background) thread?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Yes.
I found out a way to do that by use the statement:
Process.GetCurrentProcess().Kill();
Thanks and kind regards,
|
|
|
|
|
taibc wrote: Process.GetCurrentProcess().Kill();
Yep.... that will work.... if you do not want to do it correctly.
|
|
|
|
|
Actually, that'll leak resources, not close them.
|
|
|
|
|
Dave Kreskowiak wrote: Actually, that'll leak resources, not close them.
What resource do you think will be leaked after the Process exits?
|
|
|
|
|
Off the top of my head, anything that holds an unmanaged handle, such as GDI objects: Brush, Pen, Graphics, ...
That's by no means a complete list of the stuff that can be orphaned, just a sample.
|
|
|
|
|
I doubt that a Process will hold on to any of those when the Process exits, regardless of how it exits.
|
|
|
|
|
I wouldn't bet on that - from experience.
|
|
|
|
|
|
Maybe not. It may depend on if you run the system out of resources first. My experience was killing a process that leaked handles like crazy. Once you exhaust the handle pool, Windows starts to loose it's mind.
|
|
|
|
|
Dave Kreskowiak wrote: Windows starts to loose it's mind.
Which version of windows?
|
|
|
|
|