Graduate a program from small basic to Visual Studio. the textwindow Opens but doesn't get the text in it. RRS feed

  • Question

  • I am trying to get both a graphics window and textwindow to work in visual studio. The textwindow opens, but the text doesn't show in the window. Graphics window works fine. Any ideas of how to fix. I did find that rather than having the program as a forms application if I changed it to a console application it will show both and text will show in the textwindow. Only thing about doing that is the textwindow opens right away. It would be better if it ran as a forms application because the textwindow only opens when a command is given to it. If there is a way to get that to work it would be great!

    Here's the program as it sits in visual studio.

    Imports LitDev

    Module Flickr_10_picturesModule
        Dim x, pic, tempfile, picture, height, width As Primitive
        Sub Main()
            'Loads 10 images of animals from Flickr.
            'Sets the height and width of the graphics window to match the size of the images.
            'Displays the downloaded images in the graphics window.
            'Changes the image every two seconds

            x = 1
            While x <= 10
                pic = Flickr.GetPictureOfMoment()
                tempfile = File.GetTemporaryFilePath()
                LDNetwork.DownloadFile(tempfile, pic)
                picture = ImageList.LoadImage(tempfile)
                height = ImageList.GetHeightOfImage(picture)
                width = ImageList.GetWidthOfImage(picture)
                GraphicsWindow.Height = height
                GraphicsWindow.Width = width
                GraphicsWindow.DrawImage(tempfile, 0, 0)
                x = x + 1
            End While
            TextWindow.WriteLine("To see if I can do both")

        End Sub
    End Module



    Tuesday, March 31, 2020 8:09 PM


All replies

  • Hi JR,

    I'm not sure this is the correct answer but I tried to change Application Type from Windows Forms Application to Console Application.

    Nonki Takahashi

    Wednesday, April 8, 2020 1:26 PM
  • Nonki,

    When I make the program a console application it does work. The console window will open when the program starts along with the graphics window. So, the only thing with that is the console window is open the whole time the program runs. The console window does get the textwindow.writeline text into it at the right time.

    When I have the program run as a forms application the Text Window opens right at the time that it should in the program, but nothing goes into the window. The text actually goes into the debug window which seems strange to me. I think it's because the debug window uses the text window write commands. Maybe there is some way to make the text go to the correct window, but i haven't figured out a way to do that. 


    Wednesday, April 8, 2020 1:49 PM
  • The TextWindow is a Console window.

    A Console is not available in WPF (which SB is) without some extra work.

    If you are interested, there plenty on web about how it can be done (interop etc).

    Thursday, April 9, 2020 7:34 PM
  • LitDev,

    If you try the above program in visual studio you will see the textwindow.writeline command does open a console window and it opens it at the time the command is issued. The text in the command actually routes to the debug output and doesn't go to the console window. It's interesting to me that visual studio knows enough to open the console window, but doesn't route the text properly. Why would that be?


    Friday, April 10, 2020 12:52 AM