Question

In: Computer Science

Using C# visual basics Can someone show a calculator with a button that does a FOR...

Using C# visual basics

Can someone show a calculator with a button that does a FOR LOOP about 10x time and does a print out of a name 10x

Solutions

Expert Solution

Dear Student ,

As per the requirement submitted above , kindly find the below solution.

Visula Basic :

Here a new Windows Forms Application in VB is created using Visual Studio 2017 with name "CalculatorForLoop".This application contains a form with name "Form1.vb".Below are the files associated with form1.

1.Form1.vb[Design]

2.Form1.vb

Public Class Form1
'button name click
Private Sub btnName_Click(sender As Object, e As EventArgs) Handles btnName.Click
'taking name entered by user
Dim name As String = txtName.Text
'using for loop print name
For index = 1 To 10
'concate and print names entered by the user
lblNames.Text = lblNames.Text & name & " " & Environment.NewLine
Next

End Sub
End Class

======================================================

Output : Run application using F5 and will get the screen as shown below

Screen 1 :

Screen 2 :Screen when user enters the name

********************************************************************

C# :

Here a new Windows Forms Application in C# is created using Visual Studio 2017 with name "PrintNamesApp".This application contains a form with name "Form1.cs".Below are the files associated with form1.

1.Form1.cs[Design]

2.Form1.cs

//namespace
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
//application namespace
namespace PrintNamesApp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//button name click
private void btnName_Click(object sender, EventArgs e)
{
//taking name entered by user
string name = txtName.Text;
//using for loop print name
for (int i = 0; i < 10; i++)
{
//using for loop print name
lblNames.Text += name + " " + Environment.NewLine;
}
}
}
}

======================================================

Output : Run application using F5 and will get the screen as shown below

Screen 1 :

Screen 2 :

NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.


Related Solutions

Using C# visual basics Can someone show a calculator with a button that does a While...
Using C# visual basics Can someone show a calculator with a button that does a While LOOP about 10x time and does a print out of a name 10x
How can I configure the button in this tip calculator to calculate the total using the...
How can I configure the button in this tip calculator to calculate the total using the entires for the bill and tip percentage? I'm using Visual Studio 2019 Xamarin.Forms Main.Page.xaml <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:d="http://xamarin.com/schemas/2014/forms/design" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="Accomplish_2.MainPage" BackgroundColor="Gray" Padding="5"> <StackLayout> <!-- Place new controls here --> <Label Text="Tip Calculator" HorizontalOptions="Center" VerticalOptions="Center" FontSize="Title" FontAttributes="Bold"/> <BoxView BackgroundColor="LightPink" HeightRequest="3"></BoxView>    <Entry Placeholder="Bill Total" Keyboard="Numeric" x:Name="billTotal"></Entry>    <Entry Placeholder="Tip Percentage" Keyboard="Numeric" x:Name="tipPercent"></Entry> <Button Text="Calculate" Clicked="Button_Clicked"></Button>    </StackLayout> </ContentPage> Everything above...
Add a radio Button in UI , by using Visual Studio code Add a Radio button...
Add a radio Button in UI , by using Visual Studio code Add a Radio button in UI , by Using visual Studio code in Angular or Angular Js Format.
Need it in C# using visual studio (also can you show me how to implement the...
Need it in C# using visual studio (also can you show me how to implement the code in vs) Create a New Project named Preferred Customer to be used in a retail store for preferred customers, where customers can earn discount on all purchases depending upon how much money they are going to spend. To begin with designing your Application, you must add a class named Person with properties for holding a Person’s Name, Address and Telephone Number. Next step...
Can someone show me how to make this javaFx code work? The submit button should remain...
Can someone show me how to make this javaFx code work? The submit button should remain disabled until: ● There is text in all three fields. ● The two password fields have the same value. When Submit is clicked, display an Alert that says “Account Created!” When Quit is clicked, display an Alert that asks the user if they are sure they want to quit. If they click OK, quit the program with System.exit(0). If they click Cancel, the program...
Create an ASP.Net Website using Visual Studio with C#: Create a simple calculator that has 3...
Create an ASP.Net Website using Visual Studio with C#: Create a simple calculator that has 3 text boxes: 2 of them to enter numbers, the 3rd one displays the results Create 4 buttons to add, subtract, multiply, and divide Prevent the user from entering text in the number fields Display a message indicating “cannot divide by” when the user click “/” and there is a zero the in the second box Create two additional buttons: - One to store data...
Write a program in Visual Basics that does the following: Read in 20 numbers, each of...
Write a program in Visual Basics that does the following: Read in 20 numbers, each of which is between 10 and 100, inclusive. As each number is read, print it only if it is not a duplicate of a number already read. Provide for the “worst case” in which all 20 numbers are different. Use the smallest possible array to solve this problem.
Create an ASP.Net Website using Visual Studio with Visual Basic.Net: Create a simple calculator that has...
Create an ASP.Net Website using Visual Studio with Visual Basic.Net: Create a simple calculator that has 3 text boxes: 2 of them to enter numbers, the 3rd one displays the results Create 4 buttons to add, subtract, multiply, and divide Prevent the user from entering text in the number fields Display a message indicating “cannot divide by” when the user click “/” and there is a zero the in the second box Create two additional buttons: - One to store...
Using C# Windows App Form Create a simple calculator using +,-,*,/ Please show code GUI Code...
Using C# Windows App Form Create a simple calculator using +,-,*,/ Please show code GUI Code for calculator menus radio button input text boxes
Using Visual Basic 2017, Create a form with two textboxes and one button. A user enters...
Using Visual Basic 2017, Create a form with two textboxes and one button. A user enters the course she is taking in the first text box and then clicks on the button. Then if the user entered "Program Language" in the first text box, the second text box will show "Awesome pick!". If the user entered something else, the text box shows "Ok." Please write the correct code.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT