Torna al Thread
Private Sub edit()
Try
SqlCmd.CommandText = "GetPagamenti_2"
SqlCmd.Parameters.Add("Codice", SqlDbType.VarChar).Value = Me.ListView1.SelectedItems(0).Text
SqlCmd.Connection = Db
SqlCmd.CommandType = CommandType.StoredProcedure
SqlDr = SqlCmd.ExecuteReader
If SqlDr.Read() Then
My.Application.OpenForms.Item("Pagamenti").Controls("Textbox1").Text = Me.ListView1.SelectedItems(0).Text
My.Application.OpenForms.Item("Pagamenti").Controls("Textbox2").Text = SqlDr.GetSqlString(1).Value
My.Application.OpenForms.Item("Pagamenti").Controls("Combobox1").Text = SqlDr.GetSqlString(2).Value
My.Application.OpenForms.Item("Pagamenti").Controls("Combobox2").Text = SqlDr.GetSqlString(3).Value
If SqlDr.GetSqlString(3).Value = "FINE MESE" Then
Pagamenti.enable_campi(True)
End If
My.Application.OpenForms.Item("Pagamenti").Controls("Textbox4").Text = SqlDr.GetSqlInt32(4).Value
My.Application.OpenForms.Item("Pagamenti").Controls("Textbox5").Text = SqlDr.GetSqlInt32(5).Value
My.Application.OpenForms.Item("Pagamenti").Controls("Textbox6").Text = SqlDr.GetSqlInt32(6).Value
My.Application.OpenForms.Item("Pagamenti").Controls("Textbox3").Text = SqlDr.GetSqlString(7).Value
My.Application.OpenForms.Item("Pagamenti").Controls("GroupBox31").Controls("Label31").Text = SqlDr.GetSqlString(8).Value
My.Application.OpenForms.Item("Pagamenti").Controls("Textbox21").Text = change(SqlDr.GetSqlDecimal(9).Value, SqlDr.GetSqlInt32(26).Value)
My.Application.OpenForms.Item("Pagamenti").Controls("GroupBox15").Controls("Textbox8").Text = SqlDr.GetSqlString(10).Value
My.Application.OpenForms.Item("Pagamenti").Controls("GroupBox16").Controls("Textbox9").Text = SqlDr.GetSqlInt32(11).Value
My.Application.OpenForms.Item("Pagamenti").Controls("GroupBox16").Controls("Textbox10").Text = SqlDr.GetSqlInt32(12).Value
My.Application.OpenForms.Item("Pagamenti").Controls("GroupBox16").Controls("Textbox11").Text = SqlDr.GetSqlInt32(13).Value
My.Application.OpenForms.Item("Pagamenti").Controls("GroupBox16").Controls("Textbox12").Text = SqlDr.GetSqlInt32(14).Value
My.Application.OpenForms.Item("Pagamenti").Controls("GroupBox16").Controls("Textbox13").Text = SqlDr.GetSqlInt32(15).Value
My.Application.OpenForms.Item("Pagamenti").Controls("GroupBox16").Controls("Textbox14").Text = SqlDr.GetSqlInt32(16).Value
My.Application.OpenForms.Item("Pagamenti").Controls("GroupBox16").Controls("Textbox15").Text = SqlDr.GetSqlInt32(17).Value
My.Application.OpenForms.Item("Pagamenti").Controls("GroupBox16").Controls("Textbox16").Text = SqlDr.GetSqlInt32(18).Value
My.Application.OpenForms.Item("Pagamenti").Controls("GroupBox16").Controls("Textbox17").Text = SqlDr.GetSqlInt32(19).Value
My.Application.OpenForms.Item("Pagamenti").Controls("GroupBox16").Controls("Textbox18").Text = SqlDr.GetSqlInt32(20).Value
My.Application.OpenForms.Item("Pagamenti").Controls("GroupBox16").Controls("Textbox19").Text = SqlDr.GetSqlInt32(21).Value
My.Application.OpenForms.Item("Pagamenti").Controls("GroupBox16").Controls("Textbox20").Text = SqlDr.GetSqlInt32(22).Value
End If
SqlDr.Close()
SqlCmd.Parameters.Clear()
SqlCmd.Dispose()
My.Application.OpenForms.Item("Pagamenti").Controls("Button1").Text = "Aggiorna (F8)"
My.Application.OpenForms.Item("Pagamenti").Controls("Textbox1").Enabled = False
My.Application.OpenForms.Item("Pagamenti").Controls("Textbox2").Focus()
modifica = True
My.Application.OpenForms.Item("Pagamenti").Controls("Textbox2").Focus()
Catch
MessageBox.Show(Err.Description, "INVOICE.IT", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
SqlDr.Close()
SqlCmd.Parameters.Clear()
SqlCmd.Dispose()
End Try
End Sub