Auteur de questions
[VB.NET] erreur compilation

Question
-
J'arrive à accéder à une base de données à partir d'un programme c en utilisant le driver ODBC.
Je voulais faire une interface graphique en VB.net qui permet de connecter à une base de données pour remplir quelques contrôles par exemple liste de plus il y a des boutons ..
Cette interface va générer un fichier texte.
Puis, j'ai un programme C qui va utiliser ce ficher pour faire autres traitements et donnes des résultats.
Ensuite, ces résultats obtenus seront afficher dans une liste qui fait partie de l'interface graphique.
J'ai trouvé un code qui me répond à mon besoin mais il est en VB6.
En réalité, J'ai installé Visual Studio 2008.
Lorsque j'ouvre ce projet VB6 alors l'assistance de conversion s'arrête et il me demande d'installer quelques composantes qui sont liées au visual basic 6.
Pourquoi ?
Donc, il faut refaire tout le projet VB6 de nouveau en VB.NET ou bien il y a autre solution ?
J'ai commencé à refaire le projet.
Voici le code de chargement de la 'Form1' est :
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim cnx As ADODB.Connection Dim rst As ADODB.Recordset cnx = New ADODB.Connection rst = New ADODB.Recordset cnx.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" & "SERVER=127.0.0.1;" & "DATABASE=base_donnee;" & "UID=root;" & "PWD=;" cnx.Open() rst.Open("show tables", cnx) While Not (rst.EOF) ComboBox1.Items.Add(rst.Fields(0).Value) rst.MoveNext() End While rst.Close() End Sub
Lors de la compilation, j'ai les erreurs suivants au niveau compilation:
c:\ch\ch\Form1.Designer.vb(80) : error BC30002: Type 'ADOB.Connection' non défini.
c:\ch\ch\Form1.Designer.vb(81) : error BC30002: Type 'ADODB.Recordset' non défini.
c:\ch\ch\Form1.Designer.vb(82) : error BC30002: Type 'ADODB.Connection' non défini.
c:\ch\ch\Form1.Designer.vb(83) : error BC30002: Type 'ADODB.Recordset' non défini.
Que signifie ces erreurs et comment les résoudre ?
Comment préparer et exécuter une requete SQL en VB.net ?
par exemple dans notre cas la requête SQL est : "show tables"
Merci.
Toutes les réponses
-
Bonjour,
La migration en VB6 vers VB .NET n'est pas si aisé, il faut mieux refaire l'application à zéro.
Dans le .NET Framework, l'ancien ADO n'existe plus et est remplacé par ADO .NET. Le concept est un peu différent par rapport à ADO. C'est pour çà qu'il faut mieux refaire l'application à zéro après une bonne formation sur les bases du .NET.
Cordialement
Gilles TOURREAU - MVP C# - Architecte .NET/Consultant/Formateur -
Si tu veux utiliser toujours ADO, il faut ajouter une référence vers les objets COM de ADO (Ajouter une référence, onglet COM).
Ceci dit, comme Gilles, je ne te conseille pas d'utiliser ADO et de passer directement à ADO .NET.
Richard Clark
Consultant - Formateur .NET
http://www.c2i.fr
Depuis 1996: le 1er site .NET francophone -
Bonjour,
Je décide de refaire le code VB.6 en VB.net
Je suis bloqué et j'ai besoin vos aides.
Pouvez vous m'aider de trouver le code équivalent de VB.net ?
J'ai trois autres 'forms' qui sont codés en VB6 et je n'arrive pas à les traduire en VB.NET car ces sont difficiles que la première.
Voici le code de 'form2' :
Code :
Option Strict Off
Option Explicit On
Friend Class attribut_select
Inherits System.Windows .Forms .Form
Private Sub Check1_Click( )
End Sub
Private Sub attribut_select_Load( ByVal eventSender As System.Object , ByVal eventArgs As System.EventArgs ) Handles MyBase .Load
Dim cnx As ADODB.Connection
Dim rst As ADODB.Recordset
cnx = New ADODB.Connection
rst = New ADODB.Recordset
Dim cmd As ADODB.Command
Dim param As ADODB.Parameter
cmd = New ADODB.Command
param = New ADODB.Parameter
cnx.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" & "SERVER=127.0.0.1;" & "DATABASE=base_donnee;" & "UID=root;" & "PWD=;"
cnx.Open ( )
rst.Open ( "show columns from " & nom_table & "" , cnx)
attribut( 0 ) .Visible = False
Dim j As Integer
'creation de 2 boutons en plus du premier crée manuellement
'For j = 1 To 2
j = 1
'While (j <= 2)
While Not ( rst.EOF )
Me .attribut .Load ( j)
Me .attribut ( j) .Left = VB6.TwipsToPixelsX ( Me .attribut ( j - 1 ) .Left )
Me .attribut ( j) .Top = VB6.TwipsToPixelsY ( VB6.PixelsToTwipsY ( Me .attribut ( j - 1 ) .Top ) + 500 )
'attribut_select.attribut(j).Caption = "attribut(" & Trim(CStr(j)) & ") crée par INDEX" 'suppression des espaces pour le nom
Me .attribut ( j) .Text = rst.Fields ( 0 ) .Value
Me .attribut ( j) .Visible = True
'Next j
j = j + 1
rst.MoveNext ( )
End While
nombre_attribut_select = j - 1
End Sub
Private Sub valider_attribut_Click( ByVal eventSender As System.Object , ByVal eventArgs As System.EventArgs ) Handles valider_attribut.Click
Dim j As Short
Dim p As Short
For j = 1 To nombre_attribut_select
If Me .attribut ( j) .CheckState = 1 Then
attribut_select_selectionne( p) = Me .attribut ( j) .Text
p = p + 1
End If
Next j
If p = 0 Then
MsgBox( "Vous devez sélectionner au moins un attribut" )
Else
nombre_attribut_select_selectionne = p
Me .Close ( )
'UPGRADE_ISSUE: L'instruction Load n'est pas pris(e) en charge. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="B530EFF2-3132-48F8-B8BC-D88AF543D321"'
'Load(attribut_where)'
'attribut_where.Show()'
attribut_where.ShowDialog ( )
End If
End Sub
End Class
Code :
Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Friend Class parametre_attribut_where
Inherits System.Windows .Forms .Form
Private Sub Command1_Click( ByVal eventSender As System.Object , ByVal eventArgs As System.EventArgs ) Handles Command1.Click
Dim valeur As Object
'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet valeur. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
valeur = attribut_where_selectionne( nombre_attribut_where_selectionne - 1 ) & "_" & valeur_where.Text
'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet valeur. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
valeur_attribut_where( nombre_attribut_where_selectionne - 1 ) = valeur
'valeur_attribut_where(nombre_attribut_where_selectionne - 1) = valeur_where.Text
'MsgBox attribut_where_selectionne(0)
Me .Close ( )
'UPGRADE_ISSUE: L'instruction Load n'est pas pris(e) en charge. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="B530EFF2-3132-48F8-B8BC-D88AF543D321"'
'Load(attribut_where)'
attribut_where.Show ( )
attribut_where.Refresh ( )
'attribut_where.Show 1
End Sub
Private Sub parametre_attribut_where_Load( ByVal eventSender As System.Object , ByVal eventArgs As System.EventArgs ) Handles MyBase .Load
Dim ch As Object
Dim taille As Object
Dim pos As Object
nom_attribut_where.Text = attribut_where_selectionne( nombre_attribut_where_selectionne - 1 ) & " IS :"
Dim cnx As ADODB.Connection
Dim rst As ADODB.Recordset
cnx = New ADODB.Connection
rst = New ADODB.Recordset
Dim cmd As ADODB.Command
Dim param As ADODB.Parameter
cmd = New ADODB.Command
param = New ADODB.Parameter
cnx.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" & "SERVER=127.0.0.1;" & "DATABASE=base_connaissance;" & "UID=root;" & "PWD=;"
cnx.Open ( )
rst.Open ( "select designation from " & nom_table & " where designation like '" & attribut_where_selectionne( nombre_attribut_where_selectionne - 1 ) & "%'" , cnx)
While Not rst.EOF
'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet pos. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
pos = InStr( rst.Fields ( 0 ) .Value , "_" )
'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet taille. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
taille = Len( rst.Fields ( 0 ) .Value )
'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet pos. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet taille. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet ch. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
ch = VB.Right ( rst.Fields ( 0 ) .Value , taille - pos)
'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet ch. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
valeur_where.Items .Add ( ch)
'valeur_where.AddItem rst.Fields(0)
rst.MoveNext ( )
End While
rst.Close ( )
End Sub
End Class
Code :
Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Friend Class attribut_where
Inherits System.Windows .Forms .Form
Private Sub Command1_Click( ByVal eventSender As System.Object , ByVal eventArgs As System.EventArgs ) Handles Command1.Click
Dim indice As Object
Dim Id As Object
'Dim i As Integer
'For i = 0 To nombre_attribut_select_selectionne - 1
'MsgBox attribut_select_selectionne(i)
'Next i
'For i = 0 To nombre_attribut_where_selectionne - 1
'MsgBox valeur_attribut_where(i)
'Next i
'For i = 0 To nombre_attribut_where_selectionne - 1
'MsgBox attribut_where_selectionne(i)
'Next i
'sauvegarde dans le fichier contexte.xls
FileOpen( 1 , "fichier_out.txt" , OpenMode.Output )
PrintLine( 1 , "" & nom_table & "" )
PrintLine( 1 , nombre_attribut_select_selectionne)
For i = 0 To nombre_attribut_select_selectionne - 1
PrintLine( 1 , attribut_select_selectionne( i) )
Next i
PrintLine( 1 , "1" )
PrintLine( 1 , nombre_attribut_where_selectionne)
For i = 0 To nombre_attribut_where_selectionne - 1
PrintLine( 1 , "flou " & attribut_where_selectionne( i) & " IS " & valeur_attribut_where( i) )
Next i
FileClose( 1 )
'Dim vari As Date
'Dim varia As Date
'Dim x As Single
'Dim y As Single
'x = Timer
'MsgBox x
Dim Start As Double
Dim fin As Double
Start = VB.Timer ( )
'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet Id. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
Id = Shell( "prog.exe" )
'y = Timer
'varia = Time
fin = VB.Timer ( )
MsgBox( "Vous voulez afficher le résulat" )
MsgBox( Start * 1000000 )
'MsgBox vari
'MsgBox varia
'MsgBox y - x & " Millisecondes"
MsgBox( fin * 1000000 )
MsgBox( CStr ( fin - Start) & "mmm" )
'* 1000000
FileOpen( 2 , "fichier_indice.txt" , OpenMode.Input )
Input( 2 , indice)
FileClose( 2 )
'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet indice. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
If indice = 0 Then
Me .Close ( )
'UPGRADE_ISSUE: L'instruction Load n'est pas pris(e) en charge. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="B530EFF2-3132-48F8-B8BC-D88AF543D321"'
'Load(cause)'
'cause.Show()'
cause.ShowDialog ( )
Else
Me .Close ( )
'UPGRADE_ISSUE: L'instruction Load n'est pas pris(e) en charge. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="B530EFF2-3132-48F8-B8BC-D88AF543D321"'
'Load(reponse)'
'reponse.Show()'
reponse.ShowDialog ( )
End If
End Sub
Private Sub Command2_Click( )
Me .Close ( )
'UPGRADE_ISSUE: L'instruction Load n'est pas pris(e) en charge. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="B530EFF2-3132-48F8-B8BC-D88AF543D321"'
'Load(reponse)'
'reponse.Show()'
reponse.ShowDialog ( )
End Sub
Private Sub Command3_Click( )
Me .Close ( )
'UPGRADE_ISSUE: L'instruction Load n'est pas pris(e) en charge. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="B530EFF2-3132-48F8-B8BC-D88AF543D321"'
'Load(cause)'
'cause.Show()'
cause.ShowDialog ( )
End Sub
Private Sub attribut_where_Load( ByVal eventSender As System.Object , ByVal eventArgs As System.EventArgs ) Handles MyBase .Load
Dim cnx As ADODB.Connection
Dim rst As ADODB.Recordset
cnx = New ADODB.Connection
rst = New ADODB.Recordset
Dim cmd As ADODB.Command
Dim param As ADODB.Parameter
cmd = New ADODB.Command
param = New ADODB.Parameter
cnx.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" & "SERVER=127.0.0.1;" & "DATABASE=base_donnee;" & "UID=root;" & "PWD=;"
cnx.Open ( )
rst.Open ( "show columns from " & nom_table & "" , cnx)
While Not ( rst.EOF )
Me .where_attribut .Items .Add ( rst.Fields ( 0 ) .Value )
rst.MoveNext ( )
End While
rst.Close ( )
End Sub
'UPGRADE_WARNING: L'événement where_attribut.SelectedIndexChanged peut se déclencher lorsque le formulaire est initialisé. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
Private Sub where_attribut_SelectedIndexChanged( ByVal eventSender As System.Object , ByVal eventArgs As System.EventArgs ) Handles where_attribut.SelectedIndexChanged
attribut_where_selectionne( nombre_attribut_where_selectionne) = Me .where_attribut .Text
nombre_attribut_where_selectionne = nombre_attribut_where_selectionne + 1
parametre_attribut_where.ShowDialog ( )
End Sub
End Class
Quels sont les codes équivalents en VB.net aux ces codes ?
Je souhaite que vous m'aidez et je n'oublierai pas vos aides.
Merci. -
Bonjour,
Je décide de refaire le code VB.6 en VB.net
Je suis bloqué et j'ai besoin vos aides.
Pouvez vous m'aider de trouver le code équivalent de VB.net ?
J'ai trois autres 'forms' qui sont codés en VB6 et je n'arrive pas à les traduire en VB.NET car ces sont difficiles que la première.
Voici le code de 'form2' :
Option Strict Off Option Explicit On Friend Class attribut_select Inherits System.Windows.Forms.Form Private Sub Check1_Click() End Sub Private Sub attribut_select_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load Dim cnx As ADODB.Connection Dim rst As ADODB.Recordset cnx = New ADODB.Connection rst = New ADODB.Recordset Dim cmd As ADODB.Command Dim param As ADODB.Parameter cmd = New ADODB.Command param = New ADODB.Parameter cnx.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" & "SERVER=127.0.0.1;" & "DATABASE=base_donnee;" & "UID=root;" & "PWD=;" cnx.Open() rst.Open("show columns from " & nom_table & "", cnx) attribut(0).Visible = False Dim j As Integer 'creation de 2 boutons en plus du premier crée manuellement 'For j = 1 To 2 j = 1 'While (j <= 2) While Not (rst.EOF) Me.attribut.Load(j) Me.attribut(j).Left = VB6.TwipsToPixelsX(Me.attribut(j - 1).Left) Me.attribut(j).Top = VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(Me.attribut(j - 1).Top) + 500) 'attribut_select.attribut(j).Caption = "attribut(" & Trim(CStr(j)) & ") crée par INDEX" 'suppression des espaces pour le nom Me.attribut(j).Text = rst.Fields(0).Value Me.attribut(j).Visible = True 'Next j j = j + 1 rst.MoveNext() End While nombre_attribut_select = j - 1 End Sub Private Sub valider_attribut_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles valider_attribut.Click Dim j As Short Dim p As Short For j = 1 To nombre_attribut_select If Me.attribut(j).CheckState = 1 Then attribut_select_selectionne(p) = Me.attribut(j).Text p = p + 1 End If Next j If p = 0 Then MsgBox("Vous devez sélectionner au moins un attribut") Else nombre_attribut_select_selectionne = p Me.Close() 'UPGRADE_ISSUE: L'instruction Load n'est pas pris(e) en charge. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="B530EFF2-3132-48F8-B8BC-D88AF543D321"' 'Load(attribut_where)' 'attribut_where.Show()' attribut_where.ShowDialog() End If End Sub End Class
Option Strict Off Option Explicit On Imports VB = Microsoft.VisualBasic Friend Class parametre_attribut_where Inherits System.Windows.Forms.Form Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click Dim valeur As Object 'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet valeur. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' valeur = attribut_where_selectionne(nombre_attribut_where_selectionne - 1) & "_" & valeur_where.Text 'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet valeur. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' valeur_attribut_where(nombre_attribut_where_selectionne - 1) = valeur 'valeur_attribut_where(nombre_attribut_where_selectionne - 1) = valeur_where.Text 'MsgBox attribut_where_selectionne(0) Me.Close() 'UPGRADE_ISSUE: L'instruction Load n'est pas pris(e) en charge. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="B530EFF2-3132-48F8-B8BC-D88AF543D321"' 'Load(attribut_where)' attribut_where.Show() attribut_where.Refresh() 'attribut_where.Show 1 End Sub Private Sub parametre_attribut_where_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load Dim ch As Object Dim taille As Object Dim pos As Object nom_attribut_where.Text = attribut_where_selectionne(nombre_attribut_where_selectionne - 1) & " IS :" Dim cnx As ADODB.Connection Dim rst As ADODB.Recordset cnx = New ADODB.Connection rst = New ADODB.Recordset Dim cmd As ADODB.Command Dim param As ADODB.Parameter cmd = New ADODB.Command param = New ADODB.Parameter cnx.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" & "SERVER=127.0.0.1;" & "DATABASE=base_connaissance;" & "UID=root;" & "PWD=;" cnx.Open() rst.Open("select designation from " & nom_table & " where designation like '" & attribut_where_selectionne(nombre_attribut_where_selectionne - 1) & "%'", cnx) While Not rst.EOF 'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet pos. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' pos = InStr(rst.Fields(0).Value, "_") 'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet taille. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' taille = Len(rst.Fields(0).Value) 'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet pos. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' 'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet taille. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' 'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet ch. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' ch = VB.Right(rst.Fields(0).Value, taille - pos) 'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet ch. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' valeur_where.Items.Add(ch) 'valeur_where.AddItem rst.Fields(0) rst.MoveNext() End While rst.Close() End Sub End Class
Voici le code de 'form4' :
Option Strict Off Option Explicit On Imports VB = Microsoft.VisualBasic Friend Class attribut_where Inherits System.Windows.Forms.Form Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click Dim indice As Object Dim Id As Object 'Dim i As Integer 'For i = 0 To nombre_attribut_select_selectionne - 1 'MsgBox attribut_select_selectionne(i) 'Next i 'For i = 0 To nombre_attribut_where_selectionne - 1 'MsgBox valeur_attribut_where(i) 'Next i 'For i = 0 To nombre_attribut_where_selectionne - 1 'MsgBox attribut_where_selectionne(i) 'Next i 'sauvegarde dans le fichier contexte.xls FileOpen(1, "fichier_out.txt", OpenMode.Output) PrintLine(1, "" & nom_table & "") PrintLine(1, nombre_attribut_select_selectionne) For i = 0 To nombre_attribut_select_selectionne - 1 PrintLine(1, attribut_select_selectionne(i)) Next i PrintLine(1, "1") PrintLine(1, nombre_attribut_where_selectionne) For i = 0 To nombre_attribut_where_selectionne - 1 PrintLine(1, "flou " & attribut_where_selectionne(i) & " IS " & valeur_attribut_where(i)) Next i FileClose(1) 'Dim vari As Date 'Dim varia As Date 'Dim x As Single 'Dim y As Single 'x = Timer 'MsgBox x Dim Start As Double Dim fin As Double Start = VB.Timer() 'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet Id. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' Id = Shell("prog.exe") 'y = Timer 'varia = Time fin = VB.Timer() MsgBox("Vous voulez afficher le résulat") MsgBox(Start * 1000000) 'MsgBox vari 'MsgBox varia 'MsgBox y - x & " Millisecondes" MsgBox(fin * 1000000) MsgBox(CStr(fin - Start) & "mmm") '* 1000000 FileOpen(2, "fichier_indice.txt", OpenMode.Input) Input(2, indice) FileClose(2) 'UPGRADE_WARNING: Impossible de résoudre la propriété par défaut de l'objet indice. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' If indice = 0 Then Me.Close() 'UPGRADE_ISSUE: L'instruction Load n'est pas pris(e) en charge. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="B530EFF2-3132-48F8-B8BC-D88AF543D321"' 'Load(cause)' 'cause.Show()' cause.ShowDialog() Else Me.Close() 'UPGRADE_ISSUE: L'instruction Load n'est pas pris(e) en charge. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="B530EFF2-3132-48F8-B8BC-D88AF543D321"' 'Load(reponse)' 'reponse.Show()' reponse.ShowDialog() End If End Sub Private Sub Command2_Click() Me.Close() 'UPGRADE_ISSUE: L'instruction Load n'est pas pris(e) en charge. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="B530EFF2-3132-48F8-B8BC-D88AF543D321"' 'Load(reponse)' 'reponse.Show()' reponse.ShowDialog() End Sub Private Sub Command3_Click() Me.Close() 'UPGRADE_ISSUE: L'instruction Load n'est pas pris(e) en charge. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="B530EFF2-3132-48F8-B8BC-D88AF543D321"' 'Load(cause)' 'cause.Show()' cause.ShowDialog() End Sub Private Sub attribut_where_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load Dim cnx As ADODB.Connection Dim rst As ADODB.Recordset cnx = New ADODB.Connection rst = New ADODB.Recordset Dim cmd As ADODB.Command Dim param As ADODB.Parameter cmd = New ADODB.Command param = New ADODB.Parameter cnx.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" & "SERVER=127.0.0.1;" & "DATABASE=base_donnee;" & "UID=root;" & "PWD=;" cnx.Open() rst.Open("show columns from " & nom_table & "", cnx) While Not (rst.EOF) Me.where_attribut.Items.Add(rst.Fields(0).Value) rst.MoveNext() End While rst.Close() End Sub 'UPGRADE_WARNING: L'événement where_attribut.SelectedIndexChanged peut se déclencher lorsque le formulaire est initialisé. Cliquez ici*: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"' Private Sub where_attribut_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles where_attribut.SelectedIndexChanged attribut_where_selectionne(nombre_attribut_where_selectionne) = Me.where_attribut.Text nombre_attribut_where_selectionne = nombre_attribut_where_selectionne + 1 parametre_attribut_where.ShowDialog() End Sub End Class
Quels sont les codes équivalents en VB.net aux ces codes ?
Merci.