Question

In: Computer Science

Suppose an application’s GUI has two TextBox controls named inputTextBox and outputTextBox. Write C# statement(s) that...

Suppose an application’s GUI has two TextBox controls named inputTextBox and outputTextBox. Write C# statement(s) that display the text entered by the user in the inputTextBox to the outputTextBox.

Write a statement for shifting focus to the textbox control nameTextBox.

Assume that we have a listbox control stateListBox. Add the item “Florida” to the list box.

Solutions

Expert Solution

Find the following steps as per required :

Step 1:

Create a new website with language as C#

Step 2 :

The project looks like as shown below in attached screenshot :

Step 3:

From the Toolbox shown in the figure add the controls . Just drag and drop the control in the design view as shown in the attached screenshot with explanation

Step 4 :

Now click on the source view . Add the code as shown below :

We are adding one textbox named inputTextBox . Another named outputTextBox as shown below :

<asp:TextBox ID="inputTextBox" name="inputTextBox" runat="server" AutoPostBack="true" OnTextChanged="inputTextBox_TextChanged"></asp:TextBox>

<td><asp:TextBox ID="outputTextBox" name="outputTextBox" runat="server" AutoPostBack="true"></asp:TextBox></td>

<asp:ListBox ID="ListBox1" runat="server">
<asp:ListItem>Georgia</asp:ListItem>
</asp:ListBox>

Step 5 :

As per required , we need to add an event i.e onTextChanged fwhen inputTextBox is changed . This will invoke the method named inputTextBox_TextChanged when text in the inputTextBox is changed as shown in below figure

<asp:TextBox ID="inputTextBox" name="inputTextBox" runat="server" AutoPostBack="true" OnTextChanged="inputTextBox_TextChanged"></asp:TextBox>

Step 6:

To display the entered text in the outputTextBox , we need to use below code . I.e assigning the value of inputTextbox to outputTextbox with the following command :

// Assigning value

outputTextBox.Text = inputTextBox.Text;

Step 7 : Adding Focus to nameTextBox

Using below command add focus to nameTextBox

// Adding focus to nameTextBox
nameTextBox.Focus();

Step 8 : Adding item to list box

To add an item to list box we need to use items.Add

Code is as below :


// Adding item to list box
ListBox1.Items.Add("Florida");

Step 9: Run the Program :

Initial screenshot which displays the textboxes , list control as required .

Step 10 :

Enter text in the input textbox . Then the entered text is shown in the Output Text box . The focus is changed to the nameTextbox . And the item Florida is added to the List as shown in the below attached screenshot :

Step 11 : The final code is as below :


Related Solutions

JAVA program. Write two public classes (named exactly), TextBox and TextBoxTester.  TextBox contains the following overloaded static...
JAVA program. Write two public classes (named exactly), TextBox and TextBoxTester.  TextBox contains the following overloaded static methods called textBoxString. This method returns a String value. public static String textBoxString (int side) The returned String value, when printed, displays as the outline of a square of side characters. The character you use is up to you. Don't forget that '\n' will force a newline character into the returned String. For example, let's assume I want to use * as the character...
Write a MIPS program that executes the statement: s = (a + b) – (c +...
Write a MIPS program that executes the statement: s = (a + b) – (c + 101), where a, b, and c are user provided integer inputs, and s is computed and printed as an output. Answer the following: a. Suppose the user enters a = 5, b = 10, and c = -30, what is the expected value of s? b. Which instruction in your program computed the value of s and which register is used? c. What is...
C# Programming Language Write a C# program ( Console or GUI ) that prompts the user...
C# Programming Language Write a C# program ( Console or GUI ) that prompts the user to enter the three examinations ( test 1, test 2, and test 3), homework, and final project grades then calculate and display the overall grade along with a message, using the selection structure (if/else). The message is based on the following criteria: “Excellent” if the overall grade is 90 or more. “Good” if the overall grade is between 80 and 90 ( not including...
Write a user defined function named “findTwosComplement” in C++, which will find 2’s complement of a...
Write a user defined function named “findTwosComplement” in C++, which will find 2’s complement of a signed number. Input must be passed by reference to the function and it will return the answer. There is no need to call this function anywhere. You can use following operators only: <<>> ~ & ^ | Decimal
Write a subroutine named swap in C thatswaps two nodes in a linked list. The first...
Write a subroutine named swap in C thatswaps two nodes in a linked list. The first node should not be able to change places. The nodes are given by: Struct nodeEl { int el; struct nodeEl * next; }; typdef struct nodeEl node; The list header (of type node *) is the first parameter of the subroutine. The second and third parameters consist of integers and are the places in the list where the nodes are to change places. The...
Using C#: Write a class named Employee that has the following properties: Name - The Name...
Using C#: Write a class named Employee that has the following properties: Name - The Name property holds the employee's name IdNumber - The IdNumber property holds the employee's ID number Department - The Department property holds the name of the department in which the employee works Position - The Position property holds the employee's job title The class should have the following overloaded constructors: A constructor that accepts the following values as arguments and assigns them to the appropriate...
Two candidates: a populist named T and a woman named C, are competing for the presidency...
Two candidates: a populist named T and a woman named C, are competing for the presidency of a small country with a population of 5 people eligible to vote (being T and C part of this population). each candidate votes for himself with certainty. One of the three people will vote for candidate C with certainty. the other two voters, let's say people X and Y, are undecided. each has a 40% chance of voting for T (and 60% of...
Complete the following C++ tasks: a. Design a class named BaseballGame that has fields for two...
Complete the following C++ tasks: a. Design a class named BaseballGame that has fields for two team names and a final score for each team. Include methods to set and get the values for each data field. Create the class diagram and write the pseudocode that defines the class. b. Design an application that declares three BaseballGame objects and sets and displays their values. c. Design an application that declares an array of 12 BaseballGame objects. Prompt the user for...
2 Write a function named equivalentArrays that has two array arguments and returns 1 if the...
2 Write a function named equivalentArrays that has two array arguments and returns 1 if the two arrays contain the same values (but not necessarily in the same order), otherwise it returns 0. Your solution must not sort either array or a copy of either array! Also you must not modify either array, i.e., the values in the arrays upon return from the function must be the same as when the function was called. Note that the arrays do not...
Suppose there are two countries named Woody and Sweety. Recently, the government of Woody has placed...
Suppose there are two countries named Woody and Sweety. Recently, the government of Woody has placed many restrictions upon the use of the language of Sweety within their borders. They argue that the inflow of Sweety’s movies, music, and literature is responsible for the dilution of their rich culture. Woody government also claimed that culture of Sweety is really strange and Sweety should follow Woody’s way to do business. What are the possible reasons for Woody government to place restrictions...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT