This is an easy one guys i am sure - i just dont know how to do it...
I want to do this...
***THIS IS VB6 CODE!***
Dim ctrX As Control
For Each ctrX In Controls
If (TypeOf ctrX Is ComboBox) And (ctrX.Container Is objFrame) Then
ctrX.ListIndex = 0
End If
If (TypeOf ctrX Is ListBox) Then
For intLoopCounter = 1 To ctrX.ListCount Step 1
ctrX.Selected(intLoopCounter - 1) = False
Next intLoopCounter
End If
Next ctrX
When i have upgraded my code to .Net it has decided that this will not longer work.
This is the code that i am not given:
Dim ctrX As System.Windows.Forms.Control
Dim objFrame As Object
For Each ctrX In Controls
UPGRADE_WARNING: TypeOf has a new behavior. Click for more: ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1041"
If (TypeOf ctrX Is System.Windows.Forms.TextBox) And (ctrX.Parent Is objFrame) Then
ctrX.Text = ""
End If
UPGRADE_WARNING: TypeOf has a new behavior. Click for more: ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1041"
If (TypeOf ctrX Is System.Windows.Forms.ComboBox) And (ctrX.Parent Is objFrame) Then
UPGRADE_WARNING: Couldnt resolve default property of object ctrX.ListIndex. Click for more: ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1037"
ctrX.ListIndex = 0
End If
UPGRADE_WARNING: TypeOf has a new behavior. Click for more: ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1041"
If (TypeOf ctrX Is System.Windows.Forms.ListBox) Then
UPGRADE_WARNING: Couldnt resolve default property of object ctrX.ListCount. Click for more: ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1037"
For intLoopCounter = 1 To ctrX.ListCount Step 1
UPGRADE_WARNING: Couldnt resolve default property of object ctrX.Selected. Click for more: ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1037"
ctrX.Selected(intLoopCounter - 1) = False
Next intLoopCounter
End If
Next ctrX
This has flumuxed me - simple to fix? I have no idea, i thought it would be but after some searching it appears no.
The errors i have in the task area window of the vb.net screen
GetCheckedIndices is not a member of System.Windows.Forms.CheckedListBox.
ListCount is not a member of System.Windows.Forms.Control.
ListIndex is not a member of System.Windows.Forms.Control.
Selected is not a member of System.Windows.Forms.Control.
Please help,
Papa.
I want to do this...
***THIS IS VB6 CODE!***
Dim ctrX As Control
For Each ctrX In Controls
If (TypeOf ctrX Is ComboBox) And (ctrX.Container Is objFrame) Then
ctrX.ListIndex = 0
End If
If (TypeOf ctrX Is ListBox) Then
For intLoopCounter = 1 To ctrX.ListCount Step 1
ctrX.Selected(intLoopCounter - 1) = False
Next intLoopCounter
End If
Next ctrX
When i have upgraded my code to .Net it has decided that this will not longer work.
This is the code that i am not given:
Dim ctrX As System.Windows.Forms.Control
Dim objFrame As Object
For Each ctrX In Controls
UPGRADE_WARNING: TypeOf has a new behavior. Click for more: ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1041"
If (TypeOf ctrX Is System.Windows.Forms.TextBox) And (ctrX.Parent Is objFrame) Then
ctrX.Text = ""
End If
UPGRADE_WARNING: TypeOf has a new behavior. Click for more: ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1041"
If (TypeOf ctrX Is System.Windows.Forms.ComboBox) And (ctrX.Parent Is objFrame) Then
UPGRADE_WARNING: Couldnt resolve default property of object ctrX.ListIndex. Click for more: ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1037"
ctrX.ListIndex = 0
End If
UPGRADE_WARNING: TypeOf has a new behavior. Click for more: ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1041"
If (TypeOf ctrX Is System.Windows.Forms.ListBox) Then
UPGRADE_WARNING: Couldnt resolve default property of object ctrX.ListCount. Click for more: ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1037"
For intLoopCounter = 1 To ctrX.ListCount Step 1
UPGRADE_WARNING: Couldnt resolve default property of object ctrX.Selected. Click for more: ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1037"
ctrX.Selected(intLoopCounter - 1) = False
Next intLoopCounter
End If
Next ctrX
This has flumuxed me - simple to fix? I have no idea, i thought it would be but after some searching it appears no.
The errors i have in the task area window of the vb.net screen
GetCheckedIndices is not a member of System.Windows.Forms.CheckedListBox.
ListCount is not a member of System.Windows.Forms.Control.
ListIndex is not a member of System.Windows.Forms.Control.
Selected is not a member of System.Windows.Forms.Control.
Please help,
Papa.