Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with this 1)Write the code for the Break Apart button click event. The subroutine should get the text from txtRecord and pass it

image text in transcribed

Need help with this

1)Write the code for the Break Apart button click event. The subroutine should get the text from txtRecord and pass it to a subroutine called BreakApartRecord. The BreakApartRecord subroutine should break apart strRecord into fields and populate the txtField# textboxes. A field is delimited by a comma. Ignore anything after the 6th comma. The Break Apart button click subroutine should also clear txtRecord.

For example the Record #1, James E. Blues, 123 Elm Street, Cincinnati, Ohio 45242, should be broken up into the fields as shown in the screen capture above.

Be sure to trim any leading and trailing spaces from the fields.

*** There may be less than 6 commas in the field. For example: 1, 2, 3, Make sure you code handles this.

2)Write the code for the Put Together button click event. The subroutine should call a function PutFieldsTogether. The PutFieldsTogether function should get the text from all the txtField# textboxes and create a string by concatenating the fields together with comma&space in between each field. The PutFieldsTogether function should return this string. The Put Together button click subroutine should then update the text in txtRecord with the returned string. The Put Together button click subroutine should also clear the txtField# textboxes.

At this point, everything works except the two below. Can somebody help me with this please. its VB.Net string manupulation

thanks

1)Ignore anything after the 6th comma.

2) Be sure to trim any leading and trailing spaces from the fields.

Private Sub btnBreakApart_Click(sender As Object, e As EventArgs) Handles btnBreakApart.Click Dim Sentence As String = txtRecord.Text txtRecord.ResetText() Dim Fields() As String = Split(Sentence.Trim(), ",") Dim FieldLen = Fields.Length

If FieldLen = 1 Then txtField1.Text = Fields(0) CombineFields = txtField1.Text ElseIf FieldLen = 2 Then txtField1.Text = Fields(0) txtField2.Text = Fields(1) CombineFields = txtField1.Text + "," + txtField2.Text ElseIf FieldLen = 3 Then txtField1.Text = Fields(0) txtField2.Text = Fields(1) txtField3.Text = Fields(2) CombineFields = txtField1.Text + "," + txtField2.Text + "," + txtField3.Text ElseIf FieldLen = 4 Then txtField1.Text = Fields(0) txtField2.Text = Fields(1) txtField3.Text = Fields(2) txtField4.Text = Fields(3) CombineFields = txtField1.Text + "," + txtField2.Text + "," + txtField3.Text + "," + txtField4.Text ElseIf FieldLen = 5 Then txtField1.Text = Fields(0) txtField2.Text = Fields(1) txtField3.Text = Fields(2) txtField4.Text = Fields(3) txtField5.Text = Fields(4) CombineFields = txtField1.Text + "," + txtField2.Text + "," + txtField3.Text + "," + txtField4.Text + "," + txtField5.Text ElseIf FieldLen = 6 Then txtField1.Text = Fields(0) txtField2.Text = Fields(1) txtField3.Text = Fields(2) txtField4.Text = Fields(3) txtField5.Text = Fields(4) txtField6.Text = Fields(5) CombineFields = txtField1.Text + "," + txtField2.Text + "," + txtField3.Text + "," + txtField4.Text + "," + txtField5.Text + "," + txtField6.Text End If End Sub

Private Sub btnPutTogether_Click(sender As Object, e As EventArgs) Handles btnPutTogether.Click txtRecord.Text = CombineFields txtField1.ResetText() txtField2.ResetText() txtField3.ResetText() txtField4.ResetText() txtField5.ResetText() txtField6.ResetText() End Sub

Step 2 23 BnStreet. Record | Record#1. James E. Blues, 1 art Put Together Field 1 Field 3 Field 5 Field 2 Field 4 Field 6

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Implementation

Authors: Shouhong Wang, Hai Wang

1st Edition

1612330150, 978-1612330150

More Books

Students also viewed these Databases questions

Question

10. What is meant by a feed rate?

Answered: 1 week ago

Question

=+Describe an important trade-off you recently faced

Answered: 1 week ago