Good evening. I just started working with Windows Forms and i have stumbled with a problem which i searched and couldn't find anything (maybe my research was just bad) anyways, i want to assign a number (like "1") to a button is there anyways i could do that?
[WinForms] Button Assignment
Page 1 of 15 Replies - 276 Views - Last Post: 06 December 2012 - 03:58 PM
Replies To: [WinForms] Button Assignment
#2
Re: [WinForms] Button Assignment
Posted 06 December 2012 - 03:28 PM
Do you mean setting the text on the button? Have you tried the text property?
You can find more information on the button control and the text property at these links on msdn:
http://msdn.microsof...rms.button.aspx
http://msdn.microsof...y/ms158234.aspx
clickMeButton.Text = someString
You can find more information on the button control and the text property at these links on msdn:
http://msdn.microsof...rms.button.aspx
http://msdn.microsof...y/ms158234.aspx
#3
Re: [WinForms] Button Assignment
Posted 06 December 2012 - 03:32 PM
Julyuary, on 06 December 2012 - 03:28 PM, said:
Do you mean setting the text on the button? Have you tried the text property?
You can find more information on the button control and the text property at these links on msdn:
http://msdn.microsof...rms.button.aspx
http://msdn.microsof...y/ms158234.aspx
clickMeButton.Text = someString
You can find more information on the button control and the text property at these links on msdn:
http://msdn.microsof...rms.button.aspx
http://msdn.microsof...y/ms158234.aspx
No i'm saying like i have a button named "1" and when i press it i want the value "1" to appear in a textbox. Thanks
#4
Re: [WinForms] Button Assignment
Posted 06 December 2012 - 03:41 PM
I'm guessing that you mean you have a button who's text is "1", and you want that in a text box.
The simple answer is to assign the .Text value of the button to the .Text value of the TextBox in the button's Click event.
The simple answer is to assign the .Text value of the button to the .Text value of the TextBox in the button's Click event.
#5
Re: [WinForms] Button Assignment
Posted 06 December 2012 - 03:44 PM
Do you understand that you have to make a method that handles the .Click event of the button?
Do you understand that GUI elements like buttons and textboxes have properties such as .Text that you can set and get?
My standard beginner resources post - Updated DEC 2012
You can try to learn C# by dismantling snippets and googling terms - basically you can take a hit-n-miss, shotgun approach. Or you could just follow a proper training program whether it be a couple intro books, school, on-line course or series of tutorials like the ones we offer. I'll tell you from experience that just fumbling around in the dark and trying to teach yourself with no guidance doesn't work. Its like stumbling across a Harrier Jump Jet and trying to teach yourself how to fly with no background in piloting: You simply lack any groundwork to start from. How can you lay out your own training course if you don't already know the material? Would you go to a university where the teacher says "I don't know any of this but we'll fumble through it together?"
We have a tutorials section and a learning C# series of articles.
First learn the language by working 2-5 "Learn C# in 30 days" type books cover to cover. Do a couple hundred on-line tutorial projects where you build what you're told to build, the way you are told to build it WITH AN EXPLANATION OF WHY so you can learn.
There are three routes people seem to take when learning programming.
For the life of me I can't figure out why people try 1 & 2. I strongly suggest taking the guided learning approach. Those book authors go in a certain order for a reason: They know what they're doing and they know the best order to learn the materials.
You start by learning a coding language FIRST.
Learn to plan before you type.
THEN you start designing software with a purpose.
If this sounds like you
read this section
Otherwise, you can just jump to the resources here:
Some of the tutorials below are for C# or Java not C, C++, VB.NET [...]. But the conceptual stuff of classes, object oriented design, events etc. are not language specific and should give you enough guidance in theory of program development for you to be able to look-up specific code example in your chosen coding language.
Resources, references and suggestions for new programmers. - Updated Oct 2012
Do you understand that GUI elements like buttons and textboxes have properties such as .Text that you can set and get?
My standard beginner resources post - Updated DEC 2012
You can try to learn C# by dismantling snippets and googling terms - basically you can take a hit-n-miss, shotgun approach. Or you could just follow a proper training program whether it be a couple intro books, school, on-line course or series of tutorials like the ones we offer. I'll tell you from experience that just fumbling around in the dark and trying to teach yourself with no guidance doesn't work. Its like stumbling across a Harrier Jump Jet and trying to teach yourself how to fly with no background in piloting: You simply lack any groundwork to start from. How can you lay out your own training course if you don't already know the material? Would you go to a university where the teacher says "I don't know any of this but we'll fumble through it together?"
We have a tutorials section and a learning C# series of articles.
First learn the language by working 2-5 "Learn C# in 30 days" type books cover to cover. Do a couple hundred on-line tutorial projects where you build what you're told to build, the way you are told to build it WITH AN EXPLANATION OF WHY so you can learn.
There are three routes people seem to take when learning programming.
- Just start trying to create programs
- Start taking apart other programs and try to figure out the language by reverse engineering
- Follow a guided learning course (school or self-teaching books)
For the life of me I can't figure out why people try 1 & 2. I strongly suggest taking the guided learning approach. Those book authors go in a certain order for a reason: They know what they're doing and they know the best order to learn the materials.
Quote
Where do I start?
You start by learning a coding language FIRST.
Learn to plan before you type.
THEN you start designing software with a purpose.
If this sounds like you
Newbie/Rookie said:
I have a little programming experience but I need to write ...
Spoiler
Otherwise, you can just jump to the resources here:
Some of the tutorials below are for C# or Java not C, C++, VB.NET [...]. But the conceptual stuff of classes, object oriented design, events etc. are not language specific and should give you enough guidance in theory of program development for you to be able to look-up specific code example in your chosen coding language.
Resources, references and suggestions for new programmers. - Updated Oct 2012
Spoiler
#6
Re: [WinForms] Button Assignment
Posted 06 December 2012 - 03:58 PM
Yeah i know but i am actually taking classes in school about C# and we just started with windows forms i was just trying to get some knowledge so i can start having some "fun" and trying out stuff. Thanks anyways for the stuff you provided me with 
Will try that. I'll edit if i have any problem with this solution.
Curtis Rutland, on 06 December 2012 - 03:41 PM, said:
I'm guessing that you mean you have a button who's text is "1", and you want that in a text box.
The simple answer is to assign the .Text value of the button to the .Text value of the TextBox in the button's Click event.
The simple answer is to assign the .Text value of the button to the .Text value of the TextBox in the button's Click event.
Will try that. I'll edit if i have any problem with this solution.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote






|