Declaration expected

Malcolm Fellmann 5 Reputation points
2024-04-29T19:34:17.8733333+00:00

Public Module GlobalVariables

Public gDataGridShowing

Public gDatabase As String
```End Module

Public Class Form1

   gDatabase = "ganswind"   **<<< error "Declaration expected"**

   Function HideMenuPoints(ByVal MenuNumber)

   .

   .

   .

I guess I am placing things in the wrong place?

( There is no such things as a stupid question, .... )

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,606 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Viorel 113K Reputation points
    2024-04-29T20:17:41.1866667+00:00

    Try this:

    Module GlobalVariables
    
        Public gDatabase As String = "ganswind"
    
    End Module
    

    Or this:

    Public Class Form1
    
        Sub New()
    
            InitializeComponent()
    
            GlobalVariables.gDatabase = "ganswind"
    
        End Sub
    
    
    

    (Depending on necessities).