質問編集履歴
2
コードが少し違ったため
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
DataGridViewに表示したデータを取得したくて取得したのですが、Columnを選択すると1番上のデータが取得できてしまいます。これを改善したいのですがどうしたらいいでしょうか?
|
2
2
|
|
3
|
-
Private Sub
|
3
|
+
Private Sub DataGridView1_CellDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellDoubleClick
|
4
4
|
|
5
5
|
Dim f As New EntryForm
|
6
6
|
|
@@ -12,10 +12,18 @@
|
|
12
12
|
|
13
13
|
Dim table As DataTable = DataGridView1.DataSource
|
14
14
|
|
15
|
+
If DataGridView1.CurrentRow Is Nothing Then
|
16
|
+
|
17
|
+
Exit Sub
|
18
|
+
|
19
|
+
End If
|
20
|
+
|
21
|
+
|
22
|
+
|
15
23
|
Dim RowsSelect As Integer = DataGridView1.CurrentRow.Index
|
16
24
|
|
17
25
|
f.bangumiCd = DataGridView1(14, RowsSelect).Value
|
18
26
|
|
19
27
|
f.ShowDialog()
|
20
28
|
|
21
|
-
|
29
|
+
end sub
|
1
今、困ってる部分のコードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -1 +1,21 @@
|
|
1
1
|
DataGridViewに表示したデータを取得したくて取得したのですが、Columnを選択すると1番上のデータが取得できてしまいます。これを改善したいのですがどうしたらいいでしょうか?
|
2
|
+
|
3
|
+
Private Sub btnupdate_Click(sender As Object, e As EventArgs) Handles btnupdate.Click
|
4
|
+
|
5
|
+
Dim f As New EntryForm
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
f.ControlButton.Text = "更新"
|
10
|
+
|
11
|
+
f.modeselect = CommonConst.MODE.UPDATE
|
12
|
+
|
13
|
+
Dim table As DataTable = DataGridView1.DataSource
|
14
|
+
|
15
|
+
Dim RowsSelect As Integer = DataGridView1.CurrentRow.Index
|
16
|
+
|
17
|
+
f.bangumiCd = DataGridView1(14, RowsSelect).Value
|
18
|
+
|
19
|
+
f.ShowDialog()
|
20
|
+
|
21
|
+
End Sub
|