The Basics of Programming

For a program to be really useful, it has to be able to take input from a user and output the results. Some input can be from a keyboard or mouse and output sent to the screen.

A) Input

When in putting data, you can enter information via various means through controls on a Windows Form or a Web interface:

  1. Text Box - Simple text entry box for entering free form information.
  2. Rich Text Box - Useful for mutli-line text and use different fonts and typefaces and styles.
  3. Combo Box - A combination box where you make a selection or enter your own information.
  4. List Box - Choose from a selection of values to input.
  5. Radio - Make a selection of choices from mutual-exclusive options.
  6. Check Box - Make a selection from one or more options.
  7. DateTime Picker - Select a date and time from a Date time box.
  8. Month Calendar - Select a date from a calendar.

If nt using a interface and want to prompt for some input, you can use the InputBox function, this uses the VisualBasic class functions as C# has none of its own.
e.g.
string inputStr = Microsoft.VisualBasic.Interaction.InputBox("Enter name:");

b) Output

If using a graphical front end, then the output will be via Labels or Text Boxes, where you can display text or numbers. You can also output information on other more elaborate controls:

  1. Label - Ideal for placing a single line of text.
  2. Text box - a read only text box can be used instead of labels.
  3. Rich Text Box - For output of multi-line text with formatting.
  4. Date Time Picker - Display date and time in a readable format.
  5. Month Calender - Display date month an dyear in a readable format.
  6. Chart - Display a range of values in a chart format.
  7. Picture - Display graphics, photographs, etc.
  8. DataGridView - Display data in tabular format.
  9. DataSet - Display data from memory.
  10. Tree View - Display hierarchical information in a tree format.
  11. WebBrowser - Display a web page.

If writing a command line program, you can use the Console.Writeline(expression) routine to write data to the output console. Use the ToString() function to convert other variables types to string before outputting them.
For debugging, you can include System.Diagnostics, and use the Debug.Writeline(expression) routine to output information while debugging your code.

Go to C# Windows