質問するログイン新規登録

回答編集履歴

3

誤記訂正

2017/05/11 10:38

投稿

satou
satou

スコア19

answer CHANGED
@@ -39,9 +39,9 @@
39
39
  Private Sub ButtonUp_Click(sender As Object, e As EventArgs) Handles ButtonUp.Click
40
40
  RaiseEvent UpClick(Me, New EventArgs)
41
41
  End Sub
42
- Public Structure DataStructure
42
+ Public Structure DataStructure
43
- Dim ID AsInteger
43
+ Dim ID As Integer
44
- '.............
44
+ '.............
45
- End Structure
45
+ End Structure
46
46
  End Class
47
47
  ```

2

誤記訂正

2017/05/11 10:38

投稿

satou
satou

スコア19

answer CHANGED
@@ -15,20 +15,23 @@
15
15
  End Sub
16
16
 
17
17
  Private Sub 子フォーム_UpClick(sender As Object, e As EventArgs)
18
- with DataGridView1
18
+ With DataGridView1
19
19
  '1行上を選択
20
20
  '新たに選択した行のデータを取得
21
+ Dim _data as New DataStructure
22
+ _data.ID=....
23
+
21
- 子フォーム.SetData(.....)
24
+ 子フォーム.SetData( _data )
22
- end with
25
+ End With
23
- end sub
26
+ End Sub
24
27
  End Class
25
28
 
26
29
 
27
30
  Public Class 子フォーム
28
31
  Public Event UpClick(ByVal sender As Object, ByVal e As EventArgs)
29
32
  '親フォームからデータを取得
30
- Public Sub SetData(....)
33
+ Public Sub SetData(ByVal d As DataStructure)
31
- label_id.text=.....
34
+ label_id.text=d.ID
32
35
  '......表示
33
36
  End Sub
34
37
 
@@ -36,8 +39,9 @@
36
39
  Private Sub ButtonUp_Click(sender As Object, e As EventArgs) Handles ButtonUp.Click
37
40
  RaiseEvent UpClick(Me, New EventArgs)
38
41
  End Sub
39
-
42
+ Public Structure DataStructure
43
+ Dim ID AsInteger
44
+ '.............
45
+ End Structure
40
46
  End Class
41
-
42
-
43
47
  ```

1

誤記訂正

2017/05/11 10:37

投稿

satou
satou

スコア19

answer CHANGED
@@ -5,7 +5,7 @@
5
5
  同じ立場になった場合、個人的には、コードが長くなりますが、以下のような感じで作成すると思います。
6
6
 
7
7
  ```ここに言語を入力
8
- PPublic Class 親フォーム
8
+ Public Class 親フォーム
9
9
 
10
10
  Private Sub Button詳細_Click(sender As Object, e As EventArgs) Handles Button詳細.Click
11
11
  Using 子フォーム As New 子フォーム
@@ -15,7 +15,7 @@
15
15
  End Sub
16
16
 
17
17
  Private Sub 子フォーム_UpClick(sender As Object, e As EventArgs)
18
- with datagridview1
18
+ with DataGridView1
19
19
  '1行上を選択
20
20
  '新たに選択した行のデータを取得
21
21
  子フォーム.SetData(.....)
@@ -33,7 +33,7 @@
33
33
  End Sub
34
34
 
35
35
  '上をクリックした旨のイベントを発行
36
- Private Sub ButtonUp(....) Handles ButtonUp.Click
36
+ Private Sub ButtonUp_Click(sender As Object, e As EventArgs) Handles ButtonUp.Click
37
37
  RaiseEvent UpClick(Me, New EventArgs)
38
38
  End Sub
39
39