|
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++
|
|
|
|
|
Hi,
Can any one give me some information on how to optimize performance while using both managed and unmanaged C++ calls in C++ /CLI
Regards
Sabarish
|
|
|
|
|
help me to know about the some of the keywords in C language they r
REGISTER,STATIC,UNION,SIGN AND UNSIGN
pls take out some time and try to give me with examples.
|
|
|
|
|
Let’s see:
1) auto -> modifier automatic (ignore)
2) break -> break out of loop or ‘switch – case’ construct
3) case -> part of ‘switch –case’ construct
4) char -> a signed single byte (8-bits) character (normally)
5) const -> a promise that you are not going to change the value of a variable
6) continue –> goto start of loop
7) default –> default case in ‘switch – case’ construct
8) do –> start of ‘do-while loop’ construct
9) double –> double precision numeric value
10) else –> ‘if – then – else’ construct
11) enum -> a grouping of int sized named constants
12) extern -> declaration of a named item is in external file (normally ignored)
13) for -> start of for loop ( for( i=0; i<n; ++i)="" do="" something="" )
14)="" goto="" -=""> goto named label (rarely used and only if absolutely required)
15) if -> test if true ( if( f != 0 ) do something )
16) int -> whole numeric value (no decimal point) (size of machine word in theory)
17) long -> whole numeric value (size ?)
18) register -> suggestion to compiler to place variable in register (normally ignored)
19) return -> return variable to calling function
20) short -> 16-bit integer (int) variable
21) signed -> (modifier) sign matters +/- (ignored, because it is default behavior)
22) sizeof -> size of variable (in C++ size of object, which is not the same thing)
23) static -> life time (exist in permanent memory)
24) struct -> a grouping of values or a record.
25) switch -> start of ‘switch – case’ construct
26) typedef -> method for giving a user defined type a name
27) union -> method of combining types (rarely used)
28) unsigned -> (modifier) all values are positive ( unsigned int )
29) void -> no return value, or no argument
30) volatile -> you can change value any time (stupid – ignore – default behavior)
31) while -> start of ‘while loop’, end of ‘do while loop’
Hmmm! I think that is all but I thought there where 32 keywords. Any way there are still 14 preprocessor keywords.
Oh – by the way, the keywords are case sensitive.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
thanks a lot for responding for my queries.
regards
rani
|
|
|
|
|
Remember to keep in mind that some keywords act differently in C++.
<br />
char temp[10]; <br />
<br />
sizeof(temp) -> is size of pointer in C – currently that is 4 bytes<br />
sizeof(temp) -> is size of object in C++ - which is 10 characters<br />
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|