Salve io ho scritto un po' codice che mi permette di leggere un file xml, ma non funzia![]()
![]()
potete provare a farlo funzionare?codice:Dim reader As XmlTextReader = New XmlTextReader(GetCurrentDirectory() & "\dati\elementi.xml") Dim stringa, stringa2 As String Dim cs As Boolean = False Try Do While (reader.Read()) Select Case reader.NodeType Case XmlNodeType.Element ' fino a qui funzia If reader.HasAttributes = True Then If attributes exist reader.MoveToFirstAttribute() stringa = reader.Name.ToString stringa2 = reader.Value.ToString MsgBox(stringa & vbCrLf & stringa2) While reader.MoveToNextAttribute() stringa = reader.Name.ToString stringa2 = reader.Value.ToString MsgBox(stringa & vbCrLf & stringa2) If stringa = "carattere" Then lblfont.Text = stringa2 End If If stringa = "grandezzafont" Then lbgrandezza.SelectedItem = stringa2 End If If stringa = "grassetto" Then If (stringa2 = "true" Or stringa2 = "1") Then CBbold.Checked = True Else CBbold.Checked = False End If End If If stringa = "italico" Then If (stringa2 = "true" Or stringa2 = "1") Then CBitalic.Checked = True Else CBitalic.Checked = False End If End If If stringa = "cambiamenti" Then If (stringa2 = "true" Or stringa2 = "1") Then RBCsi.Checked = True Else RBCno.Checked = True End If End If If stringa = "accapo" Then If (stringa2 = "true" Or stringa2 = "1") Then RBaccaposi.Checked = True Else RBaccapono.Checked = True End If End If If stringa = "salvataggio" Then -------- -------- -------- End If End If End If End While End Select Loop reader.Close() Return True Catch ex As Exception MsgBox("Errore [112] " & ex.Message) reader.Close() Return False End Try reader.Close()
Grazie Molto![]()

Rispondi quotando