Students make many errors in visual programming. In order to learn from these, it is important that students regulate their emotions and view errors as learning opportunities. This study aimed to explore to what extent momentary emotions, specifically enjoyment, anxiety and boredom, as well as the error learning orientation of students, interacted during a 1-day course on visual programming in an out-of-school learning environment. The sample consisted of 269 lower secondary school students (grades 7-9). The data were collected in an intervention study, with questionnaires applied directly before and after the course, and with four measurements of state emotions during the course. The results showed that error learning orientation had an expected effect on the students' emotions at the beginning of the course. The emotions changed positively over the course of the workshop, while the error learning orientation remained stable. No differences in error learning orientation were found between the control and intervention groups. An expected, reciprocal effect of students' emotions on their error learning orientation at the end of the course day could not be found. Changes in error learning orientation are difficult to achieve during 1-day courses. Nevertheless, through targeted, pedagogical approaches, which aim to minimize the influence of unfavourable emotions that occur in problem-oriented learning situations, teachers could help students develop a positive error learning orientation in the long term, whereby errors are viewed as an opportunity for learning.