C# C#
Please leave commentary next to the code explaining what it does/
a WPF program that is still missing a file called Course.cs that defines a C# class called Course. Instances of the Course class are created and manipulated in the code behind of the WPF MainWindow window to allow the user to select courses of study and then update a list of selected courses.method that overrides the ToString() in order to be able to be displayed in a WPF window This method should be declared exactly as given below and then you should add your code to the body of the method to return the name field:
public override string ToString() { // this method should return the name field }
This is the code being used in the main window
This is what the output should look like.
C# Please remember to put commentary next to the lines of code explaining what it does
----------------------I used Visual studio 2013, C# language, WPF Application-----------
------OUTPUT-----
-------CODE-------
-------------Course.cs-------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WpfApplication
{
class Course
{
//Create a property called courseName to set and get course
name
public string courseName { set; get; }
//Used ToString() method to get courseName
public override string ToString()
{
return this.courseName;
}
}
}
--------MainWindow.xaml--------
<Window x:Class="WpfApplication.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525"
Loaded="Window_Loaded">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="62*"/>
<ColumnDefinition Width="301*"/>
<ColumnDefinition Width="154*"/>
</Grid.ColumnDefinitions>
<Label Content="Please select a course" FontWeight="Bold"
HorizontalAlignment="Left" Margin="80.924,73,0,0"
VerticalAlignment="Top" Height="31.97" Width="145.463"
Grid.Column="1"/>
<ComboBox x:Name="cbFirst" HorizontalAlignment="Left"
Margin="80.924,104.97,0,0" VerticalAlignment="Top" Width="146.866"
Height="27" Grid.Column="1" SelectedIndex="0"/>
<Button Content="Select this course" HorizontalAlignment="Left"
Margin="277.94,104.97,0,0" VerticalAlignment="Top" Width="142.164"
Height="22.985" Grid.Column="1" Grid.ColumnSpan="2"
Click="Button_Click"/>
<Label Content="You have selected these course"
FontWeight="Bold" HorizontalAlignment="Left"
Margin="83.73,183.791,0,0" VerticalAlignment="Top" Height="31.97"
Width="199.194" Grid.Column="1"/>
<ListBox x:Name="LBsecond" Grid.Column="1"
HorizontalAlignment="Left" Height="62.686"
Margin="83.73,215.761,0,0" VerticalAlignment="Top"
Width="142.657"/>
</Grid>
</Window>
-------MainWindow.xaml.cs------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfApplication
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
//Create a list of Course class to store each course name
List<Course> courses = new List<Course>();
public MainWindow()
{
InitializeComponent(); //Initialize all components
}
//When window about to load, this event occur.
private void Window_Loaded(object sender, RoutedEventArgs e)
{
//Create new course class to hold courseName and add that to
List<Course> courses
courses.Add(new Course() { courseName = "IT 145" });
courses.Add(new Course() { courseName = "IT 200" });
courses.Add(new Course() { courseName = "IT 201" });
courses.Add(new Course() { courseName = "IT 270" });
courses.Add(new Course() { courseName = "IT 315" });
courses.Add(new Course() { courseName = "IT 328" });
courses.Add(new Course() { courseName = "IT 330" });
//Use foreach loop to iterate through List<Course>
courses
foreach (Course item in courses)
{
//Add each courseName to combo box first using ToString() in
Course.cs
cbFirst.Items.Add(item.ToString());
}
}
//When Select this course button is clicked, this event
occurs
private void Button_Click(object sender, RoutedEventArgs e)
{
//Store the item in the combo box first into a variable called
cName
string cName=cbFirst.SelectedItem.ToString();
//Check if list box already contains this course
if (LBsecond.Items.Contains(cName))
{
//If this course is already present in listbox, show a messagebox
to user.
MessageBox.Show(cName+" already selected.");
}
else
{
//If listbox not contain this course, then add this course
LBsecond.Items.Add(cName);
}
}
}
}
C# C# Please leave commentary next to the code explaining what it does/ a WPF program that is sti...
Greetings everyone I am having a little trouble with this one. I bolded my switch case which should work but its currently not. If a user selected course option 1 twice it just says you enrolled in course 1 and course 1. It should stop it by executing case -2. Need a new set of eyes. - Thanks using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleRegisterStudent { class Program { static void Main(string[] args) { (new...
so i have my c++ code and ive been working on this for hours
but i cant get it to run im not allowed to use arrays. im not sure
how to fix it thank you for the help
our job is to write a menu driven program that can convert to display Morse Code ere is the menu the program should display Menu Alphabet Initials N-Numbers - Punctuations S = User Sentence Q- Quit Enter command the user chooses...
Please help we are suppose to explain what the C code does.
This is the electronics database
(6 pts) This problem is based on Electronics database. Add some annotations to the following table to explain what the C program is doing in detail. Note that "void" is how C declares a function that does not return anything. You are expected to generalize or research svntaxes not mentioned in the lecture C Program Annotation void newPCproduct EXEC SQL BEGIN DECLARE SECTION;...
33 On May 6, Jim Ryan borrowed $14,000 from Lane Bank at 7 % interest. Jim plans to repay the loan on March 11. Assume the loan is on ordinary interest. How much will Jim repay on March 11? (Use Days in a year table) (Round your answer to the nearest cent.) Jm repay etbook 7-1 TABLE Exact days-in-a-year calendar (excluding leap year)" Day of month 30 31 30 31 28 31 30 31 31 30 31 31 Dec Mar...
okay so here is my c++ code and the errors im really stuck on
fixing what i did wrong it seems to be the same repeated
error
our job is to write a menu driven program that can convert to display Morse Code ere is the menu the program should display Menu Alphabet Initials N-Numbers - Punctuations S = User Sentence Q- Quit Enter command the user chooses A your program should use a loop and your morse code printing...
need help to complete this java program // add appropriate import statements here. // These imports you can leave as is. import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.paint.Color; import javafx.stage.Stage; /** @author yourAccountNameHere */ public class ConnectTheDots extends Application { /* * Do not add code to main(). Add it below in connectTheDots instead. */ public static void main(String[] args) { launch(args); } /*...
please peovide coding in R:
with a data of 13 variables and 200 observations
Using the variable CLASS, test at 5% significance level to
test the claim that the
proportions of Freshmen, Sophomores, Juniors, and Seniors are
the same.
2. Repeat part (a) for the variable COLLEGE.
RLM ENGLISH MATH COMP 21 16 25 839SSESSOR 8 F 17 F N H ABCD 1 SEX HSP GPA AGE CREDITS CLASS COLLEGE MAJOR RESIDENCY TYPE 2 Transfer Blochm Resident F 75 2.39...
I need a basic program in C to modify my program with
the following instructions:
Create a program in C that will:
Add an option 4 to your menu for "Play Bingo"
-read in a bingo call (e,g, B6, I17, G57, G65)
-checks to see if the bingo call read in is valid (i.e., G65 is
not valid)
-marks all the boards that have the bingo call
-checks to see if there is a winner, for our purposes winning
means...
I have written my code for an employee management system that stores Employee class objects into a vector, I am getting no errors until I try and compile, I am getting the error: C2679 binary '==': no operator found which takes a right-hand operand of type 'const std::string' (or there is no acceptable conversion). But I am not sure why any help would be great, Thank you! 1 2 3 4 5 6 7 8 9 10 11 12 13...
Code is in C#
Your instructor would like to thank to Marty Stepp and Hélène Martin at the University of Washington, Seattle, who originally wrote this assignment (for their CSE 142, in Java) This program focuses on classes and objects. Turn in two files named Birthday.cs and Date.cs. You will also need the support file Date.dll; it is contained in the starter project for this assignment. The assignment has two parts: a client program that uses Date objects, and a...