Load image openfiledialog visual c# console

largra

New member
Joined
Oct 17, 2019
Messages
4
Programming Experience
1-3
I have a Tesseract functioning app which take image path inside the visual studio.
I want to load the image like openfiledialog without visual sturio open.
Please think of that I am a beginner in C#.
Thank you in advance!
LG
 
Explain, and provide details.

For the people who don't know, what is Tesseract?
What type of project is this for?
What have you tried, thought of or attempted?

If you have code, post it up?
 
Very likely it is Tesseract the OCR library. It would explain why he needs a path to the image file to be recognized.

I don't understand the problem the OP is having. The open file dialog should work regardless if Visual Studio is installed or not. All that would be needed is that the .NET Framework is installed in the target machine.
 
Yes, Tesseract is for OCR. The only thing is that I want to be able to load an image
path for Tesseract to work with. It function already when the image path is in C# console.
But when i compile the program I can not change the path that is inside C# console.
I want to change without open code in Visual Studio.

The image you need to read letters and numbers via OCR.
 
Do you really need the open file dialog? Since this is a console program, most people write their console program so that you can pass in a path to a file to the console program as one of its command line parameters.

Anyway, if you really want the open file dialog, what problem are you running into trying to open one? The documentation is pretty clear. It even has some sample code.
 
I only used openfiledialog as an example for input a path to the image outside visual studio and visual c.
I only want that command to load the image path when the program is compiled (outside visual c#)
Thanks a lot for taking time to answer. If you can give me some hint how to load the path I would be grateful.
LG
 
Where did you learn C#? Wasn't this covered in your lessons regarding command line parameters:
C#:
class Program
{
    public static void Main(string args[])
    {
        if (args.Length >= 1)
            Console.WriteLine(args[0]);
    }
}
 
I learn myself . I am a beginner and I have worked other programming for a period of time.
I have had no lessons but I found free books online to download.
I found this:
Console.Clear();
Console.Write("Please enter your image path: ");
string filePath = Console.ReadLine();
That is what you answered.
Your kindness to answer gave me the answer I wanted?
 
Last edited by a moderator:
Unfortunately, that is not what I answered with. That approach is the interactive way of getting the path from the user. The approach I was proposing was using the command line parameters since you have written a console program. Anyway, your approach solves your problem for now.

I highly suggest finding a good set of integrated tutorials which will guide you through learning C#. Otherwise you'll be left in this really odd stop where you know about the advanced topic of doing P/Invokes to unmanaged code to be able to interact with Tesseract, but you don't know the basic skills of how to get input from the user.
 
@largra please do not quote unnecessarily. If you must quote something, then select the text in which you want to quote, and a little popup will come up, then click quote. Unnecessarily quoting as you've just done above takes up unnecessary space on the thread, especially for users on mobile devices, and it also serves no purpose if you aren't going to reference a comment in regards to the quoted text. In which case, you should really just reply with the quick reply box at the bottom of the page. Unnecessarily quoting is clutter, and also accumulates in reducing disc space on the servers.

Regarding your issue. Is your application user intractable? Or is this like a self running continuous process? My proposal will depend on your answer...
 
Back
Top Bottom