File Edit View Git Project Build 1 Form1.cs x Form1.cs [Design] ClassicBookSelector 21 22 23 24 25 26 27 28 89% 29 38 31 32 33 34 35 36 37 38 39 48 电 2 Error List 40 41 42 43 45 Entire Solution Error List Output Ready { 40°F Cloudy -- Debug Debug 2 ΔΟ Test Any CPU Analyze Tools og Classic BookSelector.Form1 //creating point object to get the cursor position Point point = ListBox1.PointToClient (Cursor. Position); int index = listBox1.IndexFromPoint (point); //checking index value is lesser than zero //if yes, return if (index < 0) return; Extensions Window Start-- //set label2. Text is empty Label2.Text = ""; 2 Errors ·} //code for listBox1 MouseLeave Event 1 reference private void listBox1_MouseLeave(object sender, EventArgs e) { //displaying the message using label while hovering the listbox Label2.Text = "Here is the short things about it" = Environment. Newline //code for listBox1_SelectedIndexChanged() 1 reference private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { Code Description CS0131 The left-hand side of an assignment must be a variable, property or indexer CS0200 Property or indexer 'Environment.NewLine' cannot be assigned to -- it is read only. Help Search (Ctrl+Q) 上写习习习, 0 Warnings 6 Messages 7 Build+ IntelliSense Project label1.Text = brief Synopsis [listBox1.SelectedIndex]; //selecting each element of the listbox, back color of the form should change if (listBox1.SelectedIndex.5 == 0) this.BackColor = Color.Orange; else if (listBox1.SelectedIndex 5 == 2) this.BackColor = Color. Red; Search ClassicBookSelector ClassicBookSelector listBox1 MouseHover(object sender, EventArgs e) displayMessage [index]; File Form1.cs Form1.cs A Ln: 29 Ch: 107 Search Error List Classic Be 29 SPC Line Suppression State 29 Active Active
File Edit View Git Project Build 1 Form1.cs x Form1.cs [Design] ClassicBookSelector 21 22 23 24 25 26 27 28 89% 29 38 31 32 33 34 35 36 37 38 39 48 电 2 Error List 40 41 42 43 45 Entire Solution Error List Output Ready { 40°F Cloudy -- Debug Debug 2 ΔΟ Test Any CPU Analyze Tools og Classic BookSelector.Form1 //creating point object to get the cursor position Point point = ListBox1.PointToClient (Cursor. Position); int index = listBox1.IndexFromPoint (point); //checking index value is lesser than zero //if yes, return if (index < 0) return; Extensions Window Start-- //set label2. Text is empty Label2.Text = ""; 2 Errors ·} //code for listBox1 MouseLeave Event 1 reference private void listBox1_MouseLeave(object sender, EventArgs e) { //displaying the message using label while hovering the listbox Label2.Text = "Here is the short things about it" = Environment. Newline //code for listBox1_SelectedIndexChanged() 1 reference private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { Code Description CS0131 The left-hand side of an assignment must be a variable, property or indexer CS0200 Property or indexer 'Environment.NewLine' cannot be assigned to -- it is read only. Help Search (Ctrl+Q) 上写习习习, 0 Warnings 6 Messages 7 Build+ IntelliSense Project label1.Text = brief Synopsis [listBox1.SelectedIndex]; //selecting each element of the listbox, back color of the form should change if (listBox1.SelectedIndex.5 == 0) this.BackColor = Color.Orange; else if (listBox1.SelectedIndex 5 == 2) this.BackColor = Color. Red; Search ClassicBookSelector ClassicBookSelector listBox1 MouseHover(object sender, EventArgs e) displayMessage [index]; File Form1.cs Form1.cs A Ln: 29 Ch: 107 Search Error List Classic Be 29 SPC Line Suppression State 29 Active Active
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
C# programming question 3. What do these 2 errors mean and how to fix them!
![This image shows a coding environment in Visual Studio with C# code, related to a project named “ClassicBookSelector.” Below is the transcription of the visible code:
```csharp
// Creating point object to get the cursor position
Point point = ListBox1.PointToClient(Cursor.Position);
int index = ListBox1.IndexFromPoint(point);
// Checking index value is Lesser than zero
if (index < 0) return;
// Displaying the message using Label while hovering the ListBox
Label2.Text = "Here is the short things about it: " + Environment.NewLine = displayMessage[index];
// Code for ListBox1 MouseLeave Event
private void ListBox1_MouseLeave(object sender, EventArgs e)
{
// Set label2.Text is empty
Label2.Text = "";
}
// Code for ListBox1 SelectedIndexChanged
private void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
Label2.Text = briefSynopsis[ListBox1.SelectedIndex];
// Each an element of the ListBox, back color of the form should change
if (ListBox1.SelectedIndex % 5 == 2)
this.BackColor = Color.Lime;
else if (ListBox1.SelectedIndex % 5 == 2)
this.BackColor = Color.Red;
}
```
**Explanation:**
1. **Code Description:**
- The code snippet is a part of a Windows Forms application in C#.
- It involves UI interaction with a `ListBox` and a `Label`.
2. **Functionality:**
- A `Point` object determines the cursor's position relative to `ListBox1`.
- An `IndexFromPoint` method checks which item in the ListBox is under the cursor.
- If the index is valid, it fetches a message from `displayMessage` array to show in `Label2`.
- On mouse leave from the ListBox, the label's text is cleared.
- On selection change in `ListBox1`, it updates the label with a brief synopsis and changes the form's background color conditionally.
3. **Error List:**
- There are errors listed that relate to the invalid assignment involving `Environment.NewLine`.
This example illustrates basic event handling in a C# application using Windows Forms, which is a common interface for visual applications in Microsoft’s development ecosystem.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fb9f0bdf4-572f-4133-8b3a-121eaba2f02a%2F790a41d6-f7bc-4752-b940-835fa8a463b2%2Ft177vng_processed.jpeg&w=3840&q=75)
Transcribed Image Text:This image shows a coding environment in Visual Studio with C# code, related to a project named “ClassicBookSelector.” Below is the transcription of the visible code:
```csharp
// Creating point object to get the cursor position
Point point = ListBox1.PointToClient(Cursor.Position);
int index = ListBox1.IndexFromPoint(point);
// Checking index value is Lesser than zero
if (index < 0) return;
// Displaying the message using Label while hovering the ListBox
Label2.Text = "Here is the short things about it: " + Environment.NewLine = displayMessage[index];
// Code for ListBox1 MouseLeave Event
private void ListBox1_MouseLeave(object sender, EventArgs e)
{
// Set label2.Text is empty
Label2.Text = "";
}
// Code for ListBox1 SelectedIndexChanged
private void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
Label2.Text = briefSynopsis[ListBox1.SelectedIndex];
// Each an element of the ListBox, back color of the form should change
if (ListBox1.SelectedIndex % 5 == 2)
this.BackColor = Color.Lime;
else if (ListBox1.SelectedIndex % 5 == 2)
this.BackColor = Color.Red;
}
```
**Explanation:**
1. **Code Description:**
- The code snippet is a part of a Windows Forms application in C#.
- It involves UI interaction with a `ListBox` and a `Label`.
2. **Functionality:**
- A `Point` object determines the cursor's position relative to `ListBox1`.
- An `IndexFromPoint` method checks which item in the ListBox is under the cursor.
- If the index is valid, it fetches a message from `displayMessage` array to show in `Label2`.
- On mouse leave from the ListBox, the label's text is cleared.
- On selection change in `ListBox1`, it updates the label with a brief synopsis and changes the form's background color conditionally.
3. **Error List:**
- There are errors listed that relate to the invalid assignment involving `Environment.NewLine`.
This example illustrates basic event handling in a C# application using Windows Forms, which is a common interface for visual applications in Microsoft’s development ecosystem.

Transcribed Image Text:**Programming Exercises**
1. **WordsOfWisdom Project**
- Create a project with a form containing at least four `Label`s displaying "wise" quotes.
- Set the form's background color, and make each `Label`'s background black.
- When the mouse hovers over a `Label`, change its background color to white to reveal the text.
2. **RecentlyVisitedSites Project**
- Create a project with a form containing three `LinkLabel`s, each linked to different websites.
- When a user clicks a `LinkLabel`, navigate to the site.
- On hovering over a `LinkLabel`, display a brief explanation of the site’s purpose.
- After clicking a link, reorder the list to move the used link to the top.
3. **ClassicBookSelector Project**
- Create a project with a form containing a `ListBox` of at least five classic books.
- Display a general statement on reading when hovering over the `ListBox`.
- On clicking a book title, show another `Label` with a brief summary.
- Change the form's background color for each book selection.
4. **Animated Project**
- Find an animated `.gif` file online and create a project with a `PictureBox`.
- Display three different messages on a `Label`: one for hovering over the `PictureBox`, one for the mouse not over it, and one for when it's clicked.
5. **SalsSandwiches Project**
- Create a project for a sandwich shop allowing users to choose a sandwich type from at least four options using a `ListBox`.
- Upon selection, display another `ListBox` with at least three bread options.
- Upon selecting bread, display a third `ListBox` for additional items.
- Show a message listing all chosen options in a `Label`, and hide the `ListBox`es once selections are made.
- If the first choice is reselected, the bread option reappears, and a new bread selection enables additions again.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY