Results 1 to 8 of 8

Thread: [RESOLVED] Getting information to process

  1. #1

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    869

    Resolved [RESOLVED] Getting information to process

    Hi. I am new to VB.NET, prefer vb.6. I wrote a program in NET to run several console programs sequentially. That works fine. The console programs have already been written. At the end of these programs I have a MsgBox to tell me when the program is complete. When I use the new program, to execute these sequentially, the msgbox(s0 are not necessary. However, I would rather keep the option of being able to run these programs individually or from the new program. Without passing an argument to the programs, how can i determine when to execute the msgbox statements.

    Thanks

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Posts
    12,375

    Re: Getting information to process

    I don't think I quite understand.

    You say that you built Console Applications, which are text-only interfaces, but at the same time you say that a MsgBox (legacy holder of MessageBox) which is itself a graphical user interface widget.

    Then you also say that you want to run these programs individually or through a new program without passing an option to the program to do something dynamic.

    It's all too contradictory for me to understand exactly what you want. On one hand you want TUI that displays GUI and on the other hand you want to dynamically do something without specifying a condition.

    It's very possible I'm misunderstanding your request, could you clarify the need a bit for me?
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | HtmlLessons | CssLessons | Code Tags | Sword of Fury - Jameram

  3. #3

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    869

    Re: Getting information to process

    The main program has a form. I shellexecute to several console app programs. I could pass an arg, but the nI need to read an arg. That's ok. however, If I run the console app manually, then I am looking for an arg to be sent.

  4. #4
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Posts
    12,375

    Re: Getting information to process

    Is it that you can explain the workflow to me?

    From what I understand it sounds like this:
    1. Running your "main program" which sounds like a Windows Form Application:
      1. You launch every console application sequentially
      2. As each one finishes, you display a message via MessageBox (or MsgBox)
      3. I.e. if you have 10 instances that run then you should get 10 messages each time an instance finishes
    2. Running your console applications as standalone applications:
      1. This runs as expected
      2. Once it's finished running, it simply closes and that's that.


    Is that more or less the gist?
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | HtmlLessons | CssLessons | Code Tags | Sword of Fury - Jameram

  5. #5

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    869

    Re: Getting information to process

    Yes. But when I run thru the launcher (form app), I don't want the msgbox(s) to show.

  6. #6
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,632

    Re: Getting information to process

    Why are you against command line arguments? Just add the ability to launch them with a argument of "silent". If that is present, don't show a msgbox. Otherwise, show a messagebox. Just because a program becomes "aware" of command line arguments doesn't mean you have to always pass arguments to the program to get it to run.

  7. #7

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    869

    Re: Getting information to process

    I was not aware then a program coded to receive a cmd line arg can run without receiving one. OK. I will do it that way.

  8. #8
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Posts
    12,375

    Re: [RESOLVED] Getting information to process

    That is the best suggestion. You could add something along these lines:
    Code:
    Public Sub Main(args As String())
        Dim silentMode As Boolean = (args.Length > 0 AndAlso args.Contains("--silent"))
        ' do something now based on the condition
    End Sub
    Edit - After thinking about it, you could actually drop the length check since contains would return false anyways:
    Code:
    Public Sub Main(args As String())
        Dim silentMode As Boolean = args.Contains("--silent")
        ' do something now based on the condition
    End Sub
    You could even make the argument case insensitive via LINQ:
    Code:
    Public Sub Main(args As String())
        Dim silentMode As Boolean = args.Any(Function(arg) String.Equals(arg, "--silent", StringComparison.OrdinalIgnoreCase))
        ' do something now based on the condition
    End Sub
    Last edited by dday9; May 15th, 2026 at 04:11 PM.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | HtmlLessons | CssLessons | Code Tags | Sword of Fury - Jameram

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width