Como modifico la celda que seleccione de un Grid
Mi problema es saber como modificar la celda que seleccione en un Grid al hacer click a un boton, sin que me permita modificar las demas.
aca tenes todo un ejemplo, fijate y adaptalo a tu programa, salu2
Private Sub text2_Change()
Txtnom.DataField = "nombre"
Txtstock.DataField = "Stock"
Txtpcost.DataField = "preciofinalcosto"
Txtpventa.DataField = "precioventa"
If text2.Text <> "" Then
Adodc1.Recordset.Filter = "nombre like '*" + text2.Text + "*'"
Else
Adodc1.Recordset.Filter = ""
Adodc1.Refresh
End If
End Sub
Private Sub Form_Load()
Command2.Cancel = True
Adodc1.Visible = False
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path & "Control2.mdb" + ";Persist Security Info=False"
Adodc1.RecordSource = "Select *from tblnuevoproducto"
Adodc1.Refresh
End Sub
Private Sub Command1_Click()
With Adodc1.Recordset
If Txtpcost.Text = "" Then
MsgBox "No se pueden actualizar datos, ingrese el producto a buscar", vbInformation + vbOKOnly, "Atencion"
Else
!preciofinalcosto = Txtpcost.Text
!precioventa = Txtpventa.Text
!stock = Txtstock.Text
!nombre = Txtnom.Text
.Update
End If
End With
Adodc1.Refresh
text2.Text = ""
DataGrid1.Refresh
End Sub
Private Sub text2_Change()
Txtnom.DataField = "nombre"
Txtstock.DataField = "Stock"
Txtpcost.DataField = "preciofinalcosto"
Txtpventa.DataField = "precioventa"
If text2.Text <> "" Then
Adodc1.Recordset.Filter = "nombre like '*" + text2.Text + "*'"
Else
Adodc1.Recordset.Filter = ""
Adodc1.Refresh
End If
End Sub
Private Sub Form_Load()
Command2.Cancel = True
Adodc1.Visible = False
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path & "Control2.mdb" + ";Persist Security Info=False"
Adodc1.RecordSource = "Select *from tblnuevoproducto"
Adodc1.Refresh
End Sub
Private Sub Command1_Click()
With Adodc1.Recordset
If Txtpcost.Text = "" Then
MsgBox "No se pueden actualizar datos, ingrese el producto a buscar", vbInformation + vbOKOnly, "Atencion"
Else
!preciofinalcosto = Txtpcost.Text
!precioventa = Txtpventa.Text
!stock = Txtstock.Text
!nombre = Txtnom.Text
.Update
End If
End With
Adodc1.Refresh
text2.Text = ""
DataGrid1.Refresh
End Sub
