how can i get the value ...which code write in button click event that get my id..
USE DATATABLE

 Public Function inst() As DataTable
        Dim tb2 As New DataTable
        Dim st As String
        Dim dfsty As DataSet
        Dim df As New SqlClient.SqlDataAdapter



        Try

            cn.Open()
            st = "SELECT EmMaster_EmploId FROM(EmMaster) WHERE EmMaster_EmploId=(SELECT max(EmMaster_EmploId) FROM EmMaster)"
            df = New SqlDataAdapter(st, cn)
            df.Fill(dfsty, "EmMasater")
            tb2 = dfsty.Tables(0)
            cn.Close()




        Catch ex As Exception
            MessageBox.Show(ex.Message)
        Finally
            cn.Close()

        End Try
        Return tb2


    End Function

    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnSave.Click

        Try
            Dim dss As DataTable
            dss = inst()

You can read data from datatable through data row object .

LIKE THIS

 txtEmMaster_Id.Text = ds.Rows(0).Item("EmMaster_ID")
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.