none
Step by step method is working but normal mode is not working RRS feed

  • Question

  • Hello everyone,

    On my program, I'm still debugging so I tried the step by step way and it worked!
    So since it works on step by step, I should try the same example with the normal mode.

    And suddenly it doesn't work, it goes on my error trap and doesn't continue.

    So I go on step by step to see where the error is, and it works fine, no error this time.

    So normal mode and once again, it doesn't work.

    Why does the step by step works while the normal mode is not working when I ask the program to do the exact same thing?

    Best regards

    Friday, September 9, 2016 12:25 PM

Answers


  • I have no idea how to do that but maybe...

    If you open it in Excel, one of the options is to save  it as a different type and you're given a lot of options.

    It might not lend well to a delimited file but if so, then I'll help you take it from that point to wherever it's back on your end again - maybe. It sounds like it's been long in development so I don't know that want to jump in at this point, but that would eliminate the Excel out of this and the rest is then in VB.

    Is that something that seems plausible? I don't want to offer something then realize that I just offered a year's work - I have a real job too. ;-)


    Some people succeed because they were destined to, but most people succeed because they were determined to.

    Friday, September 9, 2016 2:41 PM

All replies

  • Hello everyone,

    On my program, I'm still debugging so I tried the step by step way and it worked!
    So since it works on step by step, I should try the same example with the normal mode.

    And suddenly it doesn't work, it goes on my error trap and doesn't continue.

    So I go on step by step to see where the error is, and it works fine, no error this time.

    So normal mode and once again, it doesn't work.

    Why does the step by step works while the normal mode is not working when I ask the program to do the exact same thing?

    Best regards

    It's hard to know of course, but it sounds like there's an issue with time. By stepping through, you've slowed it down and it works.

    Explain more about what you have please?


    Some people succeed because they were destined to, but most people succeed because they were determined to.

    Friday, September 9, 2016 12:43 PM
  • It's a little bit complicated to explain what my program is doing but long story short: it's taking datas in an Excel file and it's converting it into another format for another software.

    How can I fix this problem?

    Friday, September 9, 2016 12:52 PM
  • It's a little bit complicated to explain what my program is doing but long story short: it's taking datas in an Excel file and it's converting it into another format for another software.

    How can I fix this problem?

    It's hard to say but it sounds like you're essentially going too fast for it.

    The first thing that comes to mind is using threading to "wait" for it to catch up - hopefully with some way to confirm that the operation has completed before going to the next part.


    Some people succeed because they were destined to, but most people succeed because they were determined to.

    Friday, September 9, 2016 12:56 PM
  • How can I make those wait/pauses then?

    Thanks for your answers though :)

    Friday, September 9, 2016 1:01 PM
  • How can I make those wait/pauses then?

    Thanks for your answers though :)

    Try this, but know this is temporary only.

    In your loop, use Threading.Thread.Sleep(100) and see if that makes it work. You might want to modify the number but don't set it to 0.

    Just for now, try that in your loop and see if that improved it at all? It's temporary though.


    Some people succeed because they were destined to, but most people succeed because they were determined to.

    Friday, September 9, 2016 1:05 PM
  • Ok I will try this, but I've got a bunch of loops so it may take a while to see where I have to put it.

    But if this is temporary, how can I find a definitive way of fixing the problem?

    Friday, September 9, 2016 1:09 PM
  • Ok I will try this, but I've got a bunch of loops so it may take a while to see where I have to put it.

    But if this is temporary, how can I find a definitive way of fixing the problem?

    If that works - and you can nail it down to which loop is causing it - then all of that may can be put on another thread. I don't know that it can or not, but that will let you know if it's a timing issue.


    Some people succeed because they were destined to, but most people succeed because they were determined to.

    Friday, September 9, 2016 1:11 PM
  • Ok I will try this, but I've got a bunch of loops so it may take a while to see where I have to put it.

    But if this is temporary, how can I find a definitive way of fixing the problem?

    Does whatever you're using (third party library maybe?) provide an event to let you know when it's done whatever it does?

    If it's third party stuff you might also want to contact them.


    Some people succeed because they were destined to, but most people succeed because they were determined to.

    Friday, September 9, 2016 1:14 PM
  • Nicolas,

    Can you tell what is working?

    1. If you step through it
    2. if you step through it, remove the breakpoint and then let it run.

    Mostly you are not able to really step through a program until the end, while a process which takes for you an eternity to step through are some microseconds for the computer. 


    Success
    Cor

    Friday, September 9, 2016 1:18 PM
  • Does whatever you're using (third party library maybe?) provide an event to let you know when it's done whatever it does?

    If it's third party stuff you might also want to contact them.


    Yes, my code is searching, among other things, if the type of component we are trying to convert is already in an xml library WE did.

    So my program is searching datas in an xml file and in an excel file.

    But I think the problem may be in the pick of infos in the excel file, but I don't have anything to tell me where

    Friday, September 9, 2016 1:18 PM
  • Does whatever you're using (third party library maybe?) provide an event to let you know when it's done whatever it does?

    If it's third party stuff you might also want to contact them.


    Yes, my code is searching, among other things, if the type of component we are trying to convert is already in an xml library WE did.

    So my program is searching datas in an xml file and in an excel file.

    But I think the problem may be in the pick of infos in the excel file, but I don't have anything to tell me where

    This is going to have to be re-thought out, honestly.

    It needs an event. It might a tenth of a second this time and three seconds the next time. The sleep is just a guess and not a fix.


    Some people succeed because they were destined to, but most people succeed because they were determined to.

    Friday, September 9, 2016 1:23 PM
  • Nicolas,

    Can you tell what is working?

    1. If you step through it
    2. if you step through it, remove the breakpoint and then let it run.

    Mostly you are not able to really step through a program until the end, while a process which takes for you an eternity to step through are some microseconds for the computer. 


    I can tell that the first part of my program is working because at one point I have a form showing up.
    So until this point, everything is fine, but after, I don't know what is not working because I have function inside function inside subs inside function...
    Friday, September 9, 2016 1:26 PM
  • This is going to have to be re-thought out, honestly.

    It needs an event. It might a tenth of a second this time and three seconds the next time. The sleep is just a guess and not a fix.

    Arf, this is a pain. I'm running out of time on my project and I was on the final stage of it!

    Friday, September 9, 2016 1:30 PM
  • This is going to have to be re-thought out, honestly.

    It needs an event. It might a tenth of a second this time and three seconds the next time. The sleep is just a guess and not a fix.

    Arf, this is a pain. I'm running out of time on my project and I was on the final stage of it!


    First, find the loop that's the culprit, then we'll work with it from there but ultimately it sounds like it needs to be thought out and refactored.

    Some people succeed because they were destined to, but most people succeed because they were determined to.

    Friday, September 9, 2016 1:32 PM
  • Actually, the errortrap is made that way:

            msgerr = "Caution! The program encounter a non compatible data with the specification: if keep up, the generated file may not be valid" & vbCrLf & "Do you want to qui the application?"
            If ((MsgBox(msgerr, MsgBoxStyle.YesNo, "Problem during the convert!")) = MsgBoxResult.Yes) Then
                Call outApplication()
            End If
    

    As you can see, this is not a "fatal" error, but it won't write anything on my final file.

    Is there a way of seeing which line created the error?
    A function or something I can insert somewhere?

    Friday, September 9, 2016 1:40 PM
  • Actually, the errortrap is made that way:

            msgerr = "Caution! The program encounter a non compatible data with the specification: if keep up, the generated file may not be valid" & vbCrLf & "Do you want to qui the application?"
            If ((MsgBox(msgerr, MsgBoxStyle.YesNo, "Problem during the convert!")) = MsgBoxResult.Yes) Then
                Call outApplication()
            End If

    As you can see, this is not a "fatal" error, but it won't write anything on my final file.

    Is there a way of seeing which line created the error?
    A function or something I can insert somewhere?


    Is that VB 6?

    Some people succeed because they were destined to, but most people succeed because they were determined to.

    Friday, September 9, 2016 1:42 PM
  • VB.Net, but there was a previous code that was working in VB6 on the same base (converting xml file into format) but since the new format is excel into wanted format, I had to make some modifications

    Friday, September 9, 2016 1:48 PM
  • VB.Net, but there was a previous code that was working in VB6 on the same base (converting xml file into format) but since the new format is excel into wanted format, I had to make some modifications

    That's odd looking code so I had to ask. I'm likely not going to be able to help here because it's really a mystery.

    Tell me what your program does? Not code talk, just regular talk. Maybe others can make suggestions but it sounds like something that's going to need to be reworked.


    Some people succeed because they were destined to, but most people succeed because they were determined to.

    Friday, September 9, 2016 1:50 PM
  • Ok, first to clarify: I'm a mechanical engineer in internship, but for my internship I have to do programming

    We have design of a piping circuit made in a CAD software but we have to take this piping design and analyze it into an analyzing software.
    So this piping circuit is composed of a lot of piping element who have their main characteristics inside an Excel file

    what my program is supposed to do: take the datas => see what kind of element it is, what are the next and previous element and calculate (for example length of pipe) => build the circuit in the format of the analyzing software


    Friday, September 9, 2016 1:58 PM
  • Ok, first to clarify: I'm a mechanical engineer in internship, but for my internship I have to do programming

    We have design of a piping circuit made in a CAD software but we have to take this piping design and analyze it into an analyzing software.
    So this piping circuit is composed of a lot of piping element who have their main characteristics inside an Excel file

    what my program is supposed to do: take the datas => see what kind of element it is, what are the next and previous element and calculate (for example length of pipe) => build the circuit in the format of the analyzing software


    Interesting indeed! I am also an ME!

    *****

    That aside though, why is Excel involved in this at all? Why not do the whole thing in VB?

    I'm guessing that this is long in the making? It sounds like it started a while back (like years ago)?


    Some people succeed because they were destined to, but most people succeed because they were determined to.

    Friday, September 9, 2016 2:03 PM
  • Interesting indeed! I am also an ME!

    *****

    That aside though, why is Excel involved in this at all? Why not do the whole thing in VB?

    I'm guessing that this is long in the making? It sounds like it started a while back (like years ago)?


    Some people succeed because they were destined to, but most people succeed because they were determined to.

    Nice!

    Well actually it's because the extraction of the data from the CAD software (CATIA) has to be to excel

    But the calculations are not done in the excel file but inside the memory of the computer

    The program existed 8 years ago and was working fine because it was made by someone who really know programming, but after the change of CAD software (previously CADDS) and the migration to windows 7, the program does not work anymore.
    So I'm in charge of update and adapt it.

    Friday, September 9, 2016 2:15 PM
  • Sounds to a 

    Try
    instructions
    Catch
    End Try 

    Somewhere in your code, do you have that?


    Success
    Cor

    Friday, September 9, 2016 2:18 PM
  • Sounds to a 

    Try
    instructions
    Catch
    End Try 

    Somewhere in your code, do you have that?


    Only one and in the part that is working (before the form shows up)
    Friday, September 9, 2016 2:19 PM

  • Well actually it's because the extraction of the data from the CAD software (CATIA) has to be to excel

    But the calculations are not done in the excel file but inside the memory of the computer

    The program existed 8 years ago and was working fine because it was made by someone who really know programming, but after the change of CAD software (previously CADDS) and the migration to windows 7, the program does not work anymore.
    So I'm in charge of update and adapt it.

    Let's hone in to your part of it.

    You have data that's presented in the form an XML file or stream, correct?

    Can you give me an overview of what that consists of?

    So you're reading this XML and from that ... doing ... what?


    Some people succeed because they were destined to, but most people succeed because they were determined to.

    Friday, September 9, 2016 2:19 PM
  • Sounds to a 

    Try
    instructions
    Catch
    End Try 

    Somewhere in your code, do you have that?


    Only one and in the part that is working (before the form shows up)

    Oh I missed that.

    Let's stop now! An empty catch is what Cor means - there's nothing at all between Catch and End Try?

    For now, comment out the Try/Catch/End Try block entirely and run it. Let's see what's going on.


    Some people succeed because they were destined to, but most people succeed because they were determined to.

    Friday, September 9, 2016 2:24 PM

  • Well actually it's because the extraction of the data from the CAD software (CATIA) has to be to excel

    But the calculations are not done in the excel file but inside the memory of the computer

    The program existed 8 years ago and was working fine because it was made by someone who really know programming, but after the change of CAD software (previously CADDS) and the migration to windows 7, the program does not work anymore.
    So I'm in charge of update and adapt it.

    Let's hone in to your part of it.

    You have data that's presented in the form an XML file or stream, correct?

    Can you give me an overview of what that consists of?

    So you're reading this XML and from that ... doing ... what?

    No, that's precisely the point, if I had an XML file, I wouldn't need  to make a new program.

    The file I'm using which contains the datas of the piping circuit is an Excel file, made that way:

    1 line per element and 1 cell per characteristic

    Characteristic extracted:
    -name of element
    -diameter of entry and exit of element
    -mass
    -Center of gravity
    -coordinates of entry
    Coordinates of exit

    So the program goes inside the excel file, take the first line, sees what type of element it is (straight pipe or curved), takes the characteristics, and then see the next and previous element to build the circuit

    Friday, September 9, 2016 2:28 PM
  • So the program goes inside the excel file...

    If I were doing this "for real" then I'd use a third party library (like Aspose) for this part.

    For now (maybe for a while), is it possible to export the Excel file to another format like a CSV for example?


    Some people succeed because they were destined to, but most people succeed because they were determined to.

    Friday, September 9, 2016 2:32 PM
  • Sounds to a 

    Try
    instructions
    Catch
    End Try 

    Somewhere in your code, do you have that?


    Only one and in the part that is working (before the form shows up)

    Oh I missed that.

    Let's stop now! An empty catch is what Cor means - there's nothing at all between Catch and End Try?

    For now, comment out the Try/Catch/End Try block entirely and run it. Let's see what's going on.


    Tried it, no changes

    There is no catch in my try block

                                Try
                                    If ChoixDepart.ShowDialog = DialogResult.OK Then
                                        ' do something
                                    End If
                                Finally
                                    ChoixDepart.Dispose()
                                End Try
    

    Friday, September 9, 2016 2:34 PM
  • So the program goes inside the excel file...

    If I were doing this "for real" then I'd use a third party library (like Aspose) for this part.

    For now (maybe for a while), is it possible to export the Excel file to another format like a CSV for example?



    I have no idea how to do that but maybe...

    Edit: Ok I found it on save as

    Friday, September 9, 2016 2:36 PM

  • I have no idea how to do that but maybe...

    If you open it in Excel, one of the options is to save  it as a different type and you're given a lot of options.

    It might not lend well to a delimited file but if so, then I'll help you take it from that point to wherever it's back on your end again - maybe. It sounds like it's been long in development so I don't know that want to jump in at this point, but that would eliminate the Excel out of this and the rest is then in VB.

    Is that something that seems plausible? I don't want to offer something then realize that I just offered a year's work - I have a real job too. ;-)


    Some people succeed because they were destined to, but most people succeed because they were determined to.

    Friday, September 9, 2016 2:41 PM

  • I have no idea how to do that but maybe...

    If you open it in Excel, one of the options is to save  it as a different type and you're given a lot of options.

    It might not lend well to a delimited file but if so, then I'll help you take it from that point to wherever it's back on your end again - maybe. It sounds like it's been long in development so I don't know that want to jump in at this point, but that would eliminate the Excel out of this and the rest is then in VB.

    Is that something that seems plausible? I don't want to offer something then realize that I just offered a year's work - I have a real job too. ;-)


    Haha, you're really nice, but I'm almost at the end of my 6 months internship, so I think that if I can't finish they'll have to find another intern to finish what I started.

    Either I find a way to fix my problem or I'll tell them "look, it's working on step by step so I kinda made what you asked me, hire me and I'll fix or find another intern"

    Anyway, thank you for your major help, I think I won't annoy you anymore :)


    Friday, September 9, 2016 2:46 PM

  • Haha, you're really keen, but I'm almost at the end of my 6 months internship, so I think that if I can't finish they'll have to find another intern to finish what I started.

    Either I find a way to fix my problem or I'll tell them "look, it's working on step by step so I kinda made what you asked me, hire me and I'll fix or find another intern"

    Anyway, thank you for your major help, I think I won't annoy you anymore :)

    You're welcome but I haven't done anything yet.

    You said earlier that this was "saving it to another format". What is the resultant format that you're saving it to?


    Some people succeed because they were destined to, but most people succeed because they were determined to.

    Friday, September 9, 2016 2:50 PM
  • I'll try easier examples to test my program and see where's the problem, thank you anyway!

    The format is a specific format of the analyzing software but really it's a basic written code

    Friday, September 9, 2016 3:35 PM
  • I'll try easier examples to test my program and see where's the problem, thank you anyway!

    The format is a specific format of the analyzing software but really it's a basic written code

    I hope you get it working like you want then. :)


    Some people succeed because they were destined to, but most people succeed because they were determined to.

    Friday, September 9, 2016 3:40 PM