satriano17
Gebruiker
- Lid geworden
- 30 sep 2012
- Berichten
- 331
VB6
dag ik heb een klein probleem.
Ik heb een textfile met 2 textboxen + 1 image
Mijn doel:
De file opslaan met naam.
De image opslaan met hetzelfde naam van de file in de default map (DiagnoseArchief)
Is bijna alles gelukt. De file wordt opgeslaan. De image ook.
Enige probleem , de image wordt wel opgeslaan in de default map maar krijgt geen (file) naam. Wordt opgeslaan zonder naam.
Ik denk aan constructiefout
Hier mijn code
error zit natuurlijk in
dag ik heb een klein probleem.
Ik heb een textfile met 2 textboxen + 1 image
Mijn doel:
De file opslaan met naam.
De image opslaan met hetzelfde naam van de file in de default map (DiagnoseArchief)
Is bijna alles gelukt. De file wordt opgeslaan. De image ook.
Enige probleem , de image wordt wel opgeslaan in de default map maar krijgt geen (file) naam. Wordt opgeslaan zonder naam.
Ik denk aan constructiefout
Hier mijn code
Code:
' file load
Private Sub Command1_Click()
On Error Resume Next ' load
Dim Slash As String
Dim tekst As String, kFile As String
CommonDialog1.Filter = "Text Files (*.txt)|*.txt"
MkDir App.Path & "\DiagnoseArchief\" '
CommonDialog1.Filter = "Tekst|*.txt"
If Right(App.Path, 1) <> "\" Then Slash = "\"
CommonDialog1.InitDir = App.Path & Slash & "DiagnoseArchief"
CommonDialog1.FileName = App.Path & Slash & "DiagnoseArchief" & "\*.txt"
CommonDialog1.ShowOpen
Open CommonDialog1.FileName For Input As #1
tekst = ""
Do Until EOF(1)
Line Input #1, kFile
tekst = tekst & kFile & vbCrLf
Line Input #1, kFile
tekst = testo2 & kFile & vbCrLf
Loop
Text1.Text = tekst
Text2.Text = tekst2
Close #1
Image1.Picture = LoadPicture(App.Path & "\DiagnoseArchief\" & CommonDialog1.FileName & ".bmp")
End Sub
'save file .txt
Private Sub Command2_Click()
CommonDialog1.Filter = "Text Files (*.txt)|*.txt"
On Error Resume Next ' save
Dim Slash As String
'On Error Resume Next
MkDir App.Path & "\DiagnoseArchief" ' qui ho aggiunto
On Error Resume Next
CommonDialog1.Filter = "Tekst|*.txt"
If Right(App.Path, 1) <> "\" Then Slash = "\"
CommonDialog1.InitDir = App.Path & Slash & "DiagnoseArchief"
CommonDialog1.FileName = App.Path & Slash & "DiagnoseArchief" & "\*.txt"
CommonDialog1.ShowSave
Open CommonDialog1.FileName For Output As #1
Print #1, Text1.Text
Print #1, Text2.Text
Close #1
SavePicture Image1.Picture, (App.Path & "\DiagnoseArchief\" & CommonDialog1.FileName & ".bmp")
End Sub
'Hier laad ik een afb in de image
Private Sub Command3_Click()
CommonDialog1.InitDir = "c:\"
CommonDialog1.FileName = ""
CommonDialog1.Filter = "Graphics|*.bmp;*.jpg;*.jpeg"
CommonDialog1.ShowOpen
Image1.Picture = LoadPicture(CommonDialog1.FileName)
End Sub
Code:
SavePicture Image1.Picture, (App.Path & "\DiagnoseArchief\" & CommonDialog1.FileName & ".bmp")
Laatst bewerkt: