Who Can Help Me ??

This is a discussion on Who Can Help Me ?? within the C# Programming forums, part of the General Programming Boards category; I'm a vietnamese.My English is rather poor . I'm have been learning C# for 3 months. I wana make a ...

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    8

    Who Can Help Me ??

    I'm a vietnamese.My English is rather poor .
    I'm have been learning C# for 3 months.
    I wana make a calculator by windows Form Application.
    Could anyone give me code about this ? (step by step)
    for exmaple:
    - The first of all : you add .....?
    - the secondly : you .......?
    - ....Write a plus method .... etc.

    I wish I could write English like everybody .
    thanks ....... (a newbie programer in Viet Nam . )

  2. #2
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    If you're a newbie programmer then you should be studying tutorials and related articles about the language and trying to write as much of it as you can yourself.

    Last time I checked, we don't throw out code around here. Well some of us do, but we take them out the back, spank them and tell them they've been very naughty. They tend not to do it again afterwards.

    Your English is fine by the way.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  3. #3
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,109
    Since you have been learning C# for 3 months, start small, write a console application that displays a menu, let the user choose from the menu.

    For instance:
    Code:
    1. Addition
    ....
    When the user enters 1 you ask for the arguments, after that pump them into a function and display the result.

    Best approach is to make a class which has a private field that contains the current value and all the calculation functions. ( current value, because just like in windows calculator if you do: 2+3=5 if you then do +5 , it displays 10).

    Also state which IDE you are using , Visual Studio is the perfect tool for creating GUI's very fast. But then again it costs alot of money , and for some reason when microsoft does this action of giving out free copies of Visual Studio they only ship within the US .

  4. #4
    Registered User
    Join Date
    May 2006
    Posts
    8
    Thanks ahluka ,gianglylamb ....
    I hope you will guide me more C# ......
    Last edited by minh; 06-23-2006 at 04:41 AM.

  5. #5
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,109
    No problem, whenever you have a problem, just post what you have tried so far and the code you have so far.

    It's not that we are lazy ( thats probably an understatement ), but we see alot of people here that just ask for code of a whole program or function without even showing they tried it on their own ( and most of the times those are people who have some assignment for school - homework, test or whatever ).

  6. #6
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Echo GanglyLamb.
    We'll help you as much as we can as long as you show some evidence of having at least tried to solve the problem yourself.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  7. #7
    Registered User
    Join Date
    May 2006
    Posts
    8
    I'm a Vietnamese . My English is rather poor . Don't be sad , please .....

    Here is example Code :
    Code:
    //---------------------------------------------------------------------
    using System;
    using System.Windows.Forms;
    using System.Drawing;
    Class Example :Form 
    {
    private TextBox  txtBox1;
    public Example()
    {
    this.InitializeComponent();
    }
    private void InitializeComponent()
    {
    txtBox1 = new TextBox ; 
    txtBox1.Location = new Point (20,10);
    this.Controls.Add(txtBox1)
    }
    }
    static int Main()
    {
    Application.Run(new Example());
    }
    //-------------------------------------------------------------------------
    I have a trouble with Textbox ...I wanna add more TextBox .
    e.g :txtbox2 ....Location(20,20);
    txtbox3 ....Location(20,30);
    I don't wanna write more new operator . I think It need to work with array .
    for Example : TextBox[] txtBox = new textBox[5];
    Could anypne explain to me about this ?
    How I can work with TextBox array ?
    thanks for any anwer .I don't have many experinces.
    [Maybe , I have some misspell ].

  8. #8
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,109
    Code:
    	public partial class Form1 : Form {
    
    		private TextBox[] txtBoxAr;
    
    		public Form1() {
    			InitializeComponent();
    			this.initTxtBox(ref this.txtBoxAr,5,10,10,10,0,20,100);
    		}
    
    		private void initTxtBox(ref TextBox[] txtBoxAr, int amount, int startx, int starty, int xspacing, int yspacing,int height,int width) {
    			txtBoxAr = new TextBox[amount];
    			int xoffset = width+xspacing;
    			int yoffset = height+yspacing;
    			for (int i = 0; i < amount; i++) {
    				txtBoxAr[i] = new TextBox();
    				txtBoxAr[i].Location = new System.Drawing.Point(startx+(i*xoffset), starty+ yoffset);
    				txtBoxAr[i].Name = "txtBoxAr"+i;
    				txtBoxAr[i].Size = new System.Drawing.Size(width, height);
    				this.Controls.Add(txtBoxAr[i]);
    			}
    		}
    	}
    Next time you post code , try and have a nice indentation it makes it easier to read and understand .

    This works perfect for a horizontal row of textboxes, you can still tweak the function a bit so you can really create any shape with textboxes as you wish.

  9. #9
    Registered User
    Join Date
    May 2006
    Posts
    8
    Thanks GanglyLamb .
    I try with your suggestion .
    If you on line , please contact me with Y!M Mr_ha_HCM .
    I online 24/24 . I want to chat with you to learn more English .

  10. #10
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,109
    One of my personal policies is I dont start chatting with any one from a board ... unless I know them in real life ... call me a psycho or whatever but thats me .

    As long as it comes down to coding we all speak the same language . Wether someone from japan or from Tunesia starts coding, as long as we code in the same language we will understand each other fairly well. ( unless it comes to explaining some kind of difficult algo. )

  11. #11
    Registered User
    Join Date
    May 2006
    Posts
    8
    Hi everybody in this forum ???? I have a question a bout C# .

    ..When I press any character on my keyboard , I want a Control to add in my Form . Could everybody tell me How can I do ?
    [ Maybe, I take some misspell]

  12. #12
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,109
    Code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    
    namespace GUITestC {
    	public partial class Form1 : Form {
    
    		private TextBox[] txtBoxAr;
    
    		public Form1() {
    			InitializeComponent();
    			
    		}
    
    		private void initTxtBox(ref TextBox[] txtBoxAr, int amount, int startx, int starty, int xspacing, int yspacing,int height,int width) {
    			txtBoxAr = new TextBox[amount];
    			int xoffset = width+xspacing;
    			int yoffset = height+yspacing;
    			for (int i = 0; i < amount; i++) {
    				txtBoxAr[i] = new TextBox();
    				txtBoxAr[i].Location = new System.Drawing.Point(startx+(i*xoffset), starty+ yoffset);
    				txtBoxAr[i].Name = "txtBoxAr"+i;
    				txtBoxAr[i].Size = new System.Drawing.Size(width, height);
    				this.Controls.Add(txtBoxAr);
    			}
    		}
    
    		private void Form1_KeyDown(object sender, KeyEventArgs e) {
    			this.initTxtBox(ref this.txtBoxAr, 5, 10, 10, 10, 0, 20, 100);
    		}
    	}
    }
    


    Code:
    this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
    note: this
    is the form ( got it from the form class )

    => Use eventHandlers, in this case an eventhandler for the form , that will fire up as soon as a key is pressed.

    And please, if you have anymore questions not related to each other then post them in different threads. Else it will get too messy when someone is looking for something, or even trying to respond to your question.

    :edit:
    this.Form1_KeyDown instead of that garbage that shows up, also I dont have a clue why some of the code is in italics :s. ( probably because I use [ i ] somewhere and then had an initial .. )
    Last edited by GanglyLamb; 06-26-2006 at 02:11 AM.

  13. #13
    Registered User
    Join Date
    May 2006
    Posts
    8
    I did it . Thanks . (maybe,wrong topic) Sorry Mod and Admin .
    by the way , Everybody can help me ?
    I wanna download some video files from :http://www.learnvisualstudio.net but I can't
    Could Anyone give me some solutions to download it .
    Thanks for any answers . [I hope everybody will understant it]
    I very very need it for my study . Thanks

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21