|
Class C
{
}
Class A
{
Private C;
}
Class D : C
{
}
Class B : A
{
Private D;
}
It comes to this that when I have a member of type B, I have also C and also D in it. How can I override C in it?
Thanks alot for the helpers
NaNg.
|
|
|
|
|
Use virtual keyword for C.
Mazy
"This chancy chancy chancy world."
|
|
|
|
|
It sais "invalid modifier 'virtual' for C".
I'll try Explaining again...
I have these classes:
public Class C<br />
{<br />
<br />
}<br />
<br />
public abstract Class A<br />
{<br />
protected C;<br />
}<br />
<br />
public Class D : C<br />
{<br />
}<br />
<br />
public Class B : A<br />
{<br />
private D;<br />
}
When I do this: B = new B(); , I have D AND C in B.
And I need ONLY ONE, which is the newer one - D.
How can I make the Class A use the new one (D) insted of the old one?
|
|
|
|
|
Hello. I have to make a program, that is listening to keyboard, and if some combination of keys are pressed, it blocks other key.
EXAMLE - if i press "Lshift+Rshift" the F1 key is blocked.
How can i do it? How can i get the combination of 2 keys?
One nation - underground
|
|
|
|
|
Can't you log the key presses?
You can make a buffer like this:
IF( a key is down add to buffer)
IF( THAT key is released remove from buffer)
|
|
|
|
|
Hello,
If you need it for your WindowsApplication, you could use the KeyDown event of your main form (KeyPreview has to be true).
this.KeyPreview = true;
this.KeyDown += new KeyEventHandler(CheckKeys);
private void CheckKeys(object sender, KeyEventArgs e)
{
if ((e.KeyCode == Keys.F1) && (e.KeyCode == Keys.RShiftKey) && (e.KeyCode == Keys.LShiftKey))
e.Handled = true;
}
If you want to log all keybord entries of your a computer, I think no one will help you here!
All the best,
Martin
|
|
|
|
|
Did anyone installed CodeKeep plugin ? I tryed, but it doesnt seems to work. After install, i copy files to directory listed in help file, but i can't find this plugin in VS.
For people, who don't know what is CodeKeep - it is plugin, where a lot of small but usefull parts of code are kept.
One nation - underground
|
|
|
|
|
I have an object where I do 'special' cleanup in case of exception
my code is somewhat like that:
void Method()
{
try
{
Something();
}
catch
{
SpecialCleanup();
throw;
}
finally
{
NormalCleanUp();
}
}
my problem is that when an exception is thrown VS break into the catch clause and I have no idea what causes the exception.
I also tried
catch(Exception ex)
{
SpecialCleanup();
throw ex;
}
but the ex.StackTrace is reinitialized and I have no idea of the problem!
any tips on how to to be able to debug that?
for now I wrote:
#if !DEBUG
catch
{
SpecialCleanup();
throw;
}
#endif
but I would like to catch meaningful stack trace at runtime as well....
|
|
|
|
|
Is there any return statement in "SpecialCleanup()" method also am assuming that the exception could be from SpecialCleanup() method only so you are not able to figure out what was the original exception.
I would suggest that you log the stack trace as soon as the exception is raised !!! Use exception handling block and logging block provided by MS ...
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
Assuming that you are creating a windows application, change your project settings to Console application (won't change anything in your programm, only you will have console window available for debugging purposes).
Check this:
try
{
Something();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
SpecialCleanup();
}
finally
{
NormalCleanUp();
}
|
|
|
|
|
You are running in to a problem known as "breaking the stack", which is why the exception doesn't have the relevant stack trace data. You were on the right track, but need to change the code so it looks like this:
catch(Exception ex)
{
SpecialCleanup();
throw;
} The difference here is that throw ex; throws a new exception where throw; re-throws the original exception.
That being said, you really should try to avoid catching general exceptions and catch specific exceptions that you know you can recover from. What is the difference between SpecialCleanup and NormalCleanup?
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
thanks for the tip, I'll try that tomorrow!
the relevant objectis an UndoManager.
in case of exception the special cleanup remove all action, i.e. there is no any undo action anymore.
This way, if someone cath up the exception higher the hierarchy he know he would be safe from corrupted undos... (there would be nothing left to undo!)
|
|
|
|
|
Try adding $exception to the Locals window.
|
|
|
|
|
We know that XNA tool is good for develop games,
We also know that Visual Studio 2005 with DirectX9.0c SDK is another tool to do this ,It use DirectX3D's classes to build the game ,I have found that the XNA tool uses its own classes, any differents between XNA environment and DirectX SDK if only runs on PC?
|
|
|
|
|
Hi ,
I would like to know if it is possible to read a particular file from DVD present inn the DVD -Rom . The concept is the Main exe should search for all dvd-roms in the system to find this file and should call another exe if the file exists in any one of the DVD in the DVD-ROM.
I don't know how to read from DVD -ROM with C#.Any Help would be appreciated
|
|
|
|
|
hi,
i am giving xml filename as a some extra characters like &,",',@ but it is throwing error.
how can i convert these extra chratctrs to a specific format and save the filename.
pls help me
with regards
prasad
-- modified at 3:26 Thursday 12th April, 2007
|
|
|
|
|
First and foremost you it is not advisable to do so !! Can you tell me whats the exact requirement so that we can go for a proper approach !!
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
hi,
thank u for u r response..
Error i am gettign is:
"The & character,hexadecimal vale 0x26 can't be included i a filename"
I am storing some values in an XMl file and i am passing Filename as parameter of a method.
Not by SaveDialogControl.
Through code. And if I give the correct file name it is saving as a xml file.
But if i give pass extra chracters to a file name through method.
It is giving errror like.
"The & character,hexadecimal vale 0x26 can't be included i a filename"
|
|
|
|
|
That is fine but my question is why to want to store a file name with special character as most of OS doesn't allow that !!!
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
ya i got u
but i want to replace like
if & replace with "&";
if " replace with """;
pls help me
|
|
|
|
|
Hi,
Is is possible to add user defined compiler errors to CompilerError class.
My requirement is while compiling my file, using codeDomProvider,
I want to Check for the presence of Special Characters in timername. If it
is there a compilerError should be raised.
forexample,
if my file contains a line like
setTimer(timername);
and if timername contains any special characters, that should be
deducted while compiling. I want to add that error to compilerError Class
How can i do that.
Sakthi.
|
|
|
|
|
My gut feeling says that you can't code a user defined compiler errors as this means you are try modify .NET compiler which MS doesn't allow
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
I am newbie at this, please try to be patient with me. In my class at school we have been trying out various loops in problems. The instructor calls the one we've been using a "Sentinel Loop". If there is another name for it I don't know what it is.
I can get it to accept the input and also the stopping statement. I can even get the program to tell me the sales tax and shipping "on an individual input".
The instructor wants to be able to input several figures and when the stopping statement is triggered, have the program show the total shipping cost and sales tax for all of the inputs together.
I have placed the math parts between the two input statements, and also outside of the loop.
My question is: "Do I need to put the math section into a method and if so where would I place the calling statement so that it would only work after the stop statement is triggered or would something else be even more appropriate?"
I have been beating my head against the wall for the last 10 days, and have not figured out an answer. I have tried everything I can think of.
Can someone either please answer the question or at least steer me to the information on how to do this type of a problem. I would appreciate it greatly.
This is the main body of my sentinel loop program. I can get it to work fine.
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
<br />
namespace Exer4Chpt6<br />
{<br />
class Program<br />
{<br />
static void Main()<br />
{<br />
string inValue = "";<br />
double salesAmount = 0;<br />
double salesTax;<br />
double shipAmount = 0;<br />
double grdTotal;<br />
const double INTEREST_RATE = .07;<br />
double overAllTotal = 0;<br />
double totalShippingAmt = 0;<br />
double totalSalesTax = 0;<br />
<br />
Console.WriteLine("Enter as many different sales amounts ");<br />
Console.WriteLine("as you want. You will be shown the sales ");<br />
Console.WriteLine("amount, sales tax, shipping amount, and ");<br />
Console.WriteLine("the grand total. To Stop, enter");<br />
Console.WriteLine(" -99");<br />
Console.WriteLine();<br />
<br />
Console.WriteLine("Please type in a sales amount.");<br />
inValue = Console.ReadLine();
while (inValue != "-99")<br />
{<br />
salesAmount = Convert.ToDouble(inValue);<br />
salesTax = salesAmount * INTEREST_RATE;<br />
<br />
Console.WriteLine("Please type in a sales amount.");<br />
inValue = Console.ReadLine();
}<br />
}<br />
}<br />
}<br />
This is the math section of my program that I'm having the trouble with. The problem isn't in the math expressions themselves, but more in the placement to get it to do what I want.
if (salesAmount < 250.01)<br />
{<br />
shipAmount = 5.0;<br />
}<br />
else if (salesAmount < 500.01)<br />
{<br />
shipAmount = 8.0;<br />
}<br />
else if (salesAmount < 1000.01)<br />
{<br />
shipAmount = 10.0;<br />
}<br />
else if (salesAmount <= 5000.00)<br />
{<br />
shipAmount = 15.0;<br />
}<br />
else if (salesAmount > 5000.00)<br />
{<br />
shipAmount = 20.0;<br />
}<br />
else<br />
Console.WriteLine("Please type in a sales amount.");<br />
<br />
grdTotal = salesAmount + shipAmount + salesTax;<br />
overAllTotal += grdTotal;<br />
totalShippingAmt += shipAmount;<br />
totalSalesTax += salesAmount;<br />
Console.WriteLine();<br />
Console.WriteLine("Your final sales amount was: {0:C2}", grdTotal);<br />
Console.WriteLine();<br />
Console.WriteLine("Your sales tax amount was: {0:C2}", totalSalesTax);<br />
Console.WriteLine();<br />
Console.WriteLine("Your shipping amount was: {0:C2}", totalShippingAmt);<br />
Console.WriteLine();<br />
Console.WriteLine("Your total bill is: {0:C2} ", overAllTotal);<br />
Console.WriteLine();
Any help will be very greatly welcome. Thank you.
|
|
|
|
|
I was able to recheck on these type of loops and found a solution. By placing the math section after the final input I've got it to work correctly. I placed the math section in the spot shown below.
<br />
salesAmount = Convert.ToDouble(inValue);<br />
salesTax = salesAmount * INTEREST_RATE;<br />
<br />
Console.WriteLine("Please type in a sales amount.");<br />
inValue = Console.ReadLine();
}<br />
}<br />
|
|
|
|
|
Hi All,
Anybody knows why main() is called as main?
Why not someother names but Main()?
Anticipating your responses.
Thank You,
-Saran
|
|
|
|