-
What are the min lines need for program?
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
-
What lines generate random numbers from 1 to 4?
- Random randGen = new Random();
- r1 = randGen.Next(4) + 1;
-
What lines are needed to create forms?
- using System.Drawing;
- using System.Windows.Forms;
-
How do you write to console?
Console.WriteLine("The random numbers are:{0}, {1}, {2}.", r1, r2, r3);
-
How to receive input from keyboard?
input1 = Console.ReadLine();
-
How do you convert from a string to an int?
g1 = Convert.ToInt32(input1);
-
How do you create and add to a list?
List<Int32> numbers = new List<Int32>(); numbers.Add(r1);
-
try-catch structure?
- }
- catch(Exception e)
- {
- cw (e.Message)
- }
-
basic input structure
- valid = false;
- while (valid == false)
- {
- prompt and input data
- try
- {
- to convert data
- if data "in range"
- valid = true
- }
- catch
- {
- }
-
What are keywords?
abstract as base bool break byte casecatch char checked class const continue decimaldefault delegate do double else enum eventexplicit extern false finally fixed float forforeach goto if implicit in in (generic modifier) intinterface internal is lock long namespace newnull object operator out out (generic modifier) override paramsprivate protected public readonly ref return sbytesealed short sizeof stackalloc static string structswitch this throw true try typeof uintulong unchecked unsafe ushort using virtual voidvolatile whileadd alias ascending descending dynamic from getglobal group into join let orderby partial (type)partial(method) remove select set
-
How do you know if list contains an item?How do you remove items from a list?
- numbers.Contains(g1)
- numbers.Remove(g1);
-
namespace is a ...
namespace is a collection of generally related classes
-
class has:
- -data/properties
- on assignment- related to static
- -methods / function
- on assignment we had a main and 2 event handleing functions
-
What must be added to references in VS?
- System.Drawing
- System.Windows.Form
-
form load header
private void Form1_Load(object sender, EventArgs e)
-
How do you create the string list called shortList?
List shortList = new List()
-
How do you add word to shortList?
shortList.Add("word");
-
How do you clear shortList?
shortList.Clear();
-
How do you remove word from shortList?
shortList.Remove("word");
-
How do you know if shortList contains r?
shortList.Contains(r)
-
How do you create an array?
string[] countryPathsArray
-
How do you determine the number of elements in an array?
numCountries = countryPathsArray.Count();
-
How do you split a string?
- string[] tempArray = countryPath.Split('\\');
- tempArray is an array of strings.
-
How do you access the rth index of a string or array?
answerCountryPath = countryPathsArray[r];
-
How do you add text to a radio button?
rb1.Text = shortNameList[0];
-
How to you add text to a textBox?
tbAnswer.Text = answerCountryName;
-
How do you add an image to a picture box?
pictureBox1.Image = Image.FromFile(answerPath);
-
How do you add a message box?
MessageBox.Show("Correct");
-
How do you know if a radioButton is checked?
rb1.Checked==true
-
How do you set a radiobutton to unchecked?
rb1.Checked = false;
-
What is the code for radiobutton Mouse Enter?
- private void rb_MouseEnter(object sender, EventArgs e)
- {
- RadioButton rb = (RadioButton)sender;
- rb.BackColor = Color.Aqua;
- }
-
What is the code for radiobutton Mouse Leave?
- private void rb1_MouseLeave(object sender, EventArgs e)
- {
- RadioButton rb = (RadioButton)sender;
- rb.BackColor = Color.Empty;
- }
-
What is the foreach structure?
foreach (string continentPath in ContinentPathList)
-
radio button code?
- private void rb1_CheckedChanged(object sender, EventArgs e)
- {
- RadioButton rb = (RadioButton)sender;
- if (rb.Checked == true)
- {
- if (rb.Text == answerName)
- {
- score++;
- MessageBox.Show("Correct");
- }
- rb.Checked = false;
-
The value of a comboBox is a...?
string
-
value of a group of radio buttons...
checked property: 1 true and remainder false
-
Basic Properties of Controls
Size, Location, BackColor, ForeColor, Text, Name, Font, checked, enabled, ReadOnly, AutoSize, Visible
-
Event types:
Mouse Hover, Mouse Enter, Mouse Leave, Click, checked_Changed, Load, textChanged
-
Event Handler header
public void rb1_CheckedChanged(object sender, EventArgs e)
-
What does the right side of the follow do: RadioButton rb = (RadioButton)sender;
casts sender to a Radiobutton
-
How do you declare list of strings called words?
List words;
-
A list of strings called words has been declared. How do you instantiate words?
word = new List
-
What List methods?
Add, Remove, Contains, Clear, Concat
-
What is a list property?
Count
-
string[] words; words =new string[10]; string sentence = "Hello World"; words = sentence.Split(' '); What is the size words?
2("Hello" and "World")
-
What are basic controls?
textBox, combobos, radiobuttons, button
-
How to share an event handler among multiple controls?
Properties->Events->CheckedChanged-select from list
|
|