Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Components & Controls
Grids
Winforms Grids
call CellContentDoubleClick event from button outside DataGridView?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="rajdh75, post: 184916, member: 68863"] Thanks [HEADING=3][USER=641]jmcilhinney[/USER][/HEADING] I applied your code for EditRow() as - [CODE lang="vbnet" title="EditRow"] Private Sub EditRow(row As DataGridViewRow) Dim cell = row.Cells Using dialogue As New FrmAddItemsNew With dialogue .TxtTestID.Text = cell(0).Value.ToString() .TxtInvoiceID.Text = cell(1).Value.ToString() .TxtProductID.Text = cell(2).Value.ToString() .CmbProductName.Text = CStr(cell(3).Value) .TxtHSN.Text = cell(4).Value.ToString() .TxtSerialNo.Text = cell(5).Value.ToString() .TxtUnit.Text = cell(6).Value.ToString() .TxtQty.Text = cell(7).Value.ToString() .TxtInclRate.Text = cell(8).Value.ToString() .TxtBaseRate.Text = cell(9).Value.ToString() .TxtAmount.Text = cell(10).Value.ToString() .TxtGST.Text = cell(11).Value.ToString() .TxtGSTAmt.Text = cell(12).Value.ToString() .TxtTotal.Text = cell(13).Value.ToString() .BtnEdit.Visible = True '.BtnEdit.Enabled = False If .ShowDialog() = DialogResult.OK Then cell(0).Value = .TxtTestID.Text cell(1).Value = .TxtInvoiceID.Text cell(2).Value = .TxtProductID.Text cell(3).Value = .CmbProductName.Text cell(4).Value = .TxtHSN.Text cell(5).Value = .TxtSerialNo.Text cell(6).Value = .TxtUnit.Text cell(7).Value = .TxtQty.Text cell(8).Value = .TxtInclRate.Text cell(9).Value = .TxtBaseRate.Text cell(10).Value = .TxtAmount.Text cell(11).Value = .TxtGST.Text cell(12).Value = .TxtGSTAmt.Text cell(13).Value = .TxtTotal.Text End If End With End Using End Sub[/CODE] For DataGridView1_CellContentDoubleClick as - [CODE lang="vbnet" title="DataGridView1_CellContentDoubleClick"]Private Sub DataGridView1_CellContentDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentDoubleClick EditRow(DataGridView1.Rows(e.RowIndex)) End Sub[/CODE] For BtnEdit_Click as - [CODE lang="vbnet" title="BtnEdit_Click"] Private Sub BtnEdit_Click(sender As Object, e As EventArgs) Handles BtnEdit.Click EditRow(DataGridView1.CurrentRow) End Sub[/CODE] Code for DataGridView1_CellContentDoubleClick works well when I Double click rows and edit. It works and database is updated for multiple rows but when I want to use this code by BtnEdit it updates multiple rows in datagridview1, but saves only first edited row to database. It doesnot save other updated rows in database. My Save code is as - [CODE lang="vbnet" title="BtnSave_Click"]Private Sub BtnSave_Click(sender As Object, e As EventArgs) Handles BtnSave.Click Me.Validate() Me.myDA.Update(Me.myDataSet.Tables("TblTest")) Me.myDataSet.AcceptChanges() MessageBox.Show("Invoice Updated.") End If Me.Close() End Sub[/CODE] Is anything wrong in BtnEdit code ? Thanks once again [/QUOTE]
Insert quotes…
Verification
Post reply
Components & Controls
Grids
Winforms Grids
call CellContentDoubleClick event from button outside DataGridView?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom