Ciao a tutti,E' una cosa banale (Penso) ,ma non riesco a farla...
Come faccio ad aggiungere un tag ad ogni elemento che aggiungo in una listbox???
Da una query ad un database tiro fuori alcuni dati e li aggiungo ad una listbox,vorrei aggiungere anche un tag per ogni elemento aggiunto.
Questo è il codice.
Grazie
codice:
Dim RicercaAll As New System.Data.SqlServerCe.SqlCeCommand("SELECT * FROM Articoli WHERE ARCODART = ('" & txtcerca.Text & "') ORDER BY ARCODART ASC", ConnSqlCe)
ConnSqlCe.Open()
Dim rs2 As Data.SqlServerCe.SqlCeResultSet = RicercaAll.ExecuteResultSet(Data.SqlServerCe.ResultSetOptions.Scrollable)
RicercaAll.ExecuteReader()
If rs2.HasRows = False Then
MsgBox("Articolo Non Presente")
Else
Do While rs2.Read
If rs2.IsDBNull(0) = False Then
ARCODART = CStr(rs2.GetValue(0))
If InStr(ARCODART, "'", CompareMethod.Text) Then
ARCODART = ARCODART.Replace("'", "''")
End If
Else
ARCODART = " "
End If
If rs2.IsDBNull(1) = False Then
ARDESART = CStr(rs2.GetValue(1))
If InStr(ARDESART, "'", CompareMethod.Text) Then
ARDESART = ARDESART.Replace("'", "''")
End If
Else
ARDESART = " "
End If
If rs2.IsDBNull(2) = False Then
ARDESSUP = CStr(rs2.GetValue(2))
If InStr(ARDESSUP, "'", CompareMethod.Text) Then
ARDESSUP = ARDESSUP.Replace("'", "''")
End If
Else
ARDESSUP = " "
End If
If rs2.IsDBNull(3) = False Then
ARUM = CStr(rs2.GetValue(3))
If InStr(ARUM, "'", CompareMethod.Text) Then
ARUM = ARUM.Replace("'", "''")
End If
Else
ARUM = " "
End If
If rs2.IsDBNull(4) = False Then
ARLIS = CStr(rs2.GetValue(4))
If InStr(ARLIS, "'", CompareMethod.Text) Then
ARLIS = ARLIS.Replace("'", "''")
End If
Else
ARLIS = " "
End If
If rs2.IsDBNull(5) = False Then
ARCODIVA = CStr(rs2.GetValue(5))
If InStr(ARCODIVA, "'", CompareMethod.Text) Then
ARCODIVA = ARCODIVA.Replace("'", "''")
End If
Else
ARCODIVA = " "
End If
If rs2.IsDBNull(6) = False Then
ARGRUMER = CStr(rs2.GetValue(6))
If InStr(ARGRUMER, "'", CompareMethod.Text) Then
ARGRUMER = ARGRUMER.Replace("'", "''")
End If
Else
ARGRUMER = " "
End If
If rs2.IsDBNull(7) = False Then
ARCAT = CStr(rs2.GetValue(7))
If InStr(ARCAT, "'", CompareMethod.Text) Then
ARCAT = ARCAT.Replace("'", "''")
End If
Else
ARCAT = " "
End If
Listbox1.Items.Add(ARDESART)
Loop
ConnSqlCe.Close()