When i start the .exe and click the first time the listview, it starts the calculation for that period and al works fine.
Direct after ending the calculation i chose an other company and click the listview again. Then i get the error.
Sorry, i do not know how to post the code on the right way. I found out!
Thans for your help.
Herman
Code:
Private Sub LvTijdvakken_Click()
' On Error GoTo Foutje
'On Error Resume Next
LvTijdvakken.HideSelection = False
If Val(LvTijdvakken.SelectedItem.Text) <= 0 Then
Exit Sub
End If
Z = LvTijdvakken.SelectedItem.Index
If Z < 1 Or Z > LvTijdvakken.ListItems.Count Then Exit Sub
If GetSetting("HataSal", "LoonRun", "Vakantiegeld") > "" Then
' 'debug.print GetSetting("HataSal", "LoonRun", "Vakantiegeld")
DeleteSetting "HataSal", "LoonRun", "Vakantiegeld"
End If
frmLoonberekeningStart.txtLoonTijdVak(0) = LvTijdvakken.SelectedItem.Text
frmLoonberekeningStart.txtLoonTijdVak(1) = LvTijdvakken.SelectedItem.SubItems(1)
frmLoonberekeningStart.txtLoonTijdVak(2) = LvTijdvakken.SelectedItem.SubItems(2)
VulWerknemersListBox
Bewerking = "LvTijdvakken_Click 01 "
frmLoonberekeningStart.cmdTijdvakAkkoord.Enabled = True
frmLoonberekeningStart.cmdTijdvakVerijderen.Enabled = True
Temp1 = Trim(Left(frmLoonberekeningStart.txtLoonTijdVak(0).Text, 2))
LoonBestand = WgBestandsPad & "\lonen" & Temp1 & "." & Trim(SalarisJaar)
If FileExist(LoonBestand) Then
frmLoonberekeningStart.cmdTijdvakAkkoord.Caption = "Bewerken"
frmLoonberekeningStart.FrameBerekenenWerknemers.Visible = False
frmLoonberekeningStart.Label1.Visible = True
Else
frmLoonberekeningStart.cmdTijdvakAkkoord.Caption = "Aanmaken"
frmLoonberekeningStart.FrameBerekenenWerknemers.Visible = True
frmLoonberekeningStart.Label1.Visible = False
End If
If Val(frmLoonberekeningStart.txtLoonTijdVak(0).Text) = Val(Wg.VakGeldBetalen1) Then
If Not IsDate(LvTijdvakken.SelectedItem.SubItems(4)) Then
frmVakantiegeld.Show
frmLoonberekeningStart.Enabled = False
End If
End If
If Val(frmLoonberekeningStart.txtLoonTijdVak(0).Text) = Val(Wg.VakGeldBetalen2) Then
If Not IsDate(LvTijdvakken.SelectedItem.SubItems(4)) Then
frmVakantiegeld.Show
frmLoonberekeningStart.Enabled = False
End If
End If
If WekenControle = False Then
Unload frmLoonberekeningStart
Set frmLoonberekeningStart = Nothing
OpenMenu
End If
Exit Sub
Foutje:
Foutmeldingen
End Sub
Last edited by HermanTabbert; January 23rd, 2014 at 05:23 AM.
I think you need to describe better what you are seeing, if you are getting an error message tell us what the actual error message is. I can't determine anything by what you have posted.
BTW there is no error 0 an err number of 0 means no error occured
I start my program to calculate the wages for a employer .
I select a period and calculate. No problem at all.
When ready i go to the main menu and select a second employer, load the form where i can select the period. When selecting the period the error shows and the program stops.
Start the program again and load the form where i can select the period. When selecting the period it works fine.
So in short:
start the program
Main menu shows
Select employer
Load for to select period
Select period and calculation takes place correctly
Back to mainmenu
Select employer
Load for to select period
Select period and the error shows.
I start my program to calculate the wages for a employer .
I select a period and calculate. No problem at all.
When ready i go to the main menu and select a second employer, load the form where i can select the period. When selecting the period the error shows and the program stops.
Start the program again and load the form where i can select the period. When selecting the period it works fine.
So in short:
start the program
Main menu shows
Select employer
Load for to select period
Select period and calculation takes place correctly
Back to mainmenu
Select employer
Load for to select period
Select period and the error shows.
There is no error 0
There would also be a message with any runtime error
Your screen shot appears to be a message that you are creating and displaying, no indication of any actual error and the code that displays that message is not in the code block you posted.
If you are running in the IDE and a run time error occurs it will show you which line the error occurs on and there is always a description along with the number.
'Private Sub LvTijdvakken_GotFocus()
'Debug.Print LvTijdvakken.ListItems.Count
'If Z > 0 Then
' Set LvTijdvakken.SelectedItem = LvTijdvakken.ListItems(Z) 'LvTijdvakken.ListItems(3)
'End If
'End Sub
When lvtijdvakken got the focus z had no value
Took it out and placed it in the the click sub and now it works fine.
Thank for your help.
Herman
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.