Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8337463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:18:44+00:00 2026-06-09T04:18:44+00:00

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim FILE_NAME

  • 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim FILE_NAME As String = "C:\KVRequest.txt"
    Dim aryText(4) As String

    aryText(0) = "TextBox4.Text"
    aryText(1) = "TextBox5.Text"
    aryText(2) = "TextBox6.Text"
    aryText(3) = "TextBox7.Text"
    aryText(4) = "TextBox8.Text"

    Dim objWriter As New System.IO.StreamWriter(FILE_NAME, True)

    objWriter.Close()
    MsgBox("Text file created in your C drive, attach this file in an email to someone@gmail.com Please check that all of the details are correct before sending.")

End Sub

What I am trying to do is get the text from the text boxes (4 5 6 7 8) to write into a text file. The code I have creates the file, but does not write text into it, can anyone give me a tip on how to get this working?

Thanks!

Edit: Also while I am here, I was trying to get it so button_1.enabled was only true if all of the text boxes had been edited, but I could not think of a practical way to do this, if you could help me with this I would also be very grateful!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:18:47+00:00Added an answer on June 9, 2026 at 4:18 am

    Given the code posted above, the reason nothing is being written to the file is because you’re not telling it to write anything to the file. You would need to add something like this between the creation of your StreamWriter and where you close the close method on it:

    objWriter.WriteLine(TextBox4.Text)
    objWriter.WtiteLine(TextBox5.Text)
    etc...
    

    Also, the simplest option for only enabling the save button is to create a Control.TextChanged handler for each of your text boxes (or use the one Sub to do it for all of them by adding all their events to the one handler method) and have it do something similar to:

    If TextBox4.Text <> "" And TextBox5.Text <> "" And TextBox6.Text <> "" Then
        Button1.Enabled = True
    Else
        Button1.Enabled = False
    End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click CheckBox1.Checked =
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress Dim allowedChars
My Code: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
NET WinForms. VB code: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim de As New System.DirectoryServices.DirectoryEntry() Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
I have the current code: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
Using this in VB 2010: Imports System.Text.RegularExpressions Public Class Form1 Private Sub Button1_Click(ByVal sender
I have event Button that creates text box in run time. Private Sub Button1_Click(ByVal
I have a simple program that checks webpages for strings, example: Private Sub Button1_Click(ByVal
I currently have this code : Private Sub Worksheet_Change(ByVal Target As Range) Dim lastrow

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.