Question

Visual Basic File access Create a form that allow users to enter information (either through text...

Visual Basic

File access

Create a form that allow users to enter information (either through text boxes or user input). You decide what you want the users to enter. Use the information entered by the user to create a file that contains the information entered.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

In case of any query do comment. Please rate answer as well. Thanks

Code:

==Form1.vb==

Imports System.IO

Public Class Form1

    Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click

        'StreamWrite is used to write lines to the file opened by File.CreateText

        Using writer As StreamWriter = File.CreateText("C:\input.txt")

            'Write the content of a text box

            writer.WriteLine(txtInput.Text)

        End Using

   End Sub

End Class

===from1.designer.vb===

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

Partial Class Form1

    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.

    <System.Diagnostics.DebuggerNonUserCode()> _

    Protected Overrides Sub Dispose(ByVal disposing As Boolean)

        Try

            If disposing AndAlso components IsNot Nothing Then

                components.Dispose()

            End If

        Finally

            MyBase.Dispose(disposing)

        End Try

    End Sub

    'Required by the Windows Form Designer

    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer

    'It can be modified using the Windows Form Designer.

    'Do not modify it using the code editor.

    <System.Diagnostics.DebuggerStepThrough()> _

    Private Sub InitializeComponent()

        Me.Label1 = New System.Windows.Forms.Label()

        Me.txtInput = New System.Windows.Forms.TextBox()

        Me.btnSave = New System.Windows.Forms.Button()

        Me.SuspendLayout()

        '

        'Label1

        '

        Me.Label1.AutoSize = True

        Me.Label1.Location = New System.Drawing.Point(57, 88)

        Me.Label1.Name = "Label1"

        Me.Label1.Size = New System.Drawing.Size(118, 20)

        Me.Label1.TabIndex = 0

        Me.Label1.Text = "Enter text here:"

        '

        'txtInput

        '

        Me.txtInput.Location = New System.Drawing.Point(212, 74)

        Me.txtInput.Multiline = True

        Me.txtInput.Name = "txtInput"

        Me.txtInput.Size = New System.Drawing.Size(241, 87)

        Me.txtInput.TabIndex = 1

        '

        'btnSave

        '

        Me.btnSave.Location = New System.Drawing.Point(218, 251)

        Me.btnSave.Name = "btnSave"

        Me.btnSave.Size = New System.Drawing.Size(187, 39)

        Me.btnSave.TabIndex = 2

        Me.btnSave.Text = "Save to File"

        Me.btnSave.UseVisualStyleBackColor = True

        '

        'Form1

        '

        Me.AutoScaleDimensions = New System.Drawing.SizeF(9.0!, 20.0!)

        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font

        Me.ClientSize = New System.Drawing.Size(800, 450)

        Me.Controls.Add(Me.btnSave)

        Me.Controls.Add(Me.txtInput)

        Me.Controls.Add(Me.Label1)

        Me.Name = "Form1"

        Me.Text = "Form1"

        Me.ResumeLayout(False)

        Me.PerformLayout()

    End Sub

    Friend WithEvents Label1 As Label

    Friend WithEvents txtInput As TextBox

    Friend WithEvents btnSave As Button

End Class

=======screen shot of the code====

Output:

Add a comment
Know the answer?
Add Answer to:
Visual Basic File access Create a form that allow users to enter information (either through text...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In Visual Basic. Thank you in advance! Visual Basic File access Create a form that allow...

    In Visual Basic. Thank you in advance! Visual Basic File access Create a form that allow users to enter information (either through text boxes or user input). You decide what you want the users to enter. Use the information entered by the user to create a file that contains the information entered.

  • using Visual Basic>>> Create a form with two text boxes and a checkbox The checkbox should...

    using Visual Basic>>> Create a form with two text boxes and a checkbox The checkbox should say "equals" The checkbox should be checked if the text in the two textboxes are equal and should not be checked if the texts are different. It should work no matter what the user enters into either textbox.

  • C# Visual Studio Problem You are given a file named USPopulation.txt. The file contains the midyear...

    C# Visual Studio Problem You are given a file named USPopulation.txt. The file contains the midyear population of the United States, in thousands, during the years 1950 through 1990. The first line in the file contains the population for 1950, the second line contains the population for 1951, and so forth. Create an application that reads the file’s contents into an array or a List. The application should display the following data (statistics) in read-only textboxes. The average population during...

  • PHP you need to create a form to allow the user to enter their name, email,...

    PHP you need to create a form to allow the user to enter their name, email, and address information. That information will be sent to a PHP script that will process and display that information. Your assignment should have two pages. The first page is straight html (user_input.html) that has a form with the appropriate form elements to collect the user input. The form should then be submitted using the POST method to a php script (display_user_info.php) that will process...

  • PLEASE USE VISUAL BASIC* BY VISUAL STUDIO. Visual Basic INTERMEDIATE Create a Windows Forms application. Use...

    PLEASE USE VISUAL BASIC* BY VISUAL STUDIO. Visual Basic INTERMEDIATE Create a Windows Forms application. Use the following names for the project and solution, respectively: Chopkins Project and Chopkins Solution. Save the application in the VB2017\Chap03 folder. Change the form file's name to Main Form.vb. Change the form's name to frmMain. Create the interface shown in Figure 3-37. The interface contains six labels, three text boxes, and two buttons. The application calculates and displays the total number of packs ordered...

  • Visual Basic Programming Step 1-2 not important, it's just file naming. 3. Form contains nine Labels,...

    Visual Basic Programming Step 1-2 not important, it's just file naming. 3. Form contains nine Labels, one TextBox, and three Button controls. You use labels to let user know what to enter and what will be displayed; TextBoxes to input a number between 1 and 99. Buttons to Calculate change. Clear Input and Exit program. See below Form Layout with Controls for more details 4. Declare variables to store the entered value in TextBox, and what will be displayed in...

  • Hello, I need assistance with my assignment please in Visual Basic. Starting Out With Visual Basic...

    Hello, I need assistance with my assignment please in Visual Basic. Starting Out With Visual Basic Seventh Edition Chapter 5 Programming Challenge #1. Sum Of Numbers... page 370 Create an application that displays a form similar to the one shown in Figure 5-44. When the Enter Numbers button is clicked, the application should display the input box shown in Figure 5-45. The input box asks the user to enter a positive integer value. Notice that the default input value is...

  • Create a database in visual basic using sql server to use bound text boxes and combo boxes Please...

    Create a database in visual basic using sql server to use bound text boxes and combo boxes Please show step by step with photos

  • C# Visual Studios Create a GUI application that prompts users to enter a ten (10) digit...

    C# Visual Studios Create a GUI application that prompts users to enter a ten (10) digit phone number, with hyphens and parentheses included – this input should be validated as a phone number adhering to the (XXX)-XXX-XXXX format. Should the user input an incorrect format, an error message should print to screen and your phone number textbox should be highlighted in red. Should an appropriately formatted phone number be entered, an acceptance message should printed to screen and your phone...

  • VISUAL BASIC- create a program for managing a "To Do" list. The program will need to...

    VISUAL BASIC- create a program for managing a "To Do" list. The program will need to read and update a text file named ToDoList.txt. The record structure of the file must be: 1) sort order, 2) task name and 3) desired completion date. When the program starts, it should read the contents file into a structure. The information should then be displayed in a data grid view. The data should be initially sorted by the sort order value. Afterwards, the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT