• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 532
  • Last Modified:

C sharp / C# - simple code using a TextBox and 5 OutputBoxes

Hi everyone,

I am learning C sharp / C# and I am trying to do something very simple.  Here is the scenario:

1.  I have an input box, (TextBox1), an 'Enter' button, and five output boxes (OutputBox1 through OutputBox5)
2.  I want the user to enter '12345' into TextBox1 and click 'Enter'
3.  The result should split the text into the five output boxes as follows:
OutputBox1 = 1
OutputBox2 = 2
OutputBox3 = 3
OutputBox4 = 4
OutputBox5 = 5

This is simple- any help is appreciated.

-Mike
0
morciani
Asked:
morciani
3 Solutions
 
Bob LearnedCommented:
What have you tried, and how may I help you get where you need to be, without writing the code for you?
0
 
CSecurityCommented:
I'm not going to help you in pure code but these lines of code can help you:
string str;
str = "ABCDEFG";
MessageBox.Show(str.Substring(0, 1).ToString());

and you should code it yourself...
regards...
0
 
angus_young_acdcCommented:
There are several options you can take.  Each depending on what your actual requirements are, to help you get started I will give you some idea of what you could do.  

If your string is going to be constant (i.e. the user isn't going to change from 1,2,3,4,5) then you could create a switch case whereby if a character is equal to X, then TextBoxY is assigned value X.  Similar methods can be done via an if statement.  However both of these methods require you to split the string into characters, they would also mean hard-coding values which is never great.  
0
 
morcianiAuthor Commented:
Thanks for the help- I figured this one one after a little digging.  I apologize- I may have posted my question in a rush....
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now