|
It's not a fair comparison to compare C# with unmanaged C++. Or do you actually mean managed C++?
Nish
Oh, I don't know why she's
leaving, or where she's gonna go
I guess she's got her reasons but I just don't wanna know
'Cos for 24 years I've been living next door to Alice
24 years just waitin' for a chance
To tell her how I feel and maybe get a second glance
Now I gotta get used to not living next door to Alice
|
|
|
|
|
I'm not sure I understand what you mean by not being "fair" to compare the two. I'm interested in knowing if C# truly does combine the benefits of C++ (speed, flexibility) with the benefits of a RAD language (ease of use). Or am I going to take a perfomance hit by switching to .NET and managed code. I mean, I know it's not "fair" to compare a Honda Civic EX to a Ferrari 360 Modena, but I sure know which one is faster. That's all I want to know.
|
|
|
|
|
Well then here goes :-
Unmanaged code will always run faster than managed code.
Thus unmanaged C++ will be faster than C# or any other .NET language including managed C++.
Among the managed languages, managed C++ produces slightly faster code cause the MC++ compiler has certain extra optimizations [I do not know the details, but I've heard Chris M rave about this several times]
Nish
Oh, I don't know why she's
leaving, or where she's gonna go
I guess she's got her reasons but I just don't wanna know
'Cos for 24 years I've been living next door to Alice
24 years just waitin' for a chance
To tell her how I feel and maybe get a second glance
Now I gotta get used to not living next door to Alice
|
|
|
|
|
gt4924f wrote:
if C# truly does combine the benefits of C++ (speed, flexibility) with the benefits of a RAD language (ease of use).
No! C# was designed to be "easy to use", not to be fast. If you want to do some math calculations, pick either C++ (maybe with Blitz library) or Fortran. Everything else is too slow IMHO.
I vote pro drink
|
|
|
|
|
Nemanja Trifunovic wrote:
C# was designed to be "easy to use", not to be fast
Exactly. In fact most of .NET seems to be like that
Nish
Oh, I don't know why she's
leaving, or where she's gonna go
I guess she's got her reasons but I just don't wanna know
'Cos for 24 years I've been living next door to Alice
24 years just waitin' for a chance
To tell her how I feel and maybe get a second glance
Now I gotta get used to not living next door to Alice
|
|
|
|
|
How can I get my program's manifest file as a resource? The docs only vaguely mention it, but I can't seem to figure it out. Perhaps its simply my inferior software; I only have the freeware SharpDevelop to work with, and whenever I add it as a resource the standard way it gives me it as a System.Byte[].
I need the manifest primarily for the XP styles it provides. But needless to say, having to drag around this extra file isn't very convenient.
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|
|
From what I've seen, the embedded-resource manifest needs to be stored as a standard Win32 resource - not a .NET assembly resource.
If you've got VS5/6/.NET, you can open up your application's exe and add it manually. From what I remember, it needs to be added as a custom resource type called "RT_MANIFEST" with ID = 1. Check www.gotdotnet.com for more specifics (search for Manifest)
Unfortunately, there doesn't seem to be a quick way to get the C# compiler to emit standard Win32 resources.
The other option, as you have already figured out, is to carry around the .manifest file with your exe.
--
Russell Morris
"WOW! Chocolate - half price!" - Homer Simpson, while in the land of chocolate.
|
|
|
|
|
This must be the dumbest question ever, but how can I set my program's icon (i.e., the one in Windows Explorer)? I have already tried this.Icon = ... in my main form class, and that only sets the icon of the actual form. I know this must be REALLY simple, but I've searched all the docs many times. Help??
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|
|
There's a few ways.
1. Right click your project in the Solution Explorer and click on Properties and in the properties pages you can set the project icon.
2. Edit the ProjectName.csproj file... the ApplicationIcon entry should be about 10 lines down.
3. The /win32icon: command line switch for the C# compiler.
Andy Gaskell, MCSD MCDBA
|
|
|
|
|
I have a DataGrid,I need the event that raise,when a user DbClick on a cell or row,But I can't find it,Does anything like this exist in C# or any solution for it?
Thanks
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Would this work (not tested)?
Control.DoubleClick Event
[C#]
public event EventHandler DoubleClick;
Event Data
The event handler receives an argument of type EventArgs containing data related to this event.
Remarks
The ControlStyles.StandardClick style must be set for this event to be raised.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Andres Manggini wrote:
Control.DoubleClick Event
No,this raised when you double click on fixed column or cells,not regular cells.I think there is solution and thats when you want to edit a cell you have to DbClick on that cell,Do you know what event raised when it goes into edit mode?
Andres Manggini wrote:
Remarks
The ControlStyles.StandardClick style must be set for this event to be raised.
Where is that?I couldn't find it.
Thanks
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
mmm.. I don't know, I'll see if i look into it.
this documentation is from MSDN (the one which comes with Visual Studio.NET Enterprise Edition).
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Andres Manggini wrote:
this documentation is from MSDN (the one which comes with Visual Studio.NET Enterprise Edition).
Sorry,Which documentation you mean?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Microsoft Visual Studio.NET Documentation.
a blue ballon icon, with a question mark inside of it
Regards,
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
ControlStyles is an enumeration. Each control has one and can be set via the SetStyles() protected method on a control. You pass in the flags you want to set/unset and pass in true or false to tell whether it should set that style.
HTH,
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
Can you give an example please?
Thanks
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Usually you set it in the controls constructor so
public class myDataGrid : DataGrid {
public myDataGrid() {
SetStyle( ControlStyles.StandardClick, true );
}
}
Now the Double click events will fire according to the documentation.
I can't tell from the documentation if the DoubleClick event will fire for everything now or if it was supposed to indicate the standard event will fire.
In anycase you should be able to hook into the DoubleClick event yourself and do some calculating to determine which cell is being clicked on.
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
hmmm,So I have to use subclassing,I never do that in C#,Can you tell me how?Is this right:
Create new class derived from DataGrid class and handle DoubleClick() event.
Then I don't know how to use it in my application.
Thanks
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Yep thats correct, using a subclassed control is easy; instead of saying System.Windows.Forms.DataGrid, you refer to myDataGrid
Thats all there is to it.
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
I am going to try this again. I have a dll which I can call in VB6 with no
problem. I am trying to convert all my code to c# but I am running into a
big problem with accessing dlls'.
The first time I posted this question no one could answer why I was getting
the error, so I will ask what is the error exactly. I have researched all
the wox books, microsoft and cannot find out what this error actually means
to give me a starting point for my resolution.
Here is my code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace WindowsApplication20
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
[DllImport("Mydll.dll")]
public static extern int myOpen(string sFileName);
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label1;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(32, 88);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(408, 20);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "textBox1";
//
// button1
//
this.button1.Location = new System.Drawing.Point(32, 48);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(104, 23);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(32, 120);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(400, 20);
this.textBox2.TabIndex = 2;
this.textBox2.Text = "textBox2";
//
// label1
//
this.label1.Location = new System.Drawing.Point(32, 160);
this.label1.Name = "label1";
this.label1.TabIndex = 3;
this.label1.Text = "label1";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(496, 373);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.label1,
this.textBox2,
this.textBox1,
this.button1});
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{
}
private void button1_Click(object sender, System.EventArgs e)
{
OpenFileDialog fdlg = new OpenFileDialog();
fdlg.Title = "C# Corner Open File Dialog" ;
fdlg.InitialDirectory = @"c:\" ;
fdlg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*" ;
fdlg.FilterIndex = 2 ;
fdlg.RestoreDirectory = true ;
if(fdlg.ShowDialog() == DialogResult.OK)
{
label1.Text = myOpen(fdlg.FileName).ToString();
}
}
}
}
I am getting into the DLL with no problem, but once the call is made i
receive the:
"value null was found where an instance of an object was required"
The dll basically opens the file and will return a number 0-99, 0 meaning
unsuccessful and non 0 is successful.
I know I can open file in c# many different ways but I have several other
calls in the dll I use, but this is the simplest to diagnose.
Here is the header for vb6:
Declare Function myOpen& Lib "mydll.DLL" Alias "MYOPEN" (Filename$).
Any help would be appreciated, this is very frustrating.
Thanks,
Bob
|
|
|
|
|
Hi,
I'm writing a console app and I need to clear the console, or reposition the cursor at the top left of the console so I can overwrite the current display.
I've been looking but I can't find a way to do this...
Can anyone help me?
Chris.
|
|
|
|
|
Either it is a remarkably small world, or you are not the Chris Masiero that I am thinking...
--
David Wengier
TAC ad gone wrong: "Don't fool yourself, you're a bloody idiot."
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
Hehe, It's just a very small world
- Chris 'eclipsed' Masiero
|
|
|
|
|
How to generate a guid (global Unique Identifier) in C#? Thanks
chris#
|
|
|
|
|