Olá pessoal! Estou com problemas em migrar um Sistema de Vb6 para .Net. Especialmente em algumas funções bem simples em Vb6. Não tenho muiot conhecimento em .Net. Segue o código em VB6. Public Sub CarregaCombo(Combo As ComboBox, sql As String, Campo As String, chave As String, Default As Long)
IndexDefault = 0
Combo.AddItem "TODOS"
Combo.ItemData(Combo.NewIndex) = 0
Dim Rst As ADODB.Recordset
Set Rst = BD.Execute(sql)
While Not Rst.EOF
Combo.AddItem Rst(Campo)
Combo.ItemData(Combo.NewIndex) = CLng(Rst(chave))
If Combo.ItemData(Combo.NewIndex) = Default Then IndexDefault = Combo.NewIndex
Rst.MoveNext
Wend
Rst.Close
Combo.ListIndex = IndexDefault
End Sub
E o código gerado após a importação...
Public Sub CarregaCombo(ByRef Combo As System.Windows.Forms.ComboBox, ByRef sql As String, ByRef Campo As String, ByRef chave As String, ByRef Default_Renamed As Integer)
Dim IndexDefault As Object
'UPGRADE_WARNING: Couldn't resolve default property of object IndexDefault. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
IndexDefault = 0
Combo.Items.Add(New VB6.ListBoxItem("TODOS", 0))
Dim Rst As ADODB.Recordset
Rst = BD.Execute(sql)
While Not Rst.EOF
Combo.Items.Add(New VB6.ListBoxItem(Rst.Fields(Campo).Value, CInt(Rst.Fields(chave).Value)))
'UPGRADE_ISSUE: ComboBox property Combo.NewIndex was not upgraded. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="F649E068-7137-45E5-AC20-4D80A3CC70AC"'
If VB6.GetItemData(Combo, Combo.NewIndex) = Default_Renamed Then
'UPGRADE_ISSUE: ComboBox property Combo.NewIndex was not upgraded. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="F649E068-7137-45E5-AC20-4D80A3CC70AC"'
'UPGRADE_WARNING: Couldn't resolve default property of object IndexDefault. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
IndexDefault = Combo.NewIndex
End If
Rst.MoveNext()
End While
Rst.Close()
'UPGRADE_WARNING: Couldn't resolve default property of object IndexDefault. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
Combo.SelectedIndex = IndexDefault
End Sub Alguém pode ajudar!? Obrigado! Abraço!