|
Use a delegate to send an event to the parent form, or if the button closes the form, use the DialogResult property to tell you what was pressed.
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 )
|
|
|
|
|
To create a delegate and event you can solve the problem
Continue...
|
|
|
|
|
I am trying to create a windows service and I need to access a method from another project. The windows service project and the project containing the required method are in the same solution. Is it possible to do this? If so how would I go about it?
|
|
|
|
|
add reference of the proj which you want to use
Nana
|
|
|
|
|
and make sure that you have used teh appropriate access modifiers for the method..so that it can be accessible in other projects...
Ashvin Gunga
|
|
|
|
|
First u create a shared assembly.u can communicate with different application.
u try to create some interface u can solve the problem
Continue...
|
|
|
|
|
I am trying to display then data that is captured in months to be shown as years. For example if someone have been with us for 18 months, I want to display it as 1.5 years. I have attempted to do so by writing the code below but to no avail. Any assistance will be greatly appreciated.
public static int YearsFromMonths(int months)
{
int evenMonths = (months /12);
int remainingMonths =(months % 12);
decimal fractionOfYear = Convert.ToDecimal(((remainingMonths) * .0833)/10);
if((months % 12) == 0)
{
return evenMonths;
}
else
{
return fractionOfYear;
}
Thanks.
Skan
If you knew it would not compile why didn't you tell me?!?!?!
|
|
|
|
|
If you want to return a fraction, return a float.
float years = months/12.0F;
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 )
|
|
|
|
|
This may sound ignorant but what's the difference between Decimal and float? The couple of Apps I wrote in C++ I never heard of decimal. I guess this new with .Net. Also why the "F" after the number for float? .Net suck...........but I guess I have to adapt.
Skan
If you knew it would not compile why didn't you tell me?!?!?!
|
|
|
|
|
Also is it possible to round a float number to one deciaml place?
Skan
If you knew it would not compile why didn't you tell me?!?!?!
|
|
|
|
|
Hi,
If its 18 months you will show as 1.5 years. What if its 16 months or 15 months. How will that be displayed. This is for my information, so that I can work on it
Thanking you in Advance
Kind Regards
Pratik Shah
|
|
|
|
|
If its 15 months then it should display 1.25 and if its 16 months then should display 1.3 (not the on decimal place because in reality it 1.3333). I think if we take the radical vairable and multiply it by .83333 then round it off to on or two decimal place that should work.
Skan
If you knew it would not compile why didn't you tell me?!?!?!
|
|
|
|
|
This one line of code solved it all. Thanks guys.
return Decimal.Round(months/12M,1);
Skan
If you knew it would not compile why didn't you tell me?!?!?!
|
|
|
|
|
Is there a way for me to check if a string contains a specific character and replace it with another character? I tried calling the Replace() method, but it doesn't seem to work. I want to check if a string contains the hyphen character, like in "Mike-Donald" and replace it with an underscore character to make it "Mike_Donald". Any help would be appreciated.
|
|
|
|
|
Strings are immutable in the .NET Framework. Once created, they cannot be changed. How did you use the Replace method? Without seeing your code, it's impossible to tell you, with any certainty, what went wrong.
But, the Replace method returns a new string object. It can NOT modify the current string:
string newString = oldString.Replace(@"-", @"_");
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
The Replace method does work, it was my fault for not looking at the right variable. Is there some string method to check if the string contains a specific character like hyphen "-"?
|
|
|
|
|
The Contains method, I believe. If not, it's FirstIndexOf or something like that.
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 )
|
|
|
|
|
It's some days I'm trying to customize the behavior and aspect of a standard gyph on the outline of a custom control.
X-----X-----X
|...........|
X...........X
|...........|
X-----X-----X
I flagged Glyphs for clearance.
I would like to customize the 6 shapes and colors.Without using .Net 3.0.
I digged a lot in google,in all basic c# books,but nothing..
Seems a challenge,no one replies to this question...
It's so difficult because no one did it before?
Or because I'm asking something really stupid?
Please Tell me...
Frank Drebin
|
|
|
|
|
Anyone know how to create a application that can intercept output from another application? Any help is appreciated.
|
|
|
|
|
Only if they're *designed* to communicate should they be able to communicate.
|
|
|
|
|
Define "output"... Are you talking about a web page, windows form, console output, network packets, ..., ??
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
A window application. Here's the scenario, the application prints to the screen, but doesn't have the ability to scroll upwards so I dont have the ability to copy and paste. It's kind of like a console application running within a window I would like to capture all text that prints to the screen and save the text within a text file. Oh yeah, here's the link to the software that i'm talking about http://www.hssltd.com/ I hope that's specific enough.
|
|
|
|
|
There's no easy way to do this. You can't "intercept" the text as it goes to the window. It's not like a console app that has a stream that you can redirect. There's nothing to redirect in this case.
Your best shot is going to be something like sending the WM_GETTEXT message to the window handle that is show you the text. HOPEFULLY, it responds and actually sends you the text that it is displaying. There's a couple of problems with this though.
First, there is nothing that says a window that displays text has to respond to the WM_GETTEXT message. It's a crap shoot if it does or not. You just have to try it. Google for "VB.NET WM_GETTEXT" for some examples.
Second, If WM_GETTEXT works, it'll give you everything that is in its text buffer, regardless if it sent you that text before or not. You'll have to work out what data you already have versus what you don't. On top of that, you won't get any indication or event to catch when the text changes in that window. You'll have to poll for it, constantly.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
i was wondering if any one know how i can detect a color ( like red color) in a bitmap file using C++ code???
Thanks Ricky
|
|
|
|
|
You've been told before to ask your C++ questions in the correct forum[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|