0

After upgrading from VS2013 to VS2015 I lost this function, and it's making my programming very slow.

If anyone, can share solution, please share.

Screenshot for clarification:

enter image description here

Bugs
  • 4,491
  • 9
  • 32
  • 41
  • Form1 is a *type name*, not an object reference. So you can only see Shared members of the type. That this is possible anyway in vb.net has caused an enormous amount of misery and many hundreds of questions at SO. It was actually intended as a feature to help VB6 programmers to port their code. But VS2015 has a completely redesigned compiler and IntelliSense parser, produced by the Roslyn project. Looks like they forgot or intentionally decided to not support this feature. Proper way to do this is by clicking the [New Issue button](https://github.com/dotnet/roslyn/issues). – Hans Passant May 05 '17 at 13:26
  • I just tested in a new project and it works for me. Does it work as you expect for a new project created in VS 2015? – jmcilhinney May 05 '17 at 15:12

1 Answers1

0

Instead of accessing the default static instance in vb, you should create an instance yourself.

Public Class Form2
    Private myForm1 As New Form1()
    Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        myForm1.Button1.Text = "Hello"
    End Sub
End Class

I posted about this here a few years ago. As mentioned in comments, this "feature" has generated a lot of confusion in the .Net community. It should be avoided whenever possible.

Community
  • 1
  • 1
djv
  • 15,168
  • 7
  • 48
  • 72
  • This is invariably where it ends up at SO. They did not *actually* mean to create a new instance of Form1. Quite undebuggable, the Show() method was never called. – Hans Passant May 05 '17 at 15:21
  • `Looks like they forgot or intentionally decided to not support this feature` I hope it's the latter. Maybe in 5 to 10 years we will be past this issue. – djv May 05 '17 at 15:29