|
|
George L. Jackson wrote: Many programmers don't advise using a message pump in a Windows Serivce
well how else can I get my objects to receive events. Will you ask 'those programmers' this for me?
BTW, I tried the application.run thingy and it still didn't seem to work.
BugReporter[^]
BlackDice
|
|
|
|
|
The Application.Run() call did work. The problem was that I was calling it in the main thread. Each object I create in its own thread, so once i put it in there, it works great!! thanks
BugReporter[^]
BlackDice
|
|
|
|
|
Hi, I am getting a strange error periodically while working on a Win Form. This error occurs irregularly for strange reason.
Following :
One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes.
The type 'myProjectName.myDataSet' has no field named 'DataSetName'.
Hide Edit
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager manager, String exceptionText, String helpLink)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)
Now When I click Edit link, I see following code in MainForm.designer.cs
// myDataSet
//
this.myDataSet.DataSetName = "myDataSet";
this.myDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
Now, When I delete these mentioned lines, I get back the form regular again. And I dont know how the mentioned code generated by designer after a while which is causing the error. Can u give me any idea please !
|
|
|
|
|
i need to create a program that will calculate the factorial of a number submitted by the user.i should use while and for loops..
|
|
|
|
|
i need back & neck massage.it should be firm yet relaxing..
(hint: We won't do your homework for you. If you need help with a specific problem, ask that and you will be given help.)
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Connor's Christmas Spectacular!
Judah Himango
|
|
|
|
|
Sounds like a homework assignment, but we're NOT doing your homework.
We are, however, willing to help you if you're stuck.
Just post some code which doesn't work and we will help you.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
iam using Visual Studio.NET 2003
int numb;
long fac = 1;
Console.WriteLine("Enter a number :");
numb = Int32.Parse(Console.ReadLine());
for ( int numb; numb >0; numb--)
{
fac*=numb--;
}
the for loop doesnt work with me, even if definef another int variable like :
int x;
for (int x=numb;x>0;x--)
|
|
|
|
|
thats almost correct.
You don't need to decrement numb inside your loop, you're already decrementing it in your for -loop declaration: for ( int numb; numb >0; numb--).
You also need a helper variable to be used in the loop, usually it's called i and will be initially set to your number:
for (int i = numb; i > 0; i--)
{
fac *= i;
}
This will also work:
for (; numb > 0; numb--)
{
fac *= numb;
}
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
it doesnt work.. i dont know why.
|
|
|
|
|
See my edit, I made a small mistake
modified 12-Sep-18 21:01pm.
|
|
|
|
|
it doesnt work Greeeg. anyway, thank u for ur cooperation.
|
|
|
|
|
Works like a charm for me. I only modified your for loop, the rest has been left untouched:
static void Main(string[] args)
{
int numb;
long fac = 1;
Console.WriteLine("Enter a number :");
numb = Int32.Parse(Console.ReadLine());
for (; numb > 0; numb--)
{
fac *= numb;
}
Console.WriteLine(fac);
Console.ReadLine();
}
-- modified at 17:23 Thursday 9th February, 2006
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Here we go .... i wrote Console.Readline(); without fac... thanx greeeg for ur patience..
|
|
|
|
|
First: here is your code:
<br />
int numb;<br />
long fac = 1;<br />
Console.WriteLine("Enter a number :");<br />
numb = Int32.Parse(Console.ReadLine());<br />
<br />
for ( int numb; numb >0; numb--)<br />
{<br />
fac*=numb--;<br />
}<br />
Now look at what you are doing. int numb; defines a new object numb that is an integer.
numb = blah sets that integer to a number entered by the user.
for (int numb; numb>0; numb--) creates a new instance of numb which (since it is not nullable) gets a new value of 0. So what does your conditional do when it encounters that 0 value? My guess is you always get an answer of 1. Why? (look at it and answer this yourself)
So now you should be able to figure it out...that you need to change your initial storage name (ie. not numb ) then set your for loop value int numb to the value you established in the Console.Read function.
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
Hi,
Isnt it possible to declare the array of the size dynamically based on user input. I know i can keep on using Array.Resize() later, but to me, it looks very inefficient that I had to declare some size number at the first time i declare the array. May be I declare it toooo high numbered size so that user will always wont think of that number, but in that case, I am wasting memory for nothintg. When I was coding in PHP or PERL, I did not have to declare size which i enjoyed but here in C#, very disappointing.
|
|
|
|
|
emran834 wrote: When I was coding in PHP or PERL, I did not have to declare size which i enjoyed but here in C#, very disappointing.
No, when you were using Perl, the inefficiency is simply hidden from you; there is no magic way to grow an array without reallocating some memory.
Now, if your array is constantly resizing, you're better off using a list, which gets resized automatically for you:
ArrayList list = new ArrayList();
List<MyObjectType> list = new List<MyObjectType>();
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Connor's Christmas Spectacular!
Judah Himango
|
|
|
|
|
Thanks Judah Himango, I got it. Although Little bit harder than those Scripting Languages
|
|
|
|
|
If it's scripting languages you're used to, many of them can be used and compiled to run on the .NET framework (making it instantly interoperable with C# components, VB.NET components, etc.) For example, Microsoft has available IronPython[^] which is Python running on the .NET framework. There is also Perl.NET[^], as well as some interesting new languages such as Nemerle[^] or Boo[^]. JScript.NET[^] is another script language by Microsoft, although it is compiled rather than interpreted.
In any case, the key in understanding scripting languages is that often times performance is sacrificed on the altar of programming ease. You can set a variable to an integer, then set it to a string no problem. That's dynamic/loose typing, which while it makes the life of the developer easier (less typing involved), it also can suffer from performance issues and type mismatch runtime errors (no type safety).
All that said, I would agree that it is too laborious to declare variable types in C#. I see that C# 3 is introducing some new syntax allowing for a more dynamic-like typing, but maintaining performance and type safety via the compiler inferring the type based on usage. For example, C# 3 will allow you to declare an array like this:
var myArray = new {1, 2, 3};
The compiler will infer you're doing an integer array, thus making it equivalent to the more laborious
int[] myArray = new int[] { 1, 2, 3 };
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Connor's Christmas Spectacular!
Judah Himango
|
|
|
|
|
Thanks. I am too much habituated to use PHP. Now looks like one day C# will turn to a Scripting type language. By the way, Is C# 3 already available for use in the present Visual C# 2005 Express IDE ? Do I need to upgrade my Framework ? i thought framework 2.0 is the latest one.
|
|
|
|
|
C# won't turn into a scripting language, however, it will certainly borrow some concepts from scripting languages.
C# 3 is available as a pre-beta demo; you can check it out as part of the Microsoft Language Intergated Query (LINQ)[^] package, which includes a pre-alpha C# 3 compiler and extensions to make Visual Studio 2005 work with it (sort of). Unlike C# 2 which, due to generics, required the CLR (.NET runtime) to be modified, C# 3 is has no such requirement and can run on .NET 2.
That said, it's not supported and definitely not ready for prime-time yet, so stick to C# 2 and Visual Studio 2005 (which are both the latest supported releases).
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Connor's Christmas Spectacular!
Judah Himango
|
|
|
|
|
If C# will adopt some scripting type functionality, I really really really hope that it will be possible to disable this feature. I would hate to see the compiler starting to make assumptions about my code, like for an example VB does.
If I declare a variable, I want to tell the compiler what data type it should have, I don't want the compiler to make a half-assed guess what data type I possibly could need. For simple taks where the data type doesn't really matter, it might be useful, but for anything more advanced it would only make it more complex. If you specify a data type, it simple. You get what you asked for. If the compiler gets to choose the data type, you will have to know the compiler criteria for choosing the data type in order to know what data type it will be, and every time you get it wrong it's a potential source for bugs.
If you think that programming is too much typing and too little mind work, you are simply not working with projects that challange your potential.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I need to trigger an event handler and pass variable from a Child form to parent form. Can you show me any easy snippet to do that pleaseeee..
EMRAN
|
|
|
|
|
Hi,
I am using Visual Studio .NET 2003 with Framework 1.1.
I downloaded and installed Framework 2.0. Now how do I direct Visual Studio to use Framework 2.0. It is still using framework 1.1.
Thanks.
|
|
|
|
|
If it is the case of Windows application, I think you should use Visual Studio 2005 Express which is built for Faremework 2.0. Visual C# Express is free to download from msdn.microsoft.com and You can convert your existing VS 2003 project to VS 2005 Project easily from that New IDE. To me, the new 2005 Express IDE is really great and way more comfortable.
EMRAN
-- modified at 17:04 Thursday 9th February, 2006
|
|
|
|