As per the qry i undestood was, whn u click on the Grid on Form, the data should be filtered as per the PK value and form controls should have the value of the Gird's Primary Key Value.
As per ur code no need to create a PK in the DataTable, whn u fill the dataset after filling it use the select method of the Dataset and the Pass the Grid's Selected Rows Value in it and Bind to the Controls/Combo u want.
Dim dataset3 As New DataSet()
SqlDataAdapter2.Fill(dataset3, "clientes")
dataset3.Tables("clientes").Select("nome='" & DATAGRID'S SELECTED ROW VALUE & "'")
if isnothing(combobox1.datasource))=FALSE then
combobox1.datasource=NOTHING
end if
combobox1.datasource=dataset3.Tables("clientes")
combobox1.displaymember="nome"
I Hope this will solve ur problem.
if u any further quieries u can get back to me @
Allways try and U'll Be successful
Bhavin
|