Try this: What^ W = safe_cast<What^> (myObj);
sarah_malik
Posts
-
Reflection how to cast to loaded type -
Setup and DeploymentThank you. I managed to do it.
-
Setup and DeploymentHi, I have finished my project and created a setup project for it successfully. My problem is that my application uses SQL server 2005 Express Edition and I couldn't find out how can I attach a file to create the database and tables in the user machine while the installation is running. Can anybody guide me through this? P.S: I have added the SQL server to the prerequisites. thanks,
-
About helpThank you.
-
About helpyes
-
About helpHi, I have a menu on my application that contains a HELP toolstrip, I've finished doing the help project using the HTML workshop. Now how can I link this toolstrip to the Help.chm file? thanks in advance,
-
Import a class formdodoxor wrote:
I want to use it and its components(like a button control or a textlabel) in Myclass. For example i want that func() of myclass can modify a textlabel of camlive.h.
The buttons and labels, generally all controls, are private members by default. Change it to public.
dodoxor wrote:
When i try to make a new object of class Camlive( Camlive^ cml in Myclass, it returns a compile error. How can i do?
Camlive^ cml = gcnew Camlive(); cml->ShowDialog();
P.S: you should include the Camlive.h header at the top of your class.#include "Camlive.h"
-
drawing algorithmsTHANK YOU.:rose:
-
drawing algorithmsThanks for your help, it was very useful. I was wondering if there are more available algorithms that would draw shapes other than polar. like these beautiful ones: http://www.flickr.com/photos/fire_brace/48702455/in/set-72057594133787168/[^] http://www.flickr.com/photos/fire_brace/48723545/in/set-72057594133787168/[^] I know these are mosaics, but I just need algorithms that would draw such things.
-
drawing algorithmsthanks El Corazon, I don't need any specific shape, for example:
for( int i=0 ; i<200 ; ++i) { theta = 2+Math::PI*float(i)/10; r = Math::Sqrt(theta); x=r*Math::Cos(theta)+400; y=r*Math::Sin(theta)+400; }
this algorithm will give me a very beautiful shape. I need more algorithms that would to the same. -
drawing algorithmsHi, where can I find algorithms for drawing different shapes, I found some to draw spiral and circle, but I need to have more shapes. Can you please recommend any website(s) that helps? thanks,
-
C++ CodingAre you using C++ or C++/CLI? and please be more specific in your question. show us what have you done so far and what problems did you encounter to be able to help you.
-
about voidyou should be more specific. Generally, void is used in functions. 1)If the function does not return any value,ex:
void Print_Numbers (int i) { for (i;i<100;i++) cout< When you call the above function, you should send an integer parameter,say n, and the function will print the values from n to 1000. No return type is needed, that is, void will be set as a return value. 2)You can have the parameter also to be void instead of (i). In this case you should initialize the variable i inside the function. I hope this is what are you looking for,
-
Previous FormIn Form2, call
Form1->Show();
do the same with Form3. P.S: you are in the wrong forum. your question should be asked in the Windows Forms forum. -
Parent and child formsCompMan44 wrote:
I would take this to mean that AutoScroll only applies to controls owned by the form, not MDI children.
I think you are right, thanks CompMan44:)
-
progress bar on MDICompMan44 wrote:
First, why not have the child form itself update the progress bar?
Because I don't know how to access a control (progress bar in my case) that is located on a parent form FROM a child one. The progress bar must be in the parent form because the loop that I'm using is in the (onload event) of the child form. So the whole idea of this progress bar is to indicate how long the child form will take to be completely load.
-
progress bar on MDIHi, I have a progress bar in my MDI application in the parent form and I want it to perform step when a condition that depends on a loop variable in the child form is satisfied. What is the simplist way to do that? In my child form:
for (i =0 ; i<NUM ; i++) //do something
I have tried to check at regular intervals if the conditions is satisfied or not using a timer in the parent form:if ( (child->i%1000) == 0 ) this->progressbar->PerformStep();
the problem here is that the steps are all performed at once when the loop is finished! any ideas? thanks, -
Null Reference Exception in C#.NETI encountered the same one when I forgot to allocate the memory to a variable. if you are using an object from a class do not forget the new(); or gcnew(); keyword.
-
Long operation [modified]pbraun wrote:
it seems that it would be better to send one query to the DB that retrieves all of the necessary data from the DB, then do the processing (in your case, calculations).
I'm afraid that it is not possible in my case, my condition is already complex enough at each loop :((, also it depends on some data outside the loop ...
pbraun wrote:
the constant queries to the DB is costing you the time
Yes, the queries are costing much of the time! I would like to ask also does the .NET framework do anything behind the scene when a long operation is in run? I have encountered a warning when "another" long operation was running:
The CLR has been unable to transition from COM context 0x1a2008 to COM context 0x1a2178 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.
Thanks for your help Phil, I really appreciate it :-D -
Long operation [modified]pbraun wrote:
Does the DB really need to be accessed each time through the loop?
Yes, it does. It accesses the DB seeking for some different info each time. About doing all the DB access at once, I can see what do u mean, but does it really make a difference? I can split the loop into 2 loops(with the same lenght). the first one is to access the DB and the other to do the calculations.
pbraun wrote:
Do the calculations and store them in a manner that is efficient for later DB access once the calculations have been finished
Actually, my calculations depends on the values retrieved from the DB, that is, I have to access the DB first, get some values, do calculations, have result and then next loop. Also, the data in DB is never affected. This process only retrieves records. I can simplfy the process as following:
for (int i=0; i<NUM ; ++i){ "SELECT * FROM TABLE WHERE CONDITION"; // condition differs at each loop[i] while (reader->Read()){ //reader->GetValue; //do calculation depending on (GetValue) } reader->>Close(); }