|
Mark Salsbery wrote: Are you passing a 'System::Windows::Forms::Form' pointer to the CmyOtherClass constructor or
a pointer to an object of the type of your Form-derived class?
Ahhh, well, the constructor for the other class is like this:
CmyOtherClass::CmyOtherClass(System::Windows::Forms::Form* callingForm)
and back up in Form1, I'm passing 'this' to the constructor of the other class.
I'm inferring from your question that I should have the constructor look for a pointer to a Form1 object, but what's the syntax for that?
(And BTW, thanks for the quick reply )
_________
. | homas
|
|
|
|
|
tcompter wrote: CmyOtherClass::CmyOtherClass(System::Windows::Forms::Form* callingForm)
You'll need to change the constructor to take an object of the type being passed instead of a
'System::Windows::Forms::Form' (the base class) pointer.
Also, if you are storing the passed pointer in a CmyOtherClass member variable, you need to
change its type too.
That way the compiler will know the existence of your properties
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hey thanks a bunch for that, it worked.
_________
. | homas
|
|
|
|
|
Hi, I have an request: I need someone to create article with OpenGL. There is one, but it's very simple and many users have problems with it( me too ). Plz if You can: create a form with OpenGL rendering within and some edits witch will change rendered objects properties( size, color, rotation or something like that). I hope there will be someone who will be able to handle this request. Thanks!
|
|
|
|
|
How about posting this on the Article Requests and Ideas[^] board?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi, I'm using Visual Studio 2005 C++/CLI. I created a dialog box by adding a new windows form item. In the form designer I set the FormBorderStyle property to FIXED DIALOG, the MinimizeBox and MaximizeBox properties to false. The I add two buttons and set their captions to OK and Cancel and their respective design names to buttonOK and buttonCancel. Then I set the AcceptButton property to buttonOK and the CancelButton property to buttonCancel. When I run the app and ShowDialog() the dialog recognizes the Cancel button and the escape key and closes the dialog but the dialog does not recognize the OK button or the enter key. Do you have an idea as to why?
Thanks
Buck
|
|
|
|
|
As long as I can answer my own questions then life is good. It appears that the DialogResult property was not being set for either of my dialog boxes that was exhibiting this behavior. So it was simply a matter of selecting the OK button, then selecting its properties and setting the DialogResult property to OK. The cancel buttons DialogResult for whatever reason seems to be set to Cancel automatically.
Buck
|
|
|
|
|
Hi, I'm using Visual Studio 2005 C++/CLI. I placed a group control on my form and then added 8 radio buttons to the group. The first radio button has TabStop set to true and the rest have the tab stops set to false. When the application runs the tab order seems correct, and when I use the arraow keys to select a radio button the arrow moves from the last radio button back to the first as you would want. The question here is, I can't find any examples of C++/CLI that show how to determine which button was selected. I tried using the first radioButton->TabIndex::get() to no avail. What is the proper way to find out which of a group of radio buttons has been selected?
Thanks
Buck
|
|
|
|
|
I discovered that I can get the checked status of the radio button with radioButton->Checked::get(). So instead of using a case statement to determine the tab index (from DDX) I will use a series of if statements.
Thanks
Buck
|
|
|
|
|
hi i got a problem with sort linklist in c i confuse how to swap the number in linklist basicly i use selection sort and
"top is global variable that store unsorted linklist and i want to make it sorted" how ever icannot make it sort can u guys help me? thanks
void sortQ()
{
myQue *sq,*ft;
sq = top;
myQue *temp;
myQue *min = top;
while((sq != NULL)
{
min = sq;
ft = sq->nextQ;
while(ft != NULL)
{
if(ft->total < min->total)
min = ft;
ft = ft->nextQ;
}
//swap mode on
temp = sq;
sq->nextQ = min->nextQ;
min = temp;
sq = sq->nextQ;
}
}
|
|
|
|
|
arifliminto86 wrote: in c
Then you're in the wrong forum. Try the visual C++ forum. This one is for C++/CLI.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 tried to build an MFC dll(originally written VC++ 6.0) to VC++2005. I am getting the folloing error Error error C2065: 'abuf' : undeclared identifier.
The code is as follows:
static void
free_biobuf(abuf)
biobuf *abuf;
{
if(abuf == NULL)
return;
free(abuf) ;
}
What should i do..
Regards, Eswari
|
|
|
|
|
You have already asked this question in VC++[^] forum. Which is appropriate for this kind of question. So , continue that thread and don't cross-post.
Prasad
MS MVP - VC++
|
|
|
|
|
double GetInvestmentAmount()
{
Console::Write(L"How much money do you want to invest? ");
String^ input = Console::ReadLine();
double amount = \\ i want to convert the 'input 'into the double type
return amount;
}
how can I convert the " String ^ input" into the double type. Thanks in advance.
I've tried "safe_cast(Console::ReadLine())" and " Covert.ToDouble(*input)" but it just doesn't work ==
|
|
|
|
|
Following code works perfectly fine .
String^ input = Console::ReadLine();
double amount = Convert::ToDouble(input);
Prasad
MS MVP - VC++
|
|
|
|
|
|
Sorry I'm a real beginner in c++. I have tried the above method but it returns a lot of errors when I try to compile it. I am sure I am missing something.
Of note, I am using Win32 Application in Visual Studio 2005.
Could you please make an example with a very simple code that I can compile so that I can understand what I am doing wrong.
Thank you.
|
|
|
|
|
J_E_D_I wrote: Of note, I am using Win32 Application in Visual Studio 2005.
In this case, you can use native functions like atof .
Original code in using managed C++. You need to use /clr option, from native code to use that.
Prasad
MS MVP - VC++
|
|
|
|
|
Thank you for the advice. I have tried to do so but somehow it doesn't work.
As you can see from the code below, my intention is for the program to read a number saved in an excel file (fileExcel) with the getline function and then convert this string to number in order to perform some mathematical operations on it. With the getline function I only manage to visualize this string on the console, but it doesn't seem to be "seen" by the atof command.
Any suggestion would be very welcome!
while<br />
<br />
(! fileExcel.eof()) <br />
{<br />
<br />
getline (fileExcel, stringa);<br />
<br />
double NUMstringa = atof (stringa);<br />
<br />
cout << NUMstringa;<br />
<br />
etc...
|
|
|
|
|
J_E_D_I wrote: cout << NUMstringa;
This displays the double as a string. If it displays the correct number then it's working.
If you put a breakpoint on that line, you should be able to look at the values of stringa and
NUMstringa. Are they valid?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thanks, that was a quick reply!!
No, it doens't display the number!
cout << stringa; works fine and displays the number saved on the excel file (but unfortunately as a string)
cout << NUMstringa; doesn't display anything! It doesn't acutally compile because it shows an error.
It says:
Error 1 error C2664: 'atof' : cannot convert parameter 1 from 'std::string' to 'const char *' c:\documents and settings\edy\my documents\my programs\csv\csv\csv.cpp 46
HELP!
|
|
|
|
|
My next question was going to be - What type is "stringa"?
Try
double NUMstringa = atof (stringa.c_str());
cout << NUMstringa;
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
You are a star, thank you so much!
It works perfectly and it solved a problem that kept me stuck for days.
What does adding the ".c_str()" command to the "atof" function exactly do?
Best wishes
|
|
|
|
|
J_E_D_I wrote: What does adding the ".c_str()" command to the "atof" function exactly do?
atof() takes a const char/wchar_t * as an argument.
To quote from the "basic_string::c_str()" docs:
"Converts the contents of a string as a C-style, null-terminated string."
So c_str() converts the string to a type usable by atof().
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
J_E_D_I wrote: cout << NUMstringa; doesn't display anything! It doesn't acutally compile because it shows an error.
Nice to see , that finally, you solved your problem.
But, some advice, while using forums.
Always, be very specifice while stating the problem. If, you had mentioned this (compiler error) line initially, that would have definitely saved some posts. .
Prasad
MS MVP - VC++
|
|
|
|