Oppure

Loading
22/06/11 6:29
Antonello74
Ari salve a tutti, sono di nuovo qui a chiedere il vostro aiuto, visto che è l'unico forum, che risolve i problemi.

E questo è il codice che scrivo per inserire le textbox;
Private Sub DutchBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DutchBack.Click
        Me.DataGridView1.ReadOnly = False

        Dim i As Integer
        Dim x As Integer = 8
        Dim y As Integer = 100
        Dim numerocasella As Integer = 0
        numerocasella = DataGridView1.RowCount - 1
        If variabile = True Then
            If DutchBack.Focus = True Then
                For i = 0 To numerocasella
                    Dim textbox, textbox1, textbox2, textbox3, textbox4 As New TextBox
                    If DataGridView1.Item(0, i).Selected = True Then
                        textbox.Name = "IdSelection" & i.ToString
                        textbox.Location = New Point(x, y)
                        textbox.Size = New Size(70, 20)
                        textbox.Text = DataGridView1.Item(0, i).Value
                        Me.DutchBack.Controls.Add(textbox)
                        textbox1.Name = "Quota" & i.ToString
                        textbox1.Location = New Point(93, y)
                        textbox1.Size = New Size(50, 20)
                        textbox1.Text = DataGridView1.Item(4, i).Value
                        Me.DutchBack.Controls.Add(textbox1)
                        textbox3.Name = "InversoQuota" & i.ToString
                        textbox3.Location = New Point(403, y)
                        textbox3.Size = New Size(30, 20)
                        textbox3.Text = FormatNumber(1 / textbox1.Text, 2)
                        Me.DutchBack.Controls.Add(textbox3)
                        y = y + 38

                    End If

                Next
            End If
        End If
        txTotaleQuote.Text = 0
        For i = 0 To numerocasella
            If DataGridView1.Item(0, i).Selected = True Then
                txTotaleQuote.Text = FormatNumber(CDbl(txTotaleQuote.Text) + (1 / DataGridView1.Item(4, i).Value), 2)

            End If
        Next
        txTotaleQuote.Text = FormatNumber(1 / txTotaleQuote.Text, 2)
        y = 100
        For i = 0 To numerocasella
            If DataGridView1.Item(0, i).Selected = True Then
                Dim textbox2, textbox4 As New TextBox

                textbox2.Name = "Stake" & i.ToString
                textbox2.Location = New Point(149, y)
                textbox2.Size = New Size(50, 20)
                textbox2.Text = Stake(txStakeTotale.Text, txTotaleQuote.Text, DataGridView1.Item(4, i).Value)
                Me.DutchBack.Controls.Add(textbox2)
                textbox4.Name = "Vincita" & i.ToString
                textbox4.Location = New Point(205, y)
                textbox4.Size = New Size(50, 20)
                textbox4.Text = CDec(textbox2.Text) * CDec(DataGridView1.Item(4, i).Value)
                Me.DutchBack.Controls.Add(textbox4)
                y = y + 38
            End If
        Next


    End Sub


adesso io vorrei che al cambiamento del contenuto di una specificata cella del datagridview, mi deve aggiornare la textbox con il nome quota.
qualcuno mi può aiutare?.
Grazie a tutti
Ultima modifica effettuata da Antonello74 22/06/11 9:06
aaa
22/06/11 8:44
R0gerBlack
Allora innanzitutto ti consiglio di mettere il codice nei tag code /code (tra le [] ).

Per aggiornare la TextBox durante un ciclo for basta che fai

TextBox1.Refresh()


Anche se questo rallenterà leggermente il ciclo
Spero di esserti stato di aiuto :k:
aaa
22/06/11 9:04
Antonello74
un dubbio, mi dite a che evento del datagridview dovrei fare il refresch della text box?, e poi mi sa che non funziona perchè è un controllo che aggiungo e mi sa che non vede textbox1.

P.S. Mi scuso se non ho messo il codice tra [] lo faccio subito.
aaa
22/06/11 10:48
Il Totem
Eventi: CellEndEdit, CellFormatting, CellValueChanged, CallValidated.

TextBox1 è visibile a tutti i membri del form, in quanto è dichiarata dentro il form stesso.
aaa