Microstation toolbars disappear when running (calling) Microstation from a VB program

We have a couple of visual basic programs where we call up microstation to create drawings. For some reason when we run these programs, all of the toolbars that were open and docked are closed. Does this happen to anyone else? Is there a way to prevent that from happening?

  • Hi Beyondo,

    I have not seen such behaviour yet, so I have no solution right now, but I'd like to ask for a few things to better understand the situation:

    • You use Visual Basic exe, not VBA? You mentioned VB, but sometimes it's mixed, so I want to be sure.
    • When VB program is run, MicroStation is started already?
    • Can you post a code snippet how MicroStation process is called and reference to it is received?

    With regards,

      Jan

  • A few more things in addition to what Jan asks...

    • What sort of graphics subsystem is on the computer?
    • Is the computer you are running this on local or a network server?
    • If you enter a MicroStation session "manually" on that computer, are you seeing anything different?

      

  • Our visual basic program is written using Visual Studio 2010. It runs stand alone, outside of Microstation.

    The program (shown below) calls microstation to open a file, edits something and then closes microstation.

    The next time microstation is started by the user, all the toolboxes have been closed.

    The code for our main program is fairly comprehensive, so attached is a zip with a simple version, to find and replace text, which we tested and it does the same thing regarding toolboxes.

    On the form:

    The first box is the path, it will search for a file named, \test.dgn .

    The second box is text you are searching for, so you need 1 line of text.

    The third box is text you want to change the text to.

    That's it.

     Also included in the zip is a couple of screen shots of microstation, showing toolbar/boxes before and after.


    Microstation VB.zip


    This is the simple code:

    Imports System

    Imports System.Data

    Imports System.Data.OleDb

    Imports System.IO

    Imports System.Text

    Public Class Form1

       Public oDGN As MicroStationDGN.Application

       Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

           oDGN = New MicroStationDGN.Application

           oDGN.OpenDesignFile(TextBox1.Text & "\test.dgn")

           oDGN.CadInputQueue.SendKeyin("MDL SILENT FINDREPLACETEXT,CHNGTXT CHANGE DIALOGTEXT")

           oDGN.CadInputQueue.SendKeyin("FIND DIALOG SEARCHSTRING " & TextBox2.Text)

           oDGN.CadInputQueue.SendKeyin("FIND DIALOG REPLACESTRING " & TextBox3.Text)

           oDGN.CadInputQueue.SendKeyin("CHANGE TEXT ALLFILTERED")

           oDGN.ActiveDesignFile.Close()

           oDGN.Quit()

       End Sub

    End Class


    Let me know what you think, or if you need something else, Thanks for your time.

    -Beyondo-

  • Graphics card is anything from an nvidia Quadro K2000 to a NVS 300
    All computers are on network
    Our programs opens/close microstation in the background. Later, when you open microstation manually, all the tools that were previously docked are gone.
    I replied to Jan with more info
    Thanks for your help

    -Beyondo-

  • You wouldn't. by chance, be sharing the same user preferences between these computers, would you?

      

  • No shared preferences here.

    I just retested another quick app to check this problem again. After running it, I opened microstation (manually) and some of the standard toolbars remained open, but the 'Main' toolbar and all custom toolbars I had open were gone.

    Is there any way to set user/interface via VB program? Similar to ustation command line switches setting 'user'? I scanned help files and didn't see any reference to this.
    I thought if we setup an alternate user profile, we could force microstation to open using that alt profile, leaving the normal user settings alone.

    -Beyondo-