VERSION 5.00 Begin VB.Form frmOpslaan BorderStyle = 1 'Fixed Single Caption = "Opslaan" ClientHeight = 5565 ClientLeft = 45 ClientTop = 435 ClientWidth = 8895 ClipControls = 0 'False ControlBox = 0 'False Icon = "frmOpslaan.frx":0000 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 5565 ScaleWidth = 8895 StartUpPosition = 2 'CenterScreen Begin VB.Frame Frame1 Caption = "Selecteer de doellocatie" Height = 5295 Left = 120 TabIndex = 0 Top = 120 Width = 8655 Begin VB.TextBox txtLogBestand Height = 375 Left = 3720 TabIndex = 8 Text = "output_verwijderde_profielen.csv" Top = 3120 Width = 4815 End Begin VB.TextBox txtProfielen Height = 375 Left = 3720 TabIndex = 4 Text = "output_profiel.csv" Top = 2400 Width = 4815 End Begin VB.CommandButton cmdStop Caption = "Stop" Enabled = 0 'False Height = 495 Left = 3720 TabIndex = 6 Top = 4560 Width = 4815 End Begin VB.DirListBox Dir1 Height = 4365 Left = 120 TabIndex = 2 ToolTipText = "Selecteer hier de map" Top = 720 Width = 3495 End Begin VB.DriveListBox Drive1 Height = 315 Left = 120 TabIndex = 1 ToolTipText = "Selecteer hier de (netwerk) drive" Top = 360 Width = 3495 End Begin VB.FileListBox File1 Height = 1650 Left = 3720 Pattern = "*.txt;*.xyz;*.asc;*.csv" TabIndex = 3 ToolTipText = "Selecteer hier het bestand" Top = 360 Width = 4815 End Begin VB.CommandButton cmdOpslaan Caption = "Opslaan" Height = 495 Left = 3720 TabIndex = 5 Top = 3840 Width = 4815 End Begin VB.Label Label3 AutoSize = -1 'True Caption = "Naam doelbestand overzicht verwijderde profielen:" Height = 195 Left = 3720 TabIndex = 9 Top = 2880 Width = 3570 End Begin VB.Label Label1 Caption = "Naam doelbestand profielen:" Height = 255 Left = 3720 TabIndex = 7 Top = 2160 Width = 3255 End End End Attribute VB_Name = "frmOpslaan" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub cmdOpslaan_Click() 'Declareer locale variabelen Dim tellerEen, tellerTwee, tellerDrie, tellerVier, aantalPuntenRegel As Long Dim directoryPathPL, directoryPathProfiel, directoryPathLogBestand, outputProfiel, outputPL, tempVarPL, tempVarProfiel, outputLogBestand Dim xOld, yOld, xNew, yNew As Double Dim i As Integer 'Set trap 'On Error GoTo errorHandler 'Bewaar de geselecteerde bestandsnaam outputProfiel = txtProfielen.Text outputLogBestand = txtLogBestand.Text directoryPathProfiel = File1.Path + "\" + outputProfiel directoryPathLogBestand = File1.Path + "\" + outputLogBestand 'Tijdelijke code om resultaat in bestand te laten zien Open directoryPathProfiel For Output As #1 'Set de initialisatie waarde tellerDrie = 2 For tellerEen = 1 To aantalProfielen 'Schrijf profielregel weg For tellerTwee = 2 To totaalAantalKolommen - 2 If arrayProfielen(tellerEen, tellerTwee) = "" Then Exit For tempVar = arrayPuntCode(tellerEen, tellerDrie) & Chr(9) & arrayPuntCode(tellerEen, tellerDrie + 1) & Chr(9) & arrayProfielen(tellerEen, tellerTwee) & Chr(9) & arrayProfielen(tellerEen, tellerTwee + 1) & Chr(9) & arrayProfielen(tellerEen, tellerTwee + 2) & Chr(9) & arrayProfielen(tellerEen, 1) Print #1, tempVar 'Verhoog de tellers om weer op de juiste locatie terug te keren tellerDrie = tellerDrie + 2 tellerTwee = tellerTwee + 2 Next tellerTwee 'Set de initialisatie waarde tellerDrie = 2 Next tellerEen 'Schrijf de process log weg Open directoryPathLogBestand For Output As #3 Print #3, "profielnaam;sloot_aanwezig;aantal_insteekpunten_sloot;taludhellingen_aangepast;sloot_aangemaakt;Boezem_aanwezig;Damwand_aanwezig" For tellerEen = 1 To aantalProfielen For tellerTwee = 1 To aantalKolommenArrayProcessLog If tellerTwee = 1 Then tempVar = arrayProcessLog(tellerEen, tellerTwee) Else tempVar = tempVar & ";" & arrayProcessLog(tellerEen, tellerTwee) End If Next tellerTwee Print #3, tempVar Next tellerEen Close #3 'Sluit de bestanden Close #1 'Geef aan dat het opslaan gelukt is i = MsgBox("Bestanden zijn opgeslagen.", vbOKOnly, "Bestand opgeslagen") 'Activeer de stopknop cmdStop.Enabled = True 'Voorkom dat onnodig de errorHanlder wordt uitgevoerd Exit Sub 'Trap errorHandler: 'Toon waarschuwing i = MsgBox("Fout bij het opslaan, controleer bestandsnaam", vbCritical, "Fout!") 'sluit bestanden Close #1 End Sub Private Sub cmdStop_Click() 'Declareer locale variabelen Dim i i = MsgBox("Weet u zeker dat u wilt stoppen?", vbYesNo, "Let op!") If i = vbYes Then 'Stop het programma End End If End Sub Private Sub Dir1_Change() 'Update de file structuur als het path wordt veranderd File1.Path = Dir1.Path End Sub Private Sub Drive1_Change() Dim i As Integer Dim tempDrive 'Set error trap On Error GoTo errorHandler 'Update de dir structuur als de drive wordt veranderd Dir1.Path = Drive1.Drive 'Voorkom dat de errorHandler zonder reden wordt uitgevoerd Exit Sub 'Trap errorHandler: 'Toon waarschuwing i = MsgBox("Kan niet lezen vanaf het geselecteerde station, kies een ander station", vbCritical, "Leesfout!") End Sub Private Sub Frame2_DragDrop(Source As Control, X As Single, Y As Single) End Sub Private Sub Form_Load() 'Toon voorstel voor de bestandsnamen txtProfielen.Text = "output_profiel_" & kadeTraject txtLogBestand.Text = "output_process_log_" & kadeTraject 'Als het aantalverwijderde profielen groter is dan 0, dan kan het log bestan dopgeslagen worden If aantalVerwijderdeProfielen > 0 Then txtLogBestand.Enabled = True End If End Sub