3 Replies - 1423 Views - Last Post: 11 December 2008 - 07:57 AM Rate Topic: -----

#1 mike_heim  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 04-December 08

editing a txt file outside the form

Posted 09 December 2008 - 01:47 PM

im working on an argos style program and ive created a program which displays the item description from a .txt file when the clcik the items button which is working fine.

but i need a management feature on it which allows you to enter a password and it allows you to edit item descriptions. ive got the password bit working im just strugling on how to edit a .txt file from inside the form



Private Sub cmdI1_Click()
Dim tmp As String
Dim item1 As String

Open "I:\item1.txt" For Input As #1
While EOF(1) = 0
	Line Input #1, tmp
	item1 = item1 + tmp & vbNewLine
Wend
Close #1
MsgBox item1
End Sub

Private Sub cmdI10_Click()
Dim tmp As String
Dim item10 As String

Open "I:\item10.txt" For Input As #1
While EOF(1) = 0
	Line Input #1, tmp
	item10 = item10 + tmp & vbNewLine
Wend
Close #1
MsgBox item10
End Sub

Private Sub cmdI2_Click()
Dim tmp As String
Dim item2 As String

Open "I:\item2.txt" For Input As #1
While EOF(1) = 0
	Line Input #1, tmp
	item2 = item2 + tmp & vbNewLine
Wend
Close #1
MsgBox item2
End Sub

Private Sub cmdI3_Click()
Dim tmp As String
Dim item3 As String

Open "I:\item3.txt" For Input As #1
While EOF(1) = 0
	Line Input #1, tmp
	item3 = item3 + tmp & vbNewLine
Wend
Close #1
MsgBox item3

End Sub

Private Sub cmdI4_Click()
Dim tmp As String
Dim item4 As String

Open "I:\item4.txt" For Input As #1
While EOF(1) = 0
	Line Input #1, tmp
	item4 = item4 + tmp & vbNewLine
Wend
Close #1
MsgBox item4
End Sub

Private Sub cmdI5_Click()
Dim tmp As String
Dim item5 As String

Open "I:\item5.txt" For Input As #1
While EOF(1) = 0
	Line Input #1, tmp
	item5 = item5 + tmp & vbNewLine
Wend
Close #1
MsgBox item5
End Sub

Private Sub cmdI6_Click()
Dim tmp As String
Dim item6 As String

Open "I:\item6.txt" For Input As #1
While EOF(1) = 0
	Line Input #1, tmp
	item6 = item6 + tmp & vbNewLine
Wend
Close #1
MsgBox item6
End Sub

Private Sub cmdI7_Click()
Dim tmp As String
Dim item7 As String

Open "I:\item7.txt" For Input As #1
While EOF(1) = 0
	Line Input #1, tmp
	item7 = item7 + tmp & vbNewLine
Wend
Close #1
MsgBox item7
End Sub

Private Sub cmdI8_Click()
Dim tmp As String
Dim item8 As String

Open "I:\item8.txt" For Input As #1
While EOF(1) = 0
	Line Input #1, tmp
	item8 = item8 + tmp & vbNewLine
Wend
Close #1
MsgBox item8
End Sub

Private Sub cmdI9_Click()
Dim tmp As String
Dim item9 As String

Open "I:\item9.txt" For Input As #1
While EOF(1) = 0
	Line Input #1, tmp
	item9 = item9 + tmp & vbNewLine
Wend
Close #1
MsgBox item9
End Sub



Private Sub cmdSecurity_Click()
Dim password As Integer
Dim pass As Integer



password = 1234
pass = 0
pass = InputBox("enter password", "password")

Do
	If pass <> password Then
		MsgBox ("incorrect password")
			pass = InputBox("enter password", "password")
	End If
Loop While pass <> password
	
Do
	If pass = password Then
		
	
End Sub



Is This A Good Question/Topic? 0
  • +

Replies To: editing a txt file outside the form

#2 VB Crash  Icon User is offline

  • D.I.C Head

Reputation: 9
  • View blog
  • Posts: 130
  • Joined: 28-November 08

Re: editing a txt file outside the form

Posted 10 December 2008 - 01:30 AM

Could you pelase explain me a littile bit more about your program

Vace
Was This Post Helpful? 0
  • +
  • -

#3 mike_heim  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 04-December 08

Re: editing a txt file outside the form

Posted 10 December 2008 - 10:39 AM

View PostVB Crash, on 10 Dec, 2008 - 12:30 AM, said:

Could you pelase explain me a littile bit more about your program

Vace



ye well i have ten buttons shown in the code i posted which each load text from seperate text files into a message box when clicked. the buttons are for different items so each text file has a different item description in it.

the cmdSecurity button at the bottom of the code is a management feature where when you click the button you have to enter a password and if the password is correct it should allow you to edit the item descriptions. im just not sure how to do the last bit of editing the descriptions that are store in .txt files
Was This Post Helpful? 0
  • +
  • -

#4 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Re: editing a txt file outside the form

Posted 11 December 2008 - 07:57 AM

You might find this tutorial useful.
File Handling in Visual Basic 6 Part 1 - Sequential Files
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1