Hi everyone,
Just a simple question, I've been trying to figure out why my code is not working for a particular number. What I want to do is take the highest number from a row in my datagrid and take that number into another row, well I have got the value in a datagrid but when I take it to the next form its shown as 1. However other values work fine (so when I take them to the same form the values are correct). What I'm trying to do is take the value to form2 and +1 to the value.
My coding is as follows:
No matter what I do the value in that label is always 1. Any help or suggestions welcome.Code:'In the module Friend Plusone As Integer 'To get the highest number from the row in a label Dim conn As New OleDbConnection(String.Concat("Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & Application.StartupPath & "\CNS.mdb")) Dim Cmd As New OleDbCommand("Select MAX(LogNumber) FROM Log; ", conn) conn.Open() lblnext.Text = Cmd.ExecuteScalar.ToString conn.Close() 'Form2 Button frm2.lblnext.Text = Me.lblnext.Text Form2 Load Event lblnext.Text = Plusone.ToString + 1




Reply With Quote