|
Hi Buck,
you're welcome.
The place holder pattern (if you want to call it that) is what is needed
by "for each"; it is rather similar to the input parameters in a method.
Some remarks:
1.
for each requires each element in the collection to be of the indicated type,
it does not act like a filter (that's why my second example needed the more
general Control type, followed by a more specific type check).
2.
you can use the place holder only as a read-only variable; you can't assign
a new value to it inside the for each loop.
3.
There are some surprising uses for foreach; example:
In C# you can do foreach(char c in myString); probably that works in C++ too.
4.
Sometimes you will prefer a regular for loop over for each, since that offers
an index, which may come in handy.
And one comment: if this is new to you, I suggest you get a book on managed C++,
and work your way through it. for each is one fundamental tool, if you're
unfamiliar with it, I trust there will be more you really should know.
Good luck with the CheckBoxes and everything!
|
|
|
|
|
i have used a text box in my dialog box in WIN32 programming....now i want that the data entered by user can be copied to a text file on pressing ok. what method can i use for this??
-- modified at 5:29 Thursday 2nd August, 2007
|
|
|
|
|
*sigh*
Again, you're still in the wrong forum. If you're writing Win32 code, you're making two horrible mistakes
1 - using Win32 code. Why would you ?
2 - asking in the C++/CLI forum, when you're using the oldest form of writing a dialog in C++ there is. This belongs in the Visual C++ forum.
GetWindowText is how you get the text out of a textbox.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi, I am using Visual Studio C++/CLI. I am now playing around with the System::Drawing::Font class and I have seen Microsoft examples that use Dispose() but when I try to invoke the System::Drawing::Font::Dispose() function the compiler gives me an "error C2039: 'Dispose' : is not a member of 'System::Drawing::Font'". Does anyone know why this happens? The intellisense shows that the Dispose() method is a member of the Font class (as well as the Microsoft docs).
Thanks
Buck
|
|
|
|
|
Dispose() is a function inherited from the IDisposable interface. Its meant to implement the "Dispose pattern" to enable some form of immediate destructors in managed code. In C# you can call Dispose() on objects that will perform some clean up functions (like closing streams and such). In C++/CLI Dispose() is mapped to the class destructor by the compiler. You can't explicitly invoke Dispose() (nor write one). Instead, if an object encapsulating a resource needs some clean up done immediately (rather than waiting for the garbage collector) call either a Close() type function (which itself should only call the destructor I believe) or use delete (or declare the variable with stack semantics and have the destructor called automatically when the variable goes out of scope).
|
|
|
|
|
|
This bit me a bit when I recently migrated to VS 2005.
Here's an article that may help (even though the article is about porting to 2005, it contains relevant info about destructors and Dispose):
Changes in Destructor Semantics[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
|
please reply to my question atleast
|
|
|
|
|
What question? Forum rules say post your question and wait for an answer. Posting another message about it is considered rude.
_____________________________________________
Flea Market! It's just like...it's just like...A MINI-MALL!
|
|
|
|
|
dona jain wrote: tell me the steps which should be followed to create a simple dialog box in Win32 programming using API.
Step 1: Post your question on the correct board. This is a good start since it puts your
question in the place where the correct persons that can help you will see it.
Step 2: Do a little research. Everything you need to know to create a working dialog is at the
core of Windows UI programming.
Windowing[^]
Dialog Boxes[^]
Step 3: If you run into a specific problem, return here and ask for help (on the correct message board, of course).
Bonus Step: Have a little respect for the people who give their time FOR FREE to help others on this site.
Try waiting a little longer than 1-2 hours for a reply. We are not all from India.
Good luck,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
dona jain wrote: please reply to my question atleast
poor kid
|
|
|
|
|
Hello friends,
I’m going to develop some application using C++, Linux platform. I need information about mathematics libraries which have following features –
1) Matrix manipulation –
a) It should support Matrix multiplication, Inverse, Transpose, etc functionality on large data set say 1 million rows and columns.
b) Finding Min or Max element by row or column.
2) Providing sort function which would sort matrix.
3) Algorithm used for sorting of matrix is most important because as per my knowledge Heap sort gives the best performance over larger dataset.
4) Any functionality to sort a data set which accepts a row / column from a matrix. i.e. Sorting function receives row / column of a matrix as parameter & returns sorted set of elements or sorted set of indices of that matrix.
Thnx & regards,
Shashikant
|
|
|
|
|
Shashi.Shinde wrote: Linux platform.
I'm guessing you're not using C++/CLI then. Try the Visual C++ forum.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Look for Numerical Recipies !
There you can find many algorithm, and the C function implementation.
Russell
|
|
|
|
|
Hi ,
Can anybody tell me how to Copy a WinForm from One project to another in VC++ 2005?
I tried including all files(.h, .resx, .cpp) but it gets included like source files. I dont get a designer view option for Form.h.
Any help/url is highly appreciated.
Thanks a lot!
art
|
|
|
|
|
tell me the steps which should be followed to create a simple dialog box in Win32 programming using API..i m trying to make a single and simple dialog window..please help me out...
-- modified at 8:57 Wednesday 1st August, 2007
|
|
|
|
|
Yesterday, you said C++ .NET, and I suggested that you needed to work out if you meant .NET, or if you wanted to use MFC or Win32. I also said C# is a better language than C++/CLI for Winforms ( forms with .NET ). So, now you're in the C++/CLI forum, and you're saying Win32. I'm sorry, but this question is in the wrong forum, yesterday you said .NET in the Visual C++ forum, and today you say 'Win32' in the C++/CLI forum. I recommend doing some reading to make sure you get your terminology right.
Programming Windows by Charles Petzold is THE book on Win32 programming, although I cannot imagine why anyone would want to use Win32 today. MFC is a far better option.
If you're using the C++ Express Edition, MFC is not an option, which may be why you're asking about Win32. Really, it's a bad idea. Learn C# instead, Win32 is too much like hard work, and Winforms is better supported in C#. You already found out how few people read this forum, compared to the other ones.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I would create a table who every cas was : array < String ^, 2 > ^ tab=gcnew array < String ^, 2 > (20, 200);
i try for array < String ^, 3 > ^ tab=gcnew array < String ^, 3 > (20, 200);, i can't make : tab[1][2]= subItems when array<string^>^ subItems=gcnew array<string^>(16);
Thank you verry mutch
|
|
|
|
|
I don't understand what you're trying to do, but I see right away that you're trying to create a 3 dimension array
with only two arguments in the constructor.
What happened to our previous thread? I thought you needed an array of arrays...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
they are always an exception, how i can add in table of arrays, i do : tab[i][j]=Subitem;
Thank you verry mutch
|
|
|
|
|
tab needs to be defined to hold the type that subitem is. You didn't show what subitem is in your first post.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
the definition of subItem was array^ subItems=gcnew array(16);,
|
|
|
|
|
That's not valid. Your arrays need to have a type.
What do you want to do?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|