Wrox Programmer Forums
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 12th, 2011, 10:12 PM
Registered User
Join Date: May 2011
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Textbox info to txt file name

I am working on a project and Im trying to figure out somthing.
I am trying to create a text file using the info that the user inputs
Ex. the user enters thier name in a text box hits the save button and it creates a file called name.txt I have it saving but cant make it save as a .txt file everytime I open the file I have to choose a program to open it with.

Here is an Example of the code:

strFilename = "C:\Users\Desktop\" & Last_NameTextBox.Text

It saves the file as the info I enter but no extention so it dont know what to open the file with

any suggestions
Thank you
Old May 13th, 2011, 05:06 AM
Authorized User
Join Date: Jan 2011
Posts: 86
Thanks: 1
Thanked 12 Times in 12 Posts


looks like you forgot to append the txt file extension to your filename variable.

Please try it like this:
strFilename = @"C:\Users\Desktop\" & Last_NameTextBox.Text & ".txt"
Hope this helps.
Old May 14th, 2011, 08:54 PM
Registered User
Join Date: May 2011
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts

Thank you that is exactly What I was missing

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple txt file input to excel in 1 row per file vickyso88 Excel VBA 3 August 24th, 2009 02:11 PM
read any ".txt" file RodrigoGuteriez C# 3 November 18th, 2008 01:07 PM
Reading txt file umeshtheone SQL Server 2000 9 May 15th, 2007 12:43 AM
How Can I Add Info From a Txt File Into a DB? Lucy Classic ASP Professional 3 October 21st, 2003 11:00 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.