English 中文(简体)
WPF数据网的电池价值(千兆瓦)
原标题:Get Cell value from WPF Datagrid (in vb)

然而,我正在将旧的电网方案转换为世界森林论坛,并遇到麻烦。 我将一些数据输入了数据表,并将其输入数据网。 我现在需要浏览,提取电池价值,并利用这些价值更新适当的数据库记录。

在我的旧方案中,这项工作使用了:

For i = 0 To DataGridView1.Rows.Count - 1

cellvalue = Me.datagrid.Items(i).Cells(8).Value).ToString

(insert to database) etc

next

我一直在搜捕,而且看来在妇女论坛中并不简单。 但是,我发现的所有工作例子都出现在C#中,而我并不认为这一编号与工作挂钩,而且似乎可以改为工作。 因此,如果有人能够向我提供一些法典(正文中),将会受到很大的赞赏。

最佳回答

If you ve already got a DataTable that contains your data, it is pretty easy to work with that:

Dim dt As New System.Data.DataTable
 ...Load your data into DataTable

For Each rw As System.Data.DataRow In dt.Rows
   cellValue = rw(8).ToString
    ...insert to database
Next
问题回答
For Each item As DataRowView In datagrid.Items    
cellvalue = item.Item("ColumnName") 
(insert to database) 
next 




相关问题
Is Shared ReadOnly lazyloaded?

I was wondering when I write Shared ReadOnly Variable As DataType = New DataType() Or alternatively Shared ReadOnly Variable As New DataType() Is it lazy loaded or as the instance initializes? ...

Entertaining a baby with VB.NET

I would like to write a little application in VB.NET that will detect a baby s cry. How would I get started with such an application?

Choose Enter Rather than Pressing Ok button

I have many fields in the page and the last field is a dropdown with list of values. When I select an item in a dropdown and press Enter, it doesn t do the "Ok". Instead I have to manually click on Ok ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

Set Select command in code

On button Click I want to Set the Select command of a Gridview. I do this and then databind the grid but it doesn t work. What am i doing wrong? protected void bttnView_Click(object sender, ...

Hover tooltip on specific words in rich text box?

I m trying to create something like a tooltip suddenly hoovering over the mouse pointer when specific words in the richt text box is hovered over. How can this be done?

热门标签