|
Thanks Mark,
I hate those kind of full namespace declarations. I really don't understand why sometimes you have to include the entire namespace name even though the namespace has already been defined with the 'using' keyword. It wouldn't be so bad if there was a list of types that require the full "path" for lack of a better word.
Buck
|
|
|
|
|
BuckBrown wrote: I really don't understand why sometimes you have to include the entire namespace
You don't, if you use "using"...
using namespace System::Windows::Forms;
...
ListViewItem^ myRecord = this->listView1->Items[0];
ListViewItem::ListViewSubItemCollection^myCollection = myRecord->SubItems;
String ^field_1 = myCollection[0]->Text;
...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
This is a good example of how to determine if I need to include the preceding ListViewItem:: (or any other preceding datatype: . I have run into declaration problems like this before but those first two lines after the ellipsis are illustrative of the approach. I am printing that one for my notes.
Buck
|
|
|
|
|
I didn't state that correctly, and I modified my post above...
ListViewSubItemCollection is a subclass nested class in the ListViewItem class.
It's the same thing you'd have to do with regular C++... the compiler has to
know the class and the namespace
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi, I'm using C++/CLI and Visual Studio 2005. I have a list view control that I would like to have the columns center justified. I can center justify all the columns except the first column. The GUI designer will not change from left to center justified and if I hard code the justification it still will not do it. Is this a subtle bug? Why won't the first column center justify?
Thanks
Buck
|
|
|
|
|
Hi to everybody..
i want to this book ...is there any url is there for downloading this book .plz ...
The MFC Answer Book: Solutions for Effective Visual C++ Applications by Eugene Kain
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
|
|
|
|
|
Here's a thought. Don't steal. Buy the book.
Another thought - that book is not about managed C++. Perhaps as well as being a thief, you're too dumb to read this book anyhow ?
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Christian Graus wrote: Here's a thought. Don't steal. Buy the book.
Another thought - that book is not about managed C++. Perhaps as well as being a thief, you're too dumb to read this book anyhow ?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
What is the translation of this code from C# to C++ ??
public
String A
{
get
{
return a;
}
}
public
String B
{
get
{
return b;
}
}
Thank you...
modified on Wednesday, February 20, 2008 8:21 AM
|
|
|
|
|
|
Sorry, can you look to the code again ? It's C# (I pasted the wrong one which i tried to translate)
Replace
public with public :
and
String with String^ ?
I got errors for "get"...
|
|
|
|
|
|
Thank you very much
|
|
|
|
|
Hi,
I have 2 forms (Form A, Form B). One of them is Parent(Form A), the other one is Child(Form B). Child form has textboxes which users can input smtg. I want to transfer data from Child Form's textboxes to Parent form textboxes. How can i do this ?
I found some articles about Delegates but all in C#, i tried to convert them in VC ++ but everytime i had some errors. I tried to declare a delegate in Form A like:
public ref class Randevu2 : public System::Windows::Forms::Form
{
public:
R2(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
public delegate void DelDeneme(String^ s1, String^ s2);
But everytime i had errors. Can any one suggest something or tell me that where i declare delegates?
|
|
|
|
|
Badboy22TR wrote: I want to transfer data from Child Form's textboxes to Parent form textboxes. How can i do this ?
One approach is you can learn about Design and Patterns like Model-View-Controller.
Another approach that most people around here do is expose the controls as public properties and just set/get the data from one to the other whenever you like, that way they are tightly coupled so that when you want to change something later it's a big mess.
Badboy22TR wrote: Can any one suggest something or tell me that where i declare delegates?
Have you looked at the C++/CLI Beginner articles here on code project? They are highly recommended.
led mike
|
|
|
|
|
MVC to pass data between forms??? you will never understand this....
|
|
|
|
|
|
Hi guys,
I want to make an array that consists of system defined colors. I wrote the code
System::Drawing::Color Color1[]={Color::Black, Color::Brown, Color::Red};
what delivered the error
'System::Drawing::Color' : a native array cannot contain this managed type
Then I tried this version
Color Color1[] = __gc new Color[];
and I got this error
error C2440: 'initializing' : cannot convert from 'System::Drawing::Color ^' to 'System::Drawing::Color'
Has anyone an idea how to make this work?
Thanks and best wishes
|
|
|
|
|
I would expect this to work...
Color Color1[] = __gc new Color[3];
What about this?
Color Color1 __gc[]= new Color __gc[3];
BTW, this is SO much nicer in VC 2005+ (without the managed extensions)
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks but this also doesn't work, it just causes more errors.
|
|
|
|
|
Yeah you were trying to use managed extensions (old) syntax so I assumed you
were using VS 2002/2003 .NET.
Since you're not, use the new array syntax (no more __gc) as shown by David Anton.
array<Color> ^Color1 = gcnew array<Color><font color="Red">(</font>3<font color="Red">)</font>;
or
array<Color> ^Color1 = gcnew array<Color>{Color::Black, Color::Brown, Color::Red};
or
array<Color> ^Color1 = {Color::Black, Color::Brown, Color::Red};
Mark
*edit* Fixed the parenthesis above
Last modified: 3hrs 18mins after originally posted --
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
I tried each of your suggestions, which should, as far as I know, do the same and work, but each caused errors:
array<color> ^Color1 = gcnew array<color>[3];
error C2726: 'gcnew' may only be used to create an object with managed type
array<color> ^Color1 = gcnew array<color>{Color::Black, Color::Brown, Color::Red};
error C3145: 'Color1' : global or static variable may not have managed type 'cli::array<type> ^'
with
[
Type=System::Drawing::Color
]
may not declare a global or static variable, or a member of a native type that refers to objects in the gc heap
error C3145: '$S9' : global or static variable may not have managed type 'cli::array<type> ^'
with
[
Type=System::Drawing::Color
]
may not declare a global or static variable, or a member of a native type that refers to objects in the gc heap
array<color> ^Color1 = {Color::Black, Color::Brown, Color::Red};
error C3145: 'Color1' : global or static variable may not have managed type 'cli::array<type> ^'
with
[
Type=System::Drawing::Color
]
may not declare a global or static variable, or a member of a native type that refers to objects in the gc heap
I really don't know why this doesn't work.
|
|
|
|
|
hehe WTH?
What version of Visual Studio are you using?? Are you compiling for clr?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Well, I'm using Visual C++ Express Edition 2008.
What do you mean with compiling for clr?
|
|
|
|
|
This is managed code, so you must use the /clr compiler switch
(Project settings/Configuration Properties/General/Common Language Runtime Support)
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|