Question

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.

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

Dear Student ,

As per requirement submitted above , kindly find below solution.

Here a new Windows Forms Application in VB is created using Visual Studio 2019 with name "UserDetailsApplication".This application contains Form with name "Form1.vb".Below are the files associated with Form1.vb

1.Form1.vb[Design]

2.Form1.vb

Imports System.IO
Public Class Form1 'VB Class
'Button save click
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
'taking name entered by user
Dim name As String = txtName.Text
'taking gender selected by user
Dim gender As String
If rbtMale.Checked Then
gender = "Male" 'set gender
Else
gender = "Female"
End If
'taking email entered by user
Dim email As String = txtEmail.Text
'taking age entered by user
Dim age As Integer = Integer.Parse(txtAge.Text)
'creating object of
Dim sw As New StreamWriter("info.txt")
sw.WriteLine("Name : " & name) 'write name
sw.WriteLine("Gender : " & gender) 'write gender
sw.WriteLine("Age : " & age) 'write age
sw.WriteLine("Email : " & email) 'write email
sw.Close() 'close file
'display successful message
MessageBox.Show("Information written to the file")
clear() 'used to clear textboxes
End Sub
'Exit button click
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub
'method to clear textboxes
Public Sub clear()
txtName.Text = ""
txtAge.Text = ""
txtEmail.Text = ""
End Sub

End Class

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

Output :Compile and Run above application to get the screen as shown below

Screen 1 :

Screen 2:

Screen 3:info.txt

Add a comment
Know the answer?
Add Answer to:
In Visual Basic. Thank you in advance! Visual Basic File access Create a form that allow...
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
  • 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.

  • 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...

  • 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...

  • 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...

  • 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...

  • 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...

  • Visual Basic Programming Step 1-2 not important, it's just file naming.

    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...

  • UNIX File Permission help, please answer the questions in the green boxes. Thank you Lab 03...

    UNIX File Permission help, please answer the questions in the green boxes. Thank you Lab 03 File Permissions In this lab we will: learn about file permissions learn to create symbolic links and hard links Utilities that will be utilized in this Lab: us, cd, less, cat touch, chmod id umask, mkdir, In, echo and redirection Users and Groups Linux supports several methods of controlling access to files an directories. In this lab we are going to learn the traditional...

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
ADVERTISEMENT