locked
Visual Basic Form load

    Question

  • I have the following code

    Private Sub SettlementStatment_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     
            Me.SettlementTableAdapter.Fill(Me.NightAuditDataSet.Settlement)

     '---------------------------------------------------------------------------------------------------------------------------'
      Dim row As DataRow = NightAuditDataSet.Tables(0).Rows(NightAuditDataSet.Tables(0).Rows.Count - 1)
    MessageBox.Show(row(0).ToString())
    Me.Sitetxt.Text = 2

     End Sub

    The fields are set up in the databindings properties at form[Desing]

    but when you load the form the fields do not populate.

    Even though the      MessageBox.Show(row(0).ToString())
    Shows the last record number.

    First time doing this --can you tell me the code for the sub
    if I give you this
    Server=FESSQL;Database=NightAudit;Trusted_Connection=yes;"
    Table Name ----Settlement
    Tried to make work -but had no luck

    I'm I missing something relating to this:

    myConnection = New SqlConnection(ConnStr)
                sql = "select * from tblSubCategories"
                da = New SqlDataAdapter(sql, myConnection)
                da.Fill(ds, "tblSubCategories")
                dg.DataSource = ds.Tables(0)


    JK
    Saturday, March 17, 2007 9:32 PM