S
sahel
hi every body;
i want a method that it works like timer .i mean i want to get a
number from user in 6 second plz help me.
i want a method that it works like timer .i mean i want to get a
number from user in 6 second plz help me.
number from user in 6 second plz help me.
Incidentally, personally I would strongly recommend that you do NOT
start with console applications. It's too hard to see what's going on.
Instead, use the visual designer, create a form, but three text boxes
and a button on it. Then code up an adding machine. Place a label on the
form, code a Fahrenheit to Celsius conversion, and update the label with
each intermediate step of the calculation. Single step through the
conversion with the debugger.
Well, I'm not convinced. Is.....
TextBox.text = "fred"
.....really any harder than this?......
Console.WriteLine("fred")
And learning how to drop a textbox on a blank form takes what - ten seconds?
Also, being honest, how many console applications get written these days?
No, I stick to my advice.
Well, that's only if you decide to post all the auto-generated form code as
well, which wouldn't normally be necessary. Otherwise it's much the same.
SteveT
Well, I'm not convinced. Is.....
TextBox.text = "fred"
.....really any harder than this?......
And learning how to drop a textbox on a blank form takes what - ten
seconds?
Also, being honest, how many console applications get written these days?
No, I stick to my advice.
And I do a lot of console applications when I quickly test something.
Because that is much easier than creating a windos form application. (But in
a project, when I want to test something quickly, I just add a quick
TestMethod and debug that ... I just do not want to close the solution I am
in or open another Visual Studio instance.)
Also, being honest, how many console applications get written these
days? No, I stick to my advice.
Well, I'm not convinced. Is.....
TextBox.text = "fred"
.....really any harder than this?......
Console.WriteLine("fred")
And learning how to drop a textbox on a blank form takes what - ten seconds?
Also, being honest, how many console applications get written these days?
No, I stick to my advice.
Well, that's only if you decide to post all the auto-generated form code as
well, which wouldn't normally be necessary. Otherwise it's much the same.
Touche! Good examples, although I do wonder how many of each are
*actually* coded in C#, rather than *could be*.
Nevertheless, you've reminded me not to make sweeping statements!
=)
I still think Sahel would be wise to try learning via Windows Forms,
too, then he can choose which approach is best for him.
Not at all. I'm always happy to change my mind in the light of a compelling
argument. In fact, I often do. On this occasion, though, my mind remains
unchanged: I found it easier to learn C# using Windows Forms, and I suggest
Sahel tries it, in case the same is true for him, too.
Fair enough, isn't it?
What? I don't understand that comment. I don't know about you, but my UI
code is separate from my "processing engine". The latter is where my work
gets done, and is the same whether I use a UI or a console. And it's the
latter where I need occasional help from forums like this.
Touche! Good examples, although I do wonder how many of each are
*actually* coded in C#, rather than *could be*.
Well, I'm not convinced. Is.....
TextBox.text = "fred"
.....really any harder than this?......
Console.WriteLine("fred")
And learning how to drop a textbox on a blank form takes what - ten
seconds?
Also, being honest, how many console applications get written these
days?
Well, that's only if you decide to post all the auto-generated form code
as well, which wouldn't normally be necessary.
Although I'm at risk of flogging this one too much, I respectfully
disagree when you are talking about learning C#. Thanks to the magic of
VS, you don't need to "understand" the UI code at all. Watch what I mean:
Create a new Windows Form project.
Drag a button and a label onto the form.
Double click the button and type:
label1.Text = "fred";
Test it.
Enhance with two text boxes and make an adding machine.
See what I mean? The bit that does the work you're interested in is the
bit you type in. The rest of it you can explore much further down the
line. You can write a reasonably complex application without ever having
to understand the auto-generated code (I've been there). Indeed, most
Windows Forms tutorials take that approach, leaving the "under the hood"
stuff until much later in the learning process.
In general I do not like the black box approach to programming.
People should learn what is happening.
And I think we have seen lots of examples of where "The bit that
does the work you're interested" is is not where the problem is.
Yes, people should EVENTUALLY learn what's happening, but I've been pretty
much agreeing with Steve throughout this discussion. After all, there's a
lot of stuff going on behind a console application as well that is a black
box to the learner.
The bottom line is that it's a cultural thing. When I went to MVP summits in
the past with the VB.NET group (I was a VB6 MVP) I remember that the VB'ers
almost as a whole complained that Microsoft sample code was always using
console apps when virtually no VB person would ever think of doing this;
they'd just start a WinForm project and drag a text box or label onto it and
write to that. On the other hand, C#'ers (what a silly word) immediately go
for the console, probably because in the beginning most of them came from C
and were not big on the GUI.
However, C# as a language has matured and a lot of the people coming into it
now are getting it as their first language, so why shouldn't we get them
started on GUIs from the outset?
Because GUI's represent a /massive/ amount of complexity, however
well abstracted or hidden away it is. Creating a GUI without any
understanding of basic data structures, events or error handling
is a recipe for disaster.
Not to mention that ten minutes in you'll likely need multiple
threads, and then you're /really/ screwed.
And all this just to force a mouse on people who would rather
keep their hands more-or-less in one place. There's a reason
keyboards have 99 other keys to work with, y'know. It's because
two (or three, or six, or whatever) isn't enough.
I don't want to harp on the VB aspect too much in a C# group, but you have
to consider that a HUGE number of people got started in programming via
Classic VB, in which it was virtually impossible to make a console app. They
were able to handle it. (And yes, insert comment here on how many bad VB
programmers there are out there. In a way, that almost bears out my view: if
a crappy programmer can get started on a GUI, it should be no problem at all
for one with talent!)
There's a very popular view that starting with VB -causes-
people to become bad programmers. This may be part of the
reason why.
But honestly, Andrew, it really isn't! I've been there: I give you my word
that in the early days I created plenty of Windows Form apps without the
slightest understanding of all the auto-generated code. By default it is
hidden from view, and truly, you just don't need to worry about it.
Certainly not as a learner.
Hang on, hang on. Who said anything about "forcing" a mouse on anyone? We
were simply talking about two different approaches to learning C#. I argued
(and still do) that it's worth trying both, and then choosing which works
for you. Some people (like me) find the GUI / textboxes / buttons approach
much easier.
Actually, we agree, there. When designing a GUI it is all to easy too
forget about people who like to drive it from the keyboard (the converse
is obviously true for console apps!)
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.