Antony
Antony

Reputation: 83

How to display wait open form child

I need to open a child form from an MDI form and use this snippet:

Dim frmSearchServer As frmSetServerSql = New frmSetServerSql
frmSearchServer.MdiParent = Me
frmSearchServer.Show()
TSInfo.Text = frmSearchServer.Text

Because the child form before opening goes in search of data sources and fills a DataTable of available instances of sql server with dtServer = LoadInstanceServer()

that with a loop I'm going to add in a list of ServerSqlData:

For Each row As System.Data.DataRow In dtServer.Rows
     itemServerName = New ServerSQLData

     With itemServerName
        . ServerName = dtServer.Rows(0). Item(0)
        . Instance = dtServer.Rows(0). Item(1)
        . PathName = .ServerName & "\" & .Instance
     End With
     listDT.Add(itemServerName)
Next

which I'm going to show in a combo box:

cboServerName.DataSource = listDT
cboServerName.DisplayMember = "PathName"
cboServerName.SelectedItem = -1

now until the whole thing is completed the form does not open in the MDI form and since it takes some time how can I somehow let the user understand that he has to wait a moment?? Thank you for any suggestion. (I'm using VB2012!)

Upvotes: 0

Views: 136

Answers (1)

Jonathan Willcock
Jonathan Willcock

Reputation: 5235

It is some time since I last spoke Italian, but if I understood your comment correctly, you wanted me to give you an example.

Try something like this:

Cursor = Cursors.WaitCursor
Dim frmSearchServer As frmSetServerSql = New frmSetServerSql
frmSearchServer.MdiParent = Me
frmSearchServer.Show()
Cursor = Cursors.Default

Upvotes: 1

Related Questions