Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Studio
  4. How to Resolve 'Computer' is ambiguous between declarations in Modules 'GlbSoft.SWB.SS.My.MyProject' and 'GlbSoft.SWB.SS.My.MyProject'

How to Resolve 'Computer' is ambiguous between declarations in Modules 'GlbSoft.SWB.SS.My.MyProject' and 'GlbSoft.SWB.SS.My.MyProject'

Scheduled Pinned Locked Moved Visual Studio
csharpdatabasevisual-studiohelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    blkwebman
    wrote on last edited by
    #1

    I am trying to access the current NUM LOCK setting on a computer running VBA/VB.NET: - Windows 7 - Visual Studio 2010 - Microsoft (Office) Excel 2010 Here is the code:

    **Public Const _GlobalDefinitions As String = "GlobalDefinitions"
    Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
    Public Const VK_NUMLOCK As Integer = &H90
    Public Const KEYEVENTF_EXTENDEDKEY As Integer = &H1
    Public Const KEYEVENTF_KEYUP As Integer = &H2
    Public InitialNumLockState As Boolean

    Public Sub CheckNumLockState(Optional mWriteback As SSWriteback = Nothing)
    Try
    If InitialNumLockState Then
    If Not My.Computer.Keyboard.NumLock Then
    keybd_event(VK_NUMLOCK, &H45, KEYEVENTF_EXTENDEDKEY Or 0, 0)
    keybd_event(VK_NUMLOCK, &H45, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0)
    End If
    End If
    Catch ex As Exception
    If Not mWriteback Is Nothing Then
    AddToErrorLog(mWriteback, _GlobalDefinitions & ":" & System.Reflection.MethodBase.GetCurrentMethod.Name.ToString & "> " & ex.Message & ", " & ex.StackTrace, TraceEventType.Error)
    End If
    End Try
    End Sub**

    The InitialNumLockState variable is set earlier in the process as follows: InitialNumLockState = My.Computer.Keyboard.NumLock The initial reference to My.Computer.KeyBoard.NumLock works fine (and I can query it within a Watch window in runtime) and initializes the InitialNumLockState variable, e.g., True if the NUM LOCK key is ON. In the second reference to My.Computer.KeyBoard.NumLock, however, I am getting the following error: 'Computer' is ambiguous between declarations in Modules 'GlbSoft.SWB.SS.My.MyProject' and 'GlbSoft.SWB.SS.My.MyProject'. Note that the error message says the reference is ambiguous because it is present in two modules with the same name. Of course, this is not possible. There is only one project/namespace involved (GSI_SWB_SS/GlbSoft.SWB.SS). I have tried a number of different approaches, all without success. Does anyone have any ideas or insight concerning this error and what can possibly be looked at in order to resolve it? Thanks in advance, Chris Fleetwood

    B 1 Reply Last reply
    0
    • B blkwebman

      I am trying to access the current NUM LOCK setting on a computer running VBA/VB.NET: - Windows 7 - Visual Studio 2010 - Microsoft (Office) Excel 2010 Here is the code:

      **Public Const _GlobalDefinitions As String = "GlobalDefinitions"
      Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
      Public Const VK_NUMLOCK As Integer = &H90
      Public Const KEYEVENTF_EXTENDEDKEY As Integer = &H1
      Public Const KEYEVENTF_KEYUP As Integer = &H2
      Public InitialNumLockState As Boolean

      Public Sub CheckNumLockState(Optional mWriteback As SSWriteback = Nothing)
      Try
      If InitialNumLockState Then
      If Not My.Computer.Keyboard.NumLock Then
      keybd_event(VK_NUMLOCK, &H45, KEYEVENTF_EXTENDEDKEY Or 0, 0)
      keybd_event(VK_NUMLOCK, &H45, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0)
      End If
      End If
      Catch ex As Exception
      If Not mWriteback Is Nothing Then
      AddToErrorLog(mWriteback, _GlobalDefinitions & ":" & System.Reflection.MethodBase.GetCurrentMethod.Name.ToString & "> " & ex.Message & ", " & ex.StackTrace, TraceEventType.Error)
      End If
      End Try
      End Sub**

      The InitialNumLockState variable is set earlier in the process as follows: InitialNumLockState = My.Computer.Keyboard.NumLock The initial reference to My.Computer.KeyBoard.NumLock works fine (and I can query it within a Watch window in runtime) and initializes the InitialNumLockState variable, e.g., True if the NUM LOCK key is ON. In the second reference to My.Computer.KeyBoard.NumLock, however, I am getting the following error: 'Computer' is ambiguous between declarations in Modules 'GlbSoft.SWB.SS.My.MyProject' and 'GlbSoft.SWB.SS.My.MyProject'. Note that the error message says the reference is ambiguous because it is present in two modules with the same name. Of course, this is not possible. There is only one project/namespace involved (GSI_SWB_SS/GlbSoft.SWB.SS). I have tried a number of different approaches, all without success. Does anyone have any ideas or insight concerning this error and what can possibly be looked at in order to resolve it? Thanks in advance, Chris Fleetwood

      B Offline
      B Offline
      Bernhard Hiller
      wrote on last edited by
      #2

      Looks more like a Visual Studio problem. Clean the solution, close VS, delete old local files, and re-build the solution again. That should normally help.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups