Cor3Quad Posted January 11, 2013 Report Posted January 11, 2013 Am urmatorul cod : Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick MessageBox.Show("blabla?", "blabla2", MessageBoxButtons.YesNo) If MsgBoxResult.Yes Then ProgressBar1.Increment(1) Label1.Text = ProgressBar1.Value & ("%") End If If ProgressBar1.Value = 100 Then Me.Close() End If End SubEnd ClassTreaba functioneaza in felul urmator , dau click pe un "buton" si trebe sa mi se deschida o fereastra noua sa intrebe ce am scris eu iar daca dau Yes sa porneasca progress bar-u.Problema ii ca imi apare asa :http://i50.tinypic.com/35lc3y8.jpgProgress bar-u porneste chiar daca dau Yes sau No si imi apar o mie de ferestre cu intrebarea.Cum rezolv ? Quote
DrGrim Posted January 11, 2013 Report Posted January 11, 2013 Dim result = MessageBox.Show("blabla?", "blabla2", MessageBoxButtons.YesNo) If result = DialogResult.Yes Then ProgressBar1.Increment(1) End Iffoloseste ce am scris mai sus si o sa mearga Quote
Cor3Quad Posted January 11, 2013 Author Report Posted January 11, 2013 Dim result = MessageBox.Show("blabla?", "blabla2", MessageBoxButtons.YesNo) If result = DialogResult.Yes Then ProgressBar1.Increment(1) End Iffoloseste ce am scris mai sus si o sa meargaNu merge , tot imi apar n ferestre deschide , doar ca acuma nu mai porneste progress bar-u.//folosesc timer pt progress bar Quote
DrGrim Posted January 11, 2013 Report Posted January 11, 2013 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Timer1.Stop() Dim result = MessageBox.Show("blabla?", "blabla2", MessageBoxButtons.YesNo) If result = DialogResult.Yes Then ProgressBar1.Increment(1) Label1.Text = ProgressBar1.Value & ("%") Timer1.Start() End If End Subam facut proba si merge ,apare fereastra cu mesajul (una singura) in cazul in care dai pe Yes progressbarul va creste dupa care va aparea un alt message box . Fa o proba Quote
Cor3Quad Posted January 11, 2013 Author Report Posted January 11, 2013 Tot nu merge Apare o singura fereastra , dau Yes si fereastra apare din nou , pt fiecare Yes dat procentul creste cu 1% Quote
DrGrim Posted January 11, 2013 Report Posted January 11, 2013 aaaaaaaa acu' m-am prins tu vrei ca dupa primul yes sa tot progreseze bara de progres fara a-ti aparea un alt messagebox uite aici ai alt cod : Dim i As Integer = 0 Dim result = MessageBox.Show("blabla?", "blabla2", MessageBoxButtons.YesNo) Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick i = 1 If i = 1 = True Then If result = DialogResult.Yes Then ProgressBar1.Increment(1) 'Label1.Text = ProgressBar1.Value & ("%") End If End If End Sub Quote
Cor3Quad Posted January 11, 2013 Author Report Posted January 11, 2013 Asta ii tot codu :Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Timer1.Start() End Sub Dim i As Integer = 0 Dim result = MessageBox.Show("blabla?", "blabla2", MessageBoxButtons.YesNo) Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick i = 1 If i = 1 = True Then If result = DialogResult.Yes Then ProgressBar1.Increment(1) Label1.Text = ProgressBar1.Value & ("%") End If End If End SubEnd ClassAsa ai zis tu sa fac , nu merge cum vreau eu.Dau Start Debugging imi apare msgbox-u cu "bla bla" , dau Yes/no imi apare programul , dau Start si incepe progress bar-u fara sa mai apara intrebare.Deci codul tau nu face decat sa ma intrebe cand dau 2xclick pe program nu cand dau eu Start. Quote
DrGrim Posted January 11, 2013 Report Posted January 11, 2013 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim result = MessageBox.Show("blabla?", "blabla2", MessageBoxButtons.YesNo) If result = DialogResult.Yes Then Timer1.Start() End If End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick ProgressBar1.Increment(1) ' Label1.Text = ProgressBar1.Value & ("%") End Subnoh daca nici asta nu face ce vrei atunci is nebun . Quote
Cor3Quad Posted January 11, 2013 Author Report Posted January 11, 2013 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim result = MessageBox.Show("blabla?", "blabla2", MessageBoxButtons.YesNo) If result = DialogResult.Yes Then Timer1.Start() End If End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick ProgressBar1.Increment(1) ' Label1.Text = ProgressBar1.Value & ("%") End Subnoh daca nici asta nu face ce vrei atunci is nebun .Asta-i , mersi mult Quote