How to get values of a excel row in actionpane using VSTO


Hi all this code will help you to get the data of the selected row of excel sheet in the actionpane with textboxes same in number as the columns of the row…..
 
 
 
 

Private Sub BtnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnEdit.Click

Try

Globals.ThisWorkbook.ActionsPane.Controls.Add(apedit)

Dim dsSrc As DataTable = Nothing

dsSrc = Globals.Sheet2.List1.DataSource

Dim intValue As Integer = Globals.Sheet2.List1.SelectedIndex – 1

dsSrc = Globals.Sheet2.List1.DataSource

Globals.ThisWorkbook.ActionsPane.Controls.Add(apedit)

apedit.TxtProjectID.Text = dsSrc.Rows(intValue)(0).ToString

apedit.TxtBIDID.Text = dsSrc.Rows(intValue)(1).ToString

apedit.TxtReference.Text = dsSrc.Rows(intValue)(2).ToString

apedit.TxtSystem.Text = dsSrc.Rows(intValue)(3).ToString

apedit.txtArea.Text = dsSrc.Rows(intValue)(4).ToString

apedit.TxtBidPartNumber.Text = dsSrc.Rows(intValue)(5).ToString

apedit.TxtBidManu.Text = dsSrc.Rows(intValue)(6).ToString

apedit.TxtBidDesc.Text = dsSrc.Rows(intValue)(7).ToString

apedit.txtBidQty.Text = dsSrc.Rows(intValue)(8).ToString

apedit.TxtBidTotalCost.Text = dsSrc.Rows(intValue)(9).ToString

apedit.TxtBidTotalPrice.Text = dsSrc.Rows(intValue)(10).ToString

Catch ex As Exception

MsgBox(ex.ToString)

End Try

End Sub

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: