ecco un pò di codice
questo è il bottone presente nel form fattura per ricercare un cliente
passo i dati del form ricerca cliente tramite l'oggetto rccodice:Private Sub Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button6.Click dim rc As New RicercaCliente() rc.ShowDialog() If rc.ok = True Then 'TRAMITE QUESTI SOTTO PASSO I DATI ALLE TEXTBOX TextBox13.Text = rc.campo(8) TextBox24.Text = rc.campo(8) ..... End If
questo invece è il form RicercaCliente
codice:Private Sub leggiclt() Dim a As Integer For a = 0 To DataSet11.clienti.Columns.Count - 1 Try campo(a) = DataView1.Item(DataGrid1.CurrentRowIndex).Item(a) MsgBox(campo(a)) Catch ex As InvalidCastException campo(a) = "" End Try Next a End Sub Private Sub RicercaCliente_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load OleDbDataAdapter1.Fill(DataSet11.clienti) If DataSet11.clienti.Rows.Count > 0 Then DataGrid1.Select(0) leggiclt() End If End Sub Private Sub Datagrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged Try DataGrid1.Select(DataGrid1.CurrentRowIndex) leggiclt() Catch End Try End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ok = True Me.Close() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ok = False Me.Close() End Sub
praticamente quando sto nel tabpage dove sono i presenti i textbox me li scrive correttamente ma se ci clicco sopra i textbox o cambio tabpage spariscono
spero che nn sia davvero magia nera![]()

Rispondi quotando