Hi Declare
Dim Ds As New DataSet
at start of class
When you declare Dataset at function level then you cant use that dataset out side of the function or you can use like this basic programing rule scope of a variable
Private Sub Display(byVal Ds as DataSet)
TxtName.Text = Ds.Tables("LEDG").Rows(Rc)("Name").ToString
CmbGrp.Text = Ds.Tables("LEDG").Rows(Rc)("Grp").ToString
TxtAdd1.Text = Ds.Tables("LEDG").Rows(Rc)("Add1").ToString
TxtAdd2.Text = Ds.Tables("LEDG").Rows(Rc)("Add2").ToString
CmbCity.Text = Ds.Tables("LEDG").Rows(Rc)("City").ToString
TxtDist.Text = Ds.Tables("LEDG").Rows(Rc)("Dist").ToString
TxtPIN.Text = Ds.Tables("LEDG").Rows(Rc)("Pincode").ToString
DBState.Text = Ds.Tables("LEDG").Rows(Rc)("State").ToString
TxtEmail.Text = Ds.Tables("LEDG").Rows(Rc)("Email").ToString
TxtPhone.Text = Ds.Tables("LEDG").Rows(Rc)("Landline").ToString
TxtMob.Text = Ds.Tables("LEDG").Rows(Rc)("Mobile").ToString
TxtVAT.Text = Ds.Tables("LEDG").Rows(Rc)("VATNO").ToString
TxtCST.Text = Ds.Tables("LEDG").Rows(Rc)("CSTNO").ToString
TxtGST.Text = Ds.Tables("LEDG").Rows(Rc)("GSTNO").ToString
TxtPAN.Text = Ds.Tables("LEDG").Rows(Rc)("PAN").ToString
End Sub
Private Sub BtnFirst_Click_1(sender As Object, e As EventArgs) Handles BtnFirst.Click
Dim Da As New MySqlDataAdapter
Dim Ds As New DataSet
SqlQuery = "Select * from Ledgers"
Sqlcommand = New MySqlCommand(SqlQuery, Conn)
count = Sqlcommand.ExecuteScalar
Da.SelectCommand = Sqlcommand
Da.Fill(Ds, "LEDG")
Rc = 0
Display(Ds)
End Sub