VB6 to Express query

Hi,

Visual Studio Express has upgraded a VB6 app for me with the following error:

>> Name 'controlcm1' is not declared. File Form1.vb Line 13 Column 9 Project 1.

Here is the code for Form1.vb

Option Strict Off

Option Explicit On

Imports Axcm11a

Imports Microsoft

Imports Project1

Imports System

Friend Class Form1

Inherits System.Windows.Forms.Form

Private Sub ButClrCM11_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles ButClrCM11.Click

controlcm1.ClearMem()

End Sub

Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command2.Click

Dim st As String

Dim p As Integer

p = Val(TxtPoll.Text)

If p > 65535 Then

MsgBox("Poll time too big, enter 0-65535", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Input Error")

Else

st = controlcm1.GetEvent(p)

If st = "" Then

st = "No Data" & vbCrLf

Else

st = "Poll Data: " & st & vbCrLf

End If

TxtEvent.Text = TxtEvent.Text & st

End If

End Sub

Private Sub ButInit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles ButInit.Click

'UPGRADE_NOTE: err was upgraded to err_Renamed. Click for more: 'ms-help://MS.VSExpressCC.v80/dv_commoner/local/redirect.htm keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'

Dim err_Renamed As Short

controlcm1.comport = Val(TxtComPort.Text)

ButInit.Text = "Wait..."

err_Renamed = controlcm1.Init

If err_Renamed <> 0 Then

MsgBox("Error initializing CM11A", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly)

ButInit.Text = "Init"

Else

ButInit.Text = "Done"

ButInit.Enabled = False

End If

End Sub

Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click

Dim i As Short

i = Combo1.SelectedIndex

If i = 16 Then

i = -1

End If

controlcm1.Exec(TxtHC.Text, TxtDC.Text, i, Val(TxtDim.Text), Val(TxtDim.Text), Val(TxtData2.Text))

End Sub

Private Sub Command3_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command3.Click

Me.Close()

End Sub

Private Sub Command4_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command4.Click

TxtEvent.Text = ""

End Sub

Private Sub Command5_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command5.Click

Dim i As Short

i = Combo1.SelectedIndex

If i = 16 Then

i = -1

End If

controlcm1.ExecWait(TxtHC.Text, TxtDC.Text, i, Val(TxtDim.Text), Val(TxtDim.Text), Val(TxtData2.Text))

End Sub

Private Sub controlcm1_X10Event(ByVal eventSender As System.Object, ByVal eventArgs As Axcm11a.__controlcm_X10EventEvent)

TxtEvent.Text = TxtEvent.Text & "Event: " & eventArgs.housecode & " " & eventArgs.devices & Str(eventArgs.command) & " dimval: " & eventArgs.extra & "D2: " & eventArgs.data2 & vbCrLf

End Sub

Private Sub controlcm1_X10SingleEvent(ByVal eventSender As System.Object, ByVal eventArgs As Axcm11a.__controlcm_X10SingleEventEvent)

TxtEvent.Text = TxtEvent.Text & "Single Event: " & eventArgs.housecode & " " & eventArgs.devices & " " & Str(eventArgs.command) & vbCrLf

End Sub

Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load

Combo1.SelectedIndex = 0

End Sub

End Class

I am new to Visual Basic Express and would appreciate any assistance with the above.

Best Regards

Jason Warren



Answer this question

VB6 to Express query

  • KvRaji

    hi,

    the problem is solved although not with VB Express, I reinstalled VB6 and did the updates there.

    I will drop back onto VB Express when time permits, as always ;o)

    thanks

    Jason


  • Musa

    The compiler is right, I see you access controlcm1, but I don't see it declared anywhere. What was it in the VB6 app, and where was it declared VB.NET does not allow any sort of global variable.



  • Stew2006

    hi,

    Is your problem solved

    Thank you,
    Bhanu.



  • VB6 to Express query