Thank you to the ones who have tried to help me and I apologize for having to repost this question. I'm having a hard time trying to comprehend coding. I am supposed to code a joke and punchline. The joke is:"why did the chicken cross the road?" And the punchline is: "The hen got on its nerves." Or any answer will do actually. I have two labels and one button to make it run. If anyone can help me understand this in the simplest way, it would be greatly appreciated. What is the simplest way to write this code and understand what to do? Thank you. Oh, I am coding this in Visual Basics.
IDE requirement for project Visual Studio
Step 1:
Create a new Project
Start Visual Studio and select File->New project. From the new project dialog select Windows Application and name the project chickenroad (or any other name as you like) and click on Ok to create the new project. Once the new project is created, Visual Studio will display a blank form ready for us to design the user interface of the application
Step 2:
Add all the required GUI controls to the Form
For our project,we are going to add three controls to our form:a button and two labels by dragging them into our form from the toolbox.The toolbox is present at the left side of visual studio main windowwhich looks like the one shown below.It contains all the GUI eleements required to build an application.The tools are categorised into groups based on their functionality and purpose
To add a label to the form, click on the Label control in the Toolbox, drag it to the center of the Form and release the mouse button. The new label will then appear in the Form.Use the mouse to move the controls around the Form and place in the required position.Similarly add another label to the form.
Next we need to add a button. Grab a Button from the Toolbox and drag and drop it on the Form.Place the button at any convenient place in the form as shown below
Step 3:
Changing the controls of the properties:
Now after adding the controls to the form,we can see that all the controls placed in the form have their default names like Label1,Label2,Label3..... and Button1,Button2,Button3..... etc.,
In order to customise them,we need to change the properties of the controls with their corresponding property sheet which can be accessed at the bottom right of the visual studio main window.
It provides a facility to alter the properties of a control by changing color,font,text size,text etc., as shown below:
Now , change the label1's text as : "Why did the chicken cross the road ?" and label2's text as "?????" and button's text as "Know Why ???"
Step 4:
Adding an event handler to the button
Now, we come to actual coding part which is very simple and requires only a few lines of code of which most of it was readily generated automatically when we perform an action on the control during the design time.
In order to add click control on the button,simply double click on it to enter the code view of the project where we get navigated to the event handler section of the button which will look like the following:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles closeButton.Click End Sub
Now add a line of code before the End Sub statement for the above code as follows:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles closeButton.Click Label.setText("Because,The hen got on its nerves") End Sub
Now save the project
Step 5:
Running the application:
In order to run the application , click on the run(play) button in the visual studio tool bar on the top of the main window.Alternatively you can press F5 key to compile and run the code
After the compilation , a window will appear just like what we have designed earlier as shown below:
Now click on "Know why ??? " button to view the punch line
The screen shot after clicking the button is shown below:
Explanation:
After clicking the botton ,the event will take place by generating an object which will be causing the code in the event handler to run.In our code the label2's earlier value "???" will be changed to "Because,The hen got on its nerves".
Thank you to the ones who have tried to help me and I apologize for having...
Questions help! I have tried all questions multiple times! I am so confused on all three. Please attempt all three, explanations would be greatly appreciated! Thank you, will rate! P10.4.2 A flywheel has a constant angular acceleration of -0.82 rad/s. What is its angular velocity 14 s after its angular velocity is 5.0 rad/s? (5.00) (0/5 submissions used) rad/s Save P10.4.2 Submit P10.4.2
I am having trouble solving these types of problems. Please help me understand by explaining and showing me the steps and methods needed to work this out. thank you.
Could you please help me write a Javascript code that will show a smiley face picture when I click the button. The picture should not display until the button is pressed. Here is my attempt at the code. It does not work. Please keep the code as simple as you can as I am new to coding. Please also use the <div> tag if possible, onclick and use the getElementById. Thank you <html> <body> <img id="exampleImage" src="smileyFace.png" /> <button onclick="pushButton()">Try...
Can you write the code for this It's for Visual Basic I am having a hard time getting it to work Telling me error Thank u I will rate a good so other students can learn from this
I need help with this c++ code. This is my first computer science course. I have not learned arrays but I am learning vectors. I am also required to write this code without do loops or any other form of advanced coding technique. Please help me figure out this code using the basic coding techniques that you would find in an introduction to cs. Thank you for your help, I don't even know where to start :)
(Mobile-Android Studio) Hello. Thank you for coming to help me:) I am using the Andriod studio on mac. and using Java code to develop. and Please start with basic activity with constraints layout (not empty). (audio file is not given, let's say there any audio file). I just would like to see the codes how it works. Thank you very much. I would like to know how to write a program that includes two buttons called plays Play and Stop....
I tried this problem to no avail. can someone please help me? thank you graph with the given properties. 14. Sketch a f (0)= 0, f'(x)> 0 for x <-1 and -1 < I < 1, f'(x)< 0 for x > 1 f"(x)> 0 for f"(x) 0 for -1 < x < 0 1, 0x < 1 and x> 1 graph with the given properties. 14. Sketch a f (0)= 0, f'(x)> 0 for x
Hello, I have tried to make a clear scan of my problems In a review I am nearly done with but I wanted to know if someone could walk me through these practice problem. I want to understand it better, so thank you for the help! Use the following data at 1200 K to estimate a value of Kp for the reaction, 2H2(g) + O2(g) -2H20(g) C(graphite) + CO2(g) , 2C0(g) CO2(g)+H2(9)CO(g)+H20(g)Kc-1.4 C(graphite) + ½ O2(g)-CO(g) Kc=0.64 KC#1.0x108 At 25°C,...
i am taking Healthcare finance and accounting. Can anyone tell me the right way to set up a worksheet for liquidity ratios? I am supposed to refer to the Metropolis Health Systems. Thank you.
Hey! Can you please help me with the following two questions I am highly confused and I don't really understand them at all. Thank you!! 16, Please help me with them, we have a test this thursday and problems that are similar are supposed to be on there. Thank you so much!!! 1.The hydroxide ion concentration in an aqueous solution at 25°C is 1.8×10-2 M. The hydronium ion concentration is ______ M. The pH of this solution is_______ . The...