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 OffOption
Explicit OnImports
Axcm11aImports
MicrosoftImports
Project1Imports
SystemFriend
Class Form1 Inherits System.Windows.Forms.Form Private Sub ButClrCM11_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles ButClrCM11.Clickcontrolcm1.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 Integerp = Val(TxtPoll.Text)
If p > 65535 ThenMsgBox(
"Poll time too big, enter 0-65535", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Input Error") Elsest = controlcm1.GetEvent(p)
If st = "" Thenst =
"No Data" & vbCrLf Elsest =
"Poll Data: " & st & vbCrLf End IfTxtEvent.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 Shortcontrolcm1.comport = Val(TxtComPort.Text)
ButInit.Text =
"Wait..."err_Renamed = controlcm1.Init
If err_Renamed <> 0 ThenMsgBox(
"Error initializing CM11A", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly)ButInit.Text =
"Init" ElseButInit.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 Shorti = Combo1.SelectedIndex
If i = 16 Theni = -1
End Ifcontrolcm1.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 SubPrivate 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 Shorti = Combo1.SelectedIndex
If i = 16 Theni = -1
End Ifcontrolcm1.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.LoadCombo1.SelectedIndex = 0
End SubEnd
ClassI am new to Visual Basic Express and would appreciate any assistance with the above.
Best Regards
Jason Warren

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.