
Private Sub Button8_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Dim disco As System.IO.File
Dim leggi As System.IO.StreamReader
Dim riga As String
Dim d() As String
Dim foto As Integer
leggi = disco.OpenText("c:vb est.txt")
While riga < leggi.Peek - 1
riga = leggi.ReadLine()
TextBox2.Text = riga
d = TextBox2.Text.Split(",")
For r = 0 To UBound(d)
TextBox3.Text = (d(0))
Button1.Text = (d(1))
Button2.Text = (d(2))
Button3.Text = (d(3))
Button4.Text = (d(4))
TextBox5.Text = (d(5))
'comandi per inserire jpg
TextBox4.Text = foto
Next : Exit Sub (se tolgo exit sub mi crasha)
End While
leggi.Close()
End Sub
(dati tasto, ne inserisco uno, dato che poi tutti e 4 avranno la stessa routine)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox3.Text = "" Then
ElseIf Button1.Text = TextBox5.Text Then
Button1.BackColor = Color.Green
MsgBox("La risposta è esatta", MsgBoxStyle.Information, "AVVISO")
ElseIf MsgBox("La risposta errata", MsgBoxStyle.Information, "AVVISO") Then
Button1.BackColor = Color.Red
End If
End Sub |
Private Sub Button8_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Dim leggi As System.IO.StreamReader
Dim riga, d() As String
Dim foto As Integer
leggi = IO.File.OpenText("c: est.txt")
While leggi.Peek <> -1
riga = leggi.ReadLine()
TextBox2.Text = riga
d = TextBox2.Text.Split(",")
For r = 0 To UBound(d)
TextBox3.Text = (d(0))
Button1.Text = (d(1))
Button2.Text = (d(2))
Button3.Text = (d(3))
Button4.Text = (d(4))
TextBox5.Text = (d(5))
'comandi per inserire jpg
TextBox4.Text = foto
Next
End While
leggi.Close()
End Sub |
Private Sub Button8_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
'tasto carica domanda button8
leggi = disco.OpenText("c:vb est.txt")
riga = leggi.ReadLine()
ListBox1.Items.Add(riga)
While leggi.Peek <> -1
d = riga.Split(",")
'textbox della domanda
TextBox3.Text = d(0)
'tasti di risposta
Button1.Text = d(1)
Button2.Text = d(2)
Button3.Text = d(3)
Button4.Text = d(4)
'risposta esatta
TextBox5.Text = d(5)
'tasto per caricare eventualmente la foto
TextBox6.Text = d(6) : Exit Sub 'aspetta la risposta dei button 1,2,3,4
End While
leggi.Close()
End Sub (l'errore potrebbe essere in EXIT SUB, se lo tolgo mi va in errore, se lo lascio non carica il ciclo,la seconda domanda,ect ect)
Dim riga As String
leggi = disco.OpenText("c:vb est.txt")
While leggi.Peek <> -1
riga = leggi.ReadLine()
ListBox1.Items.Add(riga)
TextBox2.Text = riga
MsgBox("ok")
End While
leggi.Close()
End Sub (in questo modo esegue il ciclo ad ogni conferma tasto msgbox, ma non è abbinata ai button)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Dim riga As String
'leggi = disco.OpenText("c:vb est.txt") (FORSE NON SERVE)
If TextBox3.Text = "" Then
ElseIf Button1.Text = TextBox5.Text Then
Button1.BackColor = Color.Green
MsgBox("Risposta esatta", MsgBoxStyle.Information, "AVVISO")
ElseIf Button1.Text <> TextBox5.Text Then
Button1.BackColor = Color.Red
MsgBox("La risposta esatta è: " & TextBox5.Text, MsgBoxStyle.Information, "La risposta è errata")
End If
Button1.BackColor = Color.LightGray
End Sub (questo è uno dei 4 tasti di risposta................ dov'è che sbaglio?)
|
