|
Flip to back of textbook and read solution to exercise 1-2.
"It was the day before today.... I remember it like it was yesterday."
-Moleman
|
|
|
|
|
They are both very easy and should be one of the first things you try out with the language. Both use loops. The first, a single loop, the second a nested loop.
Show us what you have tried up to now.
More importantly, why do you want to do this in a console application? Is it a homework questions?
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|
|
Of course its a homework question ... wtf would that do in the real world lol.
|
|
|
|
|
It's the new Microsoft o console program. Solves all sorts of real world problems - well it would if you had a problem where you needed symettrical output to a console.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
It's the new Hell-o World program
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Culture independent communication. Nice.
Flashback to 1977 and "Close encounters of the third kind"...
---
single minded; short sighted; long gone;
|
|
|
|
|
Wow...Its a really very good question !!
Keep posting
Manoj
Never Gives up
|
|
|
|
|
1.)
for (int i = 0; i < 24; ) Console.Write(i++ % 6 == 5 ? "\r\n" : "o");
2.)
for (int i = 0; i <9 ; i++) Console.WriteLine(new String('0', ++i));
---
single minded; short sighted; long gone;
|
|
|
|
|
|
Hi,
I am trying to integrate MS Word in my application as a control, can I? Actually I want to use the drawing tools and equation editor tool of MS Word in my application.
How can I do this?
Pls help me.
Thanx
|
|
|
|
|
Hi,
I recommend you another way - to integrate your app into Word, e.g. build your app over a documet-level VSTO solution or in application-level Word add-in. Unfortunately, Word as a COM object doesn't provide its tools separately (the drawing tool in your case).
|
|
|
|
|
is there any way or properties that set closed all nodes of an XML file?
thank you
|
|
|
|
|
What do you mean? In what way do you want to "close" the nodes?
Are you talking about something that is displaying an xml file?
---
single minded; short sighted; long gone;
|
|
|
|
|
yes, when an xml file displaying
|
|
|
|
|
Alt-F4?
Alt+Ctrl+Delete?
It all depends on which viewer you are using...
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|
|
i don't want to close viewer
i need all nodes are closed when an xml file open for display
when you open an xml file, it is like as below
-[root]
-[child]
[msg]text1[/msg]
-[child]
[msg]text1[/msg]
-[child]
[msg]text1[/msg]
[/root]
and what i need is below
-[root]
+[child]
+[child]
+[child]
[/root]
|
|
|
|
|
I was being sarcastic. Perhaps if you told us the viewer we could help. Also, what has this to do with C#?
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|
|
i guess there was any properties in xmldocument or other xml classes that close all nodes (maybe you called them Tag) of an xml file when it open by IE or other xml viewers
|
|
|
|
|
It's not a function of the document, it's a function of the viewer; for instance a TreeView has a CollapseAll() method.
|
|
|
|
|
at last i fund that it did by xslt file
|
|
|
|
|
Hey all,
I'm having trouble with the Asynchronous UDPClient.BeginReceive() method. I've finally gotten the (extremely poor) example in the MSDN docs working, however as soon as it receives any data the application quits, when ideally I'd want it to continue listening to the port.
To get around this, I simply call the method containing the call to BeginListen() again from the callback, but I'm having serious doubts about this as a preferred method of doing things, given that this method (and from MSDN) simply blocks in a while loop:
while (!messageReceived)
{
Thread.Sleep(100);
}
and without this "Do some work" business the application just quits again. Now this could actually be quite useful, as the reason I'm looking at this BeginReceieve stuff is so that I can terminate the listener as and when I want to, which seems a lot more tricky when using blocking port access.
So after all that rambling, is this the way it should be done, or have I hacked myself into a tight spot?
"It was the day before today.... I remember it like it was yesterday."
-Moleman
|
|
|
|
|
The example is not quite up to the normal standard for examples in MSDN (with the one letter variable names for one), but it's still adequate to show how the method is to be used.
Examples in MSDN is not on the "for dummies" level, they are just short examples to show the code in some kind of context. If you need more than that, you should buy a book about it.
martin_hughes wrote: To get around this, I simply call the method containing the call to BeginListen() again from the callback
Yes, that's what you normally would do. Alternatively, you could call the method from your main program after processing the data.
martin_hughes wrote: but I'm having serious doubts about this as a preferred method of doing things, given that this method (and from MSDN) simply blocks in a while loop
As the comment in the code says, it's just an example. Normally your program would just continue with what it's normally doing, usually just go back to the message pump and wait for something to happen.
---
single minded; short sighted; long gone;
|
|
|
|
|
Well, I still think the example is poor - and definitely not up to scratch. But thanks for the advice anyway
"It was the day before today.... I remember it like it was yesterday."
-Moleman
|
|
|
|
|
Been trying find a way to update a form ( same instance) directly from a class.My example below compiles but the form result leaves the textbox blank.
using the Form1 myform = new Form1 thing works but again leaves the form blank.
Can anyone help? I'm new to this so go easy on me.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace test1
{
public partial class Form1 : Form
{
public string strStringVarible;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
classtest1 clstest = new classtest1();
clstest.external_class();
}
public void accessor_method()
{
this.textBox1.Text = strStringVarible;
this.textBox1.Refresh();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}
________________________________________________________
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms.Design;
using System.Data;
namespace test1
{
class classtest1 : Form1
{
public void external_class()
{
this.strStringVarible = "test123";
this.accessor_method();
}
}
}
I'm new so go easy on me please
|
|
|
|
|
Hello,
What you did is:
You have a Form named "Form1" (which derives from System.Windows.Forms.Form).
Than you have a Form named "classtest" (which derives from your Form1).
Hardboiled86 wrote: private void button1_Click(object sender, EventArgs e)
{
classtest1 clstest = new classtest1();
clstest.external_class();
}
At the button Click, you instanciate a new Form (classtest1), which means that now two Forms are in memory (one that you see, and the new second one).
You call the method "external_class" from your second Form, which calls "accessor_method" also from your second Form.
So it should be clear that your first Form, which is visible will not change.
Look at this excellent Article from Colin Angus Mackay[^]
Hope it helps!
All the best,
Martin
|
|
|
|