473,406 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Please help

I am in a beginers visual basic class and need help with a program. it is a basic program and the trouble i have is that after i export the fields into notepad, i need the fields to be cleared. i have no idea how to get the fields cleared!!!! any possible information would be much appreciated. i have searched everywhere and can not find an answer. thanks in advance...

heres my program so far....

'Team 14
'This program accepts name and address information from the user.
Option Explicit
Private intFileNumber As Integer

Private Sub cmdEnter_Click()
Dim strName As String * 30
Dim strAddress As String * 35
Dim strCity As String * 25
Dim strState As String * 2
Dim strZip As String * 5
Dim strAccount As String * 6
Dim strBalance As String * 7
Dim curBalance As Currency
Dim lngBalance As Long
strName = txtName.Text
strAddress = txtAddress.Text
strCity = txtCity.Text
strState = txtState.Text
strZip = txtZip.Text
strAccount = txtAccount.Text
curBalance = CCur(txtBalance.Text)
lngBalance = curBalance * 100
strBalance = (7)
RSet strBalance = CStr(lngBalance)
strBalance = Replace(strBalance, " ", "0")
Print #intFileNumber, strName; strAddress; strCity; strState; strZip; strAccount; strBalance
End Sub

Private Sub cmdExit_Click()
Unload Me
End Sub

Private Sub Form_Load()
Dim strFileName As String
intFileNumber = FreeFile
strFileName = App.Path & "\Something.txt"
Open strFileName For Output As #intFileNumber
End Sub

Private Sub Form_Unload(Cancel As Integer)
Close #intFileNumber
End Sub
Oct 3 '06 #1
5 1214
Banfa
9,065 Expert Mod 8TB
I know little about Visual Basic but I reckon

txtName.Text = ""

may do it
Oct 4 '06 #2
Seith
16
Yeh, he's right although you don't need .text becuase it assumes that's what you mean:


text_box_name = ""

This will replace the textbox with [ ]

And so far your program looks great :}
Oct 5 '06 #3
Seith
16
Yeh, he's right although you don't need .text becuase it assumes that's what you mean:


text_box_name = ""

This will replace the textbox with [ ]

And so far your program looks great :}
No edits snarl

Okay, so I loaded up your application - but it doesn't acutally write to something.txt? Just in case you didn't know?
Oct 5 '06 #4
Seith
16
Stupid 5 Minute Edit thing!

Okay, I fixed your program for you if you're interested:

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdEnter_Click()
  2.     Dim intFileNumber As Integer
  3.     Dim strFileName As String
  4.     Dim strName As String * 30
  5.     Dim strAddress As String * 35
  6.     Dim strCity As String * 25
  7.     Dim strState As String * 2
  8.     Dim strZip As String * 5
  9.     Dim strAccount As String * 6
  10.     Dim strBalance As String * 7
  11.     Dim curBalance As Currency
  12.     Dim lngBalance As Long
  13.  
  14.     Open strFileName For Output As #intFileNumber
  15.  
  16.         intFileNumber = FreeFile
  17.         strFileName = App.Path & "\Something.txt"
  18.         strName = txtName.Text
  19.         strAddress = txtAddress.Text
  20.         strCity = txtCity.Text
  21.         strState = txtState.Text
  22.         strZip = txtZip.Text
  23.         strAccount = txtAccount.Text
  24.  
  25.         curBalance = CCur(txtBalance.Text)
  26.         lngBalance = curBalance * 100
  27.         strBalance = (7)
  28.         RSet strBalance = CStr(lngBalance)
  29.         strBalance = Replace(strBalance, " ", "0")
  30.  
  31.     Print #intFileNumber, strName & vbCrLf & strAddress & vbCrLf & strCity & vbCrLf & strState & vbCrLf & strZip & vbCrLf & strAccount & vbCrLf & strBalance
  32.     Close #intFileNumber
  33. End Sub
Changes:
All variables are set in the command button.
I added vbCrLf into the Print section, this means it will put a new line for each entry - vbCrLf means RETURN key.
You didn't set 2 of the variables correctly, you missed Dim for some reason?
The command button OPENS EDITS then CLOSES the document, otherwise it'll try to re-open an open file! If you want to use an if statement here, do so!

Now, after Close #intFileNumber you want to write:
Expand|Select|Wrap|Line Numbers
  1.         txtName.Text = ""
  2.         txtAddress.Text = ""
  3.         txtCity.Text = ""
  4.         txtState.Text = ""
  5.         txtZip.Text = ""
  6.         txtAccount.Text = ""
To reset all the fields

Have fun, more questions just reply!
Oct 5 '06 #5
Thank you, every post has been very helpful. I appreciate everybody's help!!!
Oct 6 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Kurt Watson | last post by:
I’m having a different kind of problem with Hotmail when I sign in it says, "Web Browser Software Limitations Your Current Software Will Limit Your Ability to Use Hotmail You are using a web...
7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
7
by: tyler_durden | last post by:
thanks a lot for all your help..I'm really appreciated... with all the help I've been getting in forums I've been able to continue my program and it's almost done, but I'm having a big problem that...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
13
by: Joner | last post by:
Hello, I'm having trouble with a little programme of mine where I connect to an access database. It seems to connect fine, and disconnect fine, but then after it won't reconnect, I get the error...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
1
PEB
by: PEB | last post by:
POSTING GUIDELINES Please follow these guidelines when posting questions Post your question in a relevant forum Do NOT PM questions to individual experts - This is not fair on them and...
0
by: 2Barter.net | last post by:
newsmail@reuters.uk.ed10.net Fwd: Money for New Orleans, AL & GA Inbox Reply Reply to all Forward Print Add 2Barter.net to Contacts list Delete this message Report phishing Show original
6
by: jenipriya | last post by:
Hi all... its very urgent.. please........i m a beginner in oracle.... Anyone please help me wit dese codes i hv tried... and correct the errors... The table structures i hav Employee (EmpID,...
5
by: tabani | last post by:
I wrote the program and its not giving me correct answer can any one help me with that please and specify my mistake please it will be highly appreciable... The error arrives from option 'a' it asks...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.