Question

In: Computer Science

I am having problems getting the second button part of this to work. this is for...

I am having problems getting the second button part of this to work. this is for visual basic using visual studio 2017. Please help.

Create an application named You Do It 4 and save it in the VB2017\Chap07 folder. Add
two labels and two buttons to the form. Create a class-level variable named strLetters
and initialize it to the first 10 uppercase letters of the alphabet (the letters A through J).
The first button’s Click event procedure should use the appropriate character’s index to
display the fifth letter from the strLetters variable (the letter E) in the first label. The
second button should use a loop and the appropriate indexes to display the letters CDEF
in the second label. Code the procedures. Save the solution and then start and test the
application. Close the solution.

Solutions

Expert Solution

Design

Coding

Alphabet.vb

Public Class Alphabet
Public strLetters As String = "ABCDEFGHIJ" 'Make class lavel variable declare here
End Class

Form1.vb

Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click ''if button one click then it invoke this code
Dim a1 As New Alphabet ''take new object of class Albphabet
Label1.Text = a1.strLetters.Substring(4, 1).ToString ''output display
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim a1 As New Alphabet 'take new object of class Albphabet
Dim str As String = "" 'take new string
For i As Integer = 2 To 5
str = str + a1.strLetters.Substring(i, 1).ToString ''string value concate here from index 2 to 5
Next
Label2.Text = str ''output display
End Sub
End Class

Output:

if you still have any Problem regarding this question please comment and if you like my code please appreciate me by thumbs up thank you.........


Related Solutions

I am having a hard time getting my an output after putting in the second set...
I am having a hard time getting my an output after putting in the second set of functions and I was hoping to be able to have the results from the functions be rounded to 2 decimal places. <html> <head> <title>Length Conversion</title> <script language='JavaScript' type='text/JavaScript'> <!-- function validate(type) { if(document.my_form.textinput.value=='') { alert('Fill the Input box before submitting'); return false; }else{ if(type=="to_feet"){ var res=3.2808*document.my_form.textinput.value; var unit=" feet"; }else{ var res=0.3048*document.my_form.textinput.value; var unit=" meter"; } document.getElementById("result").innerHTML=res.toFixed(2) + unit; return false; } }...
I am working on an accounting assignment and am having problems. Firstly, 1.I need to journalize...
I am working on an accounting assignment and am having problems. Firstly, 1.I need to journalize these entries and post the closing entries 2. i need to prepare Dalhanis multi-step income statement and statement of owners equity for August 2010 3. i need to prepare the blance sheet at august 31,2010 4. i need to prepare a post-closing trial balance at august 31,2010 DALHANI makes all credit sales on terms 2/10 n/30 and uses the Perpetual Inventory System Aug 1...
I am working on an accounting assignment and am having problems. Firstly, 1.I need to journalize...
I am working on an accounting assignment and am having problems. Firstly, 1.I need to journalize these entries and post the closing entries 2. i need to prepare Dalhanis multi-step income statement and statement of owners equity for August 2010 3. i need to prepare the blance sheet at august 31,2010 4. i need to prepare a post-closing trial balance at august 31,2010 DALHANI makes all credit sales on terms 2/10 n/30 and uses the Perpetual Inventory System Aug 1...
I am having a hard time getting started on how to do this assignment. I would...
I am having a hard time getting started on how to do this assignment. I would like some ideas on how to start the MEMO. and maybe some ideas on what you would include. But I don't necessarily need the assignment completed for me. just need ideas!!! One routine negative message in the form of an internal memo. 400-500 word message. Single-spaced, with 1-inch margins on all sides. Objective: To announce organizational restructuring, one routine negative message addressed to employees....
I have a project due and am having problems compiling a program: The only program I...
I have a project due and am having problems compiling a program: The only program I have written is check.c everything else is given and correct. Can you modify check.c to simply print out the chessboard, in other words, to get it to compile by any means thank you. The only thing you have to modify again is check.c nothing else. Just get it to print something thanks. program chess.c #include #include #include "chess.h" void get_valid_move(int mover) { int x_from,...
For some reason I am having a hard time getting this program to compile properly. Could...
For some reason I am having a hard time getting this program to compile properly. Could you help me debug it? Write the prototypes and functions to overload the given operators in the code //main.cpp //This program shows how to use the class rectangleType. #include <iostream> #include "rectangleType.h" using namespace std; int main() {     rectangleType rectangle1(23, 45);                     //Line 1     rectangleType rectangle2(12, 10);                     //Line 2     rectangleType rectangle3;                             //Line 3     rectangleType rectangle4;                             //Line 4     cout << "Line...
One part of this question I am getting wrong. I'm assuming it's the test statistic? I...
One part of this question I am getting wrong. I'm assuming it's the test statistic? I got 1 for Question C, and I got 5.432 for question b, and I got B for question C. An undergraduate student performed a survey on the perceived physical and mental health of UBC students for her term project. She collected information by asking students whether they are satisfied with their physical and mental health status. 129 male and 157 female UBC students were...
Hello, I am having trouble getting started on my project and building these functions. How do...
Hello, I am having trouble getting started on my project and building these functions. How do I build a function that continuously adds new "slices" to the list if they are below/above the size limit? I didn't copy the entire problem, but just for reference, when the code is run it will take user input for size limit (L), time cost for a random slice(R), and time cost for an accurate slice(A). Question: In real life, a steak is a...
Using dev c++ I'm having trouble with classes. I think the part that I am not...
Using dev c++ I'm having trouble with classes. I think the part that I am not understanding is sending data between files and also using bool data. I've been working on this program for a long time with many errors but now I've thrown in my hat to ask for outside help. Here is the homework that has given me so many issues: The [REDACTED] Phone Store needs a program to compute phone charges for some phones sold in the...
I am having problems trying to figure out what information to pull to prepare budgets
I am having problems trying to figure out what information to pull to prepare budgets
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT