|
Xpnctoc wrote: without the use of they keyword "inline" treated as "inline" anyway,
For information of that type I would recommend you check out Stan Lippman's blog
Xpnctoc wrote: Is there a drawback (other than bad C++ practice)
Technically it's not C++. Since you are creating a .NET assembly the native C++ use of headers files does not apply. So the the two situations are not comparable.
|
|
|
|
|
In addition to led mike's reply, I would like to mention the following. I wouldn't mess with anything produced by the wizard because your changes can affect how the wizard updates your code. In non-wizard produced code, you may have to separate declaration from definition if you have circular dependencies. Unlike the C# and VB compilers, AFAIK, you need to create forward declarations to resolve circular dependencies.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I appreciate the response. I do have a fairly strong background in native C++, and I'm used to setting up my data structures so as to avoid circular references. I was just wondering if there could be any impact on performance. But, as Led Mike pointed out, it is really apples to oranges since I'm dealing with managed assemblies instead of native DLLs. So I'll just continue practicing good coding conventions in my managed and unmanaged classes, and let the forms generator do its own sloppy thing
|
|
|
|
|
However, you have to be very careful with C++/CLI. Sometimes it behaves just like C++, sometimes like C# and VB, and sometimes like none of above! For instance, derived class ctors execute before base class ctors! I guess this is normal for .NET languages but it just seems so unnatural too me.
The "For instance, derived class ctors execute before base class ctors!" comment is incorrect see my post below!
-- modified at 18:55 Wednesday 29th August, 2007
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
George L. Jackson wrote: For instance, derived class ctors execute before base class ctors!
HUH?? In what case?
I know (well, I've "heard") virtual calls in constructors (never a good idea anyway)
are handled different, but AFAIK C++ ref classes are still built from the inside out.
ref class refbase
{
public:
refbase()
{
Console::WriteLine("refbase");
}
};
ref class refsuper : public refbase
{
public:
refsuper()
{
Console::WriteLine("refsuper");
}
};
int _tmain()
{
refsuper ^super = gcnew refsuper();
Console::WriteLine("\r\n");
Console::WriteLine("Press Enter to end...");
Console::ReadLine();
return 0;
}
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Oops! You are right! I meant the derived class initialization list is executed before the base class ctor. I think I had too much filet fish today.
-- modified at 19:04 Wednesday 29th August, 2007
ref class Foo
{
public:
Foo()
{
Console::WriteLine("foo.ctor");
}
};
ref class Base
{
public:
Base()
{
Console::WriteLine("base.ctor");
}
};
ref class Derived : Base
{
Foo^ f;
public:
Derived() : f(gcnew Foo)
{
Console::WriteLine("derived.ctor");
}
};
int main(array<System::String ^> ^args)
{
Derived^ d = gcnew Derived;
return 0;
}
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
|
how to assign a tooltip to a push button in c++
plz help
dghdfghdfghdfghdgh
|
|
|
|
|
There is a thing called ToolTip class, it is well documented, and MSDN
includes an example. And CodeProject has several articles about it.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I have problem retrieving the primary key for a new row that is added to the database.
This is what I have now:
DataTable^ MyTable = myDataSet->Tables[0];
DataRow^ row = MyTable->Rows->Add();
if (row != nullptr)
{
row["item_id"] = item_id;
row["use"] = use;
row["type"] = Convert::ToInt16(type);
DataAdapter->Update(myDataSet, "tblPanel");
PanelID = Convert::ToInt64(row["ID"]);
}
now the value PanelID is always 0 for the first time this loop runs, the second time and further the information is correct and I can use the PanelID to create the relation with other tables.
What am I missing?
Stefan
|
|
|
|
|
From my experience, the primary is usually created at the database server via a trigger or stored procedure. You can send your data to be added to a store procedure which can return newly created primary key.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I have been looking at different site and manuals for an example but have not found one containing a stored procedure. Mostly I found some SQL way to find it but it has the same problem. Strange thing is that only the first time is not working and I can't find any missing declarations.
Stefan
|
|
|
|
|
I am at work right now and cannot provide an example of how I solved the problem. I have used both Oracle and Sql Server store procedures to obtain the primary key. However, I believe there are some tricky spots.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
led mike's post refers to what I am talking about. I also have a different solution that uses a stored procedure but it was designed to do some extra fancy stuff that may be overkill for what you have in mind.
Geo
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
|
I checked out the site and found the things I need I think.
Just pity that microsoft provides only examples in VB and C#.
Stefan
|
|
|
|
|
Stefan Baens wrote: I checked out the site and found the things I need
I'm glad you have a solution
|
|
|
|
|
I'm currently using VisualStudio2003 (and cannot change due to the fact that other team members are using it too).
My current project uses managed code to dynamically link a .NET-DLL into my program, works so far.
The only problem is, that to compile and link this DLL I need a [dllname].netmodule file, which can only be generated with VisualStudio2005.
The file is generated by linking the dll into my project (references) and automatically used when the dll is loaded.
VC2003 does not generate this file automatically, but if it is not present, the DLL cannot be used (access violation).
Using google I found this to be a bug in VC2003 but no appropriate solution.
Is there any way to generate this file with VC2003 (compiler switch, etc.) automatically??
Thx in advance
|
|
|
|
|
Hi,
AFAIK it's currently only supported to compile a netmodule in VS2005 via command line. Currently there is no IDE support for it. Because this really bugged me I looked for another way and ended up changing a single tag in the csproj-file.
Before change:
<OutputType>Library</OutputType>
After change:
<OutputType>module</OutputType> Works perfectly for me (VS2005) but you've to check if this works in VS2003, too.
After you've done this change take care not to change the output type of this project via the IDE anymore. It will of course overwrite your hand-changed tag.
Perhaps the following links can help you, too:
http://support.microsoft.com/?scid=kb%3Ben-us%3B309805&x=9&y=11[^]
http://support.microsoft.com/kb/311416/EN-US/[^]
cheers,
mykel
OMM: "Let us be thankful we have an occupation to fill. Work hard, increase production, prevent accidents and be happy."
|
|
|
|
|
Well, thank you for your answer but that didn't help..
I'm using VC2003 and a .vcproj file to create the dll.
The .NET library is linked inside(!) this dll as I want to use some of the implemented functions.
The .NET library is linked via assembly reference only:
AssemblyReference RelativePath="$(SolutionDir)\include\[.NET].dll"
I can access the namespace and library classes at design time.
The weired thing is that VC2005 created the [.NET].netmodule automatically (with the same project), but VC2003 does not.
Looks like there is no (easy) solution for this bug and I have to use VC2005 to create the module file..
thx
-- modified at 6:16 Tuesday 28th August, 2007
|
|
|
|
|
Hello,
Is there an easy and fast way to convert an vector to a managed array?
Best regards
Hansjörg
|
|
|
|
|
hansipet wrote: Is there an easy and fast way
Yes, all you have to do is write some code, compile and then execute.
|
|
|
|
|
I think everyone knows that code can be written, compiled and execute. But not every code is the best and fastest solution for a given a problem.
I think it would be better when you don't give such stupid hints!
|
|
|
|
|
He is telling you that you need to determine the "best and fastest" solution on your own because each solution has trade-offs that affect certain situations negatively. Since you know your situation and we don't, you will get stupid hints! So, get your compiler and profiler, and have fun!
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi,
I came to know that the default funcations created when we creat a class are
1) Constructor
2) Distructor
3) Default copy constructor
4) Default assignment operator overloaded
5) ...i dont know what is 5ht one
can any one correct for the above funcations.
And also I dont know what is the use of these funcations. For our need we need to create our own copy constructor ..then what is the use of default (in built) copy costructor. Also please breaf what is the use of these inbuilt (default) funcations.
Nandu.
|
|
|
|