|
Member 9880210 wrote: beginning C# student
So read the guidelines, your title does not meet spec, you have not asked a question relating to what you have attempted, you are posting a homework question and asking for an answer. You have nit demonstrated any ability to think.
I do applaud your attempt to research the problem but your inability to define your problem is probably contributing to the extraordinary amount of time you have spent on your search!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
As you have code samples, one way for you to solve this would be to paste them into a console application and actually run them. I'll give you a hint with the second one - this loop will only run once because of the post condition test (the problem isn't a divide by zero error as you'd first expect because i is pre-incremented from before it's evaluated).
|
|
|
|
|
Pete,
That is helpful and thank you for commenting.
|
|
|
|
|
You're welcome. Good luck with progressing with coding - it does get easier, honestly.
|
|
|
|
|
Perhaps, if you tried looking at them yourself, and working out what they are doing it would be more obvious what they should be doing.
Then you wouldn't have wasted 18 hours on your homework, you would have spent thirty minutes or less and finished it...
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
Hi,
I have a C#/.Net User Control that is a viewer for particular file type.
Now i want to convert it to an ActiveX control for the internet explorer which gets loaded when we open that file type with internet explorer and the file gets opened within the control.
It is the similar feature like Adobe PDF Viewer ActiveX control. When we drag n drop a pdf file over the internet explorer, the pdf reader control is loaded and file is opened in that control.
Please help me with this.
-- modified 4-Mar-13 0:11am.
|
|
|
|
|
NevilPrajapati wrote: Please help me with this
Help with what? You did not say anything about any kind of a problem.
|
|
|
|
|
Hi,
I have described my full problem in the question. But if you are not able to see it in any way then here it is:
I have a C#/.Net User Control that is a viewer for particular file type.
Now i want to convert it to an ActiveX control for the internet explorer which gets loaded when we open that file type with internet explorer and the file gets opened within the control.
It is the similar feature like Adobe PDF Reader ActiveX control. When we drag n drop a pdf file over the internet explorer, the pdf reader control is loaded and file is opened in that control.
|
|
|
|
|
|
NevilPrajapati wrote: I have described my full problem in the question
No you did not. You just described what it is that you want to do. What you did not do is describe a problem. "i want" is not a question nor is it a description of a problem.
|
|
|
|
|
Option 1: Rewrite your .NET User Control as an ActiveX Control (requires VC++ or VB6)
Option 2 (recommended): Create a COM Callable Wrapper for your .NET Control. Read this[^] for more information. (Still needs .NET Framework to be installed in the target machine)
|
|
|
|
|
sir, I'm doing my college project in windows8 i.e speech2text.
so I want to add a calculator ,notepad or wordpad in my application.
I want detail idea how I use calculator,notepad or wordpad with my voice.
Thank's in advance.
|
|
|
|
|
Did you read "How to get an answer to your question" just above?
Take particular note of #2 and #11.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
|
Hi,
Have a look at my article about Speech Recognition, Speech to Text and Text to Speech:
Speech recognition in C#[^]
The quick red ProgramFOX jumps right over the Lazy<Dog> .
|
|
|
|
|
1. Create a new VS windows form application.
2. Add a button to it.
3. Double click the button to add the click event.
4. Add a new class to the project. Change its declaration and make it a partial class using the same name as the main form.
5. Move the button click event into the partial class.
6. Go back to the main form and double click the button so that it opens the click event in the code window.
If, like my VS (2012) you'll find it doesn't actually open the event code. In fact, like mine, you'll probably find it places the cursor where the code used to be in the main form. In other words, it doesn't jump to the code in the other source file where you created the partial class and copied the code to. It also does the same in VS2008.
If it's a bug, is there a workaround?
If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.
|
|
|
|
|
Confirmed this is the same on my machine.
I searched and found this[^] which seems to say it's not considered a bug but by design as a limitation of the Forms designer.
|
|
|
|
|
No, it's not a bug, , there is no workaround for it, and if you think about it, it does make a bit of sense.
If you double-click on a control to generate an event, the code will go into the file of the same name as the myFormName.Designer.vb file. It's the only file that it knows with 100% certainty belongs to that form.
|
|
|
|
|
Upto a point, Dave, I agree with what you write. I also look it at it the other way where it could also search through all the same partial classes to see where it might reside. But, yes, if it's a limitation by intent I can live with it.
If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.
|
|
|
|
|
The workaround.
In VS solution explorer the form.designer.cs file is shown as nested within form.cs and I suspect that the partial class that you have added is not. Fixing the project file to nest the new file will also fix the problem with the event handler methods.
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Form1.Extras.cs">
<DependentUpon>Form1.cs</DependentUpon>
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.MoreStuff.cs">
<SubType>Form</SubType>
</Compile>
In this project file fragment the entries for Form1.cs , Form1.designer.cs and Form1.MoreStuff.cs are exactly as created by VS but the entry for Form1.Extras.cs has been modified to establish the correct DependentUpon relationship to Form1.cs . Event handlers within Form1.Extras.cs will now be found by VS whereas any that were moved into Form1.MoreStuff.cs will not.
Alan.
|
|
|
|
|
Thanks for that Alan. I've not tried it yet but I'll schedule some playtime to test it tomorrow sometime.
If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.
|
|
|
|
|
Alan,
Many thanks. I just had the time to try it out and it worked 100% fine. Double-clicking the button does indeed jump to the partial form.
If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.
|
|
|
|
|
I'm trying to create a program that displays a table of all the even numbers within a range given by the user but im having some trouble making it work. the range has to be between 1 and 120. I would also like to incorporate the tryparse method. here is what I have so far:
using System;
public class Range
{
public static void Main(string[] args)
{
int[] range;
string firstNumber;
Console.Write("What is the initial number of the range: ");
firstNumber = Console.ReadLine();
Console.Write("What is the last number of the range: ");
string lastNumber;
lastNumber = Console.ReadLine();
int totalNumber;
int firstNum = Convert.ToInt32(firstNumber);
int lastNum = Convert.ToInt32(lastNumber);
if (firstNum < 1)
{
Console.WriteLine("Error: the firstNumber can't be less than 1.");
}
else if (lastNum > 120)
{
Console.WriteLine("Error: the lastNumber can't be higher than 120.");
}
else if (firstNum >= lastNum)
{
Console.WriteLine("Error: the first number can't be higher than the last number.");
}
totalNumber = lastNum - firstNum;
range = new int[totalNumber + 1];
int tally = 0;
for (int i = 0; i < totalNumber; i++)
{
range[i] = i + 1;
if (range[i] % 2 == 0)
{
Console.Write(range[i] + " ");
}
tally++;
if (tally > 10)
{
Console.WriteLine();
tally = 0;
}
}
Console.Write("\nPress any key to exit program: ");
Console.ReadKey();
}
}
|
|
|
|
|
You made an array "range" but didn't initialize its contents. It will only contain zero.
That array isn't necessary in the first place, you could just iterate over the range directly:
for (int number = firstNum; number <= lastNum; number++)
{
if (number % 2 == 0)
; print it or whatever
}
And you don't actually need that test to see if it's even, either, because you can make sure to only ever generate the even numbers:
for (int number = firstNum + (firstNum & 1); number <= lastNum; number += 2)
{
}
Of course this part: firstNum + (firstNum & 1) is something slightly special, it's rounding up to the next multiple of 2.
firstNum & 1 takes the lowest bit, which will be 1 if odd and 0 if even. Adding that back to the original number will not change it when it's even, but make it one higher if it's odd.
|
|
|
|
|
I have the following statement in a C# 2008 windows application that was converted to a console application:
finally
{
Console.ReadLine();
Environment.Exit(1);
}
<pre>
The error message that is displayed says there is not enough io memory.
Can tell show me in code and/or point me to a reference that will show me how to solve this problem?
|
|
|
|