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

質問編集履歴

6

宣言されていない変数の修正

2021/01/06 00:37

投稿

TEC_S
TEC_S

スコア79

title CHANGED
File without changes
body CHANGED
@@ -90,7 +90,7 @@
90
90
  Dim setAddres As String = btn.Name.Substring(6)
91
91
  Dim strValue As String = ""
92
92
 
93
- For i = 0 To DmMaxNum
93
+ For i = 0 To DMaxNum
94
94
  If DLabel(i).Name = "lbl" & setAddres Then 'ここでSystem.NullReferenceException
95
95
  idx = i
96
96
  strValue = DText(idx).Text '値を入れる

5

宣言されていない変数のソース追加

2021/01/06 00:37

投稿

TEC_S
TEC_S

スコア79

title CHANGED
File without changes
body CHANGED
@@ -21,6 +21,8 @@
21
21
  private DText(DMaxNum) As System.Windows.Forms.TextBox
22
22
  Private DWBtn(DMaxNum) As System.Windows.Forms.Button
23
23
  Private DRBtn(DMaxNum) As System.Windows.Forms.Button
24
+ Private Const TextAStart As Integer = 232 'テキストBoxのスタート位置.  
25
+   Private Const BtnAllStart As Integer = 482
24
26
 
25
27
  Private Sub plcForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
26
28
 
@@ -34,6 +36,9 @@
34
36
  ''' </summary>
35
37
  Private Sub InitControl()
36
38
  Dim i As Integer
39
+ Dim Num As Integer = 0
40
+ Dim i As IpArea_X = BtnAllStart
41
+
37
42
  For i = 1 To DMaxNum
38
43
  DLabel(i) = New System.Windows.Forms.Label
39
44
  DText(i) = New System.Windows.Forms.TextBox

4

コードの修正

2021/01/06 00:32

投稿

TEC_S
TEC_S

スコア79

title CHANGED
File without changes
body CHANGED
@@ -58,7 +58,7 @@
58
58
  DRBtn(i).Name = "BtnDR" & eName
59
59
  DRBtn(i).Text = "読込"
60
60
  DRBtn(i).Location = New Point(sx + BtnRStart + Num * IpArea_X, sy + YIdx * Yohaku)
61
- DmRBtn(i).Size = New System.Drawing.Size(50, 20)
61
+ DRBtn(i).Size = New System.Drawing.Size(50, 20)
62
62
 
63
63
  'フォームへのコントロール追加
64
64
  Me.Controls.Add(DLabel(i))

3

コード修正

2021/01/05 23:42

投稿

TEC_S
TEC_S

スコア79

title CHANGED
File without changes
body CHANGED
@@ -16,10 +16,11 @@
16
16
  ### 該当のソースコード
17
17
 
18
18
  ```VBNET
19
+ private DMaxNum As Integer = 200
19
20
  private DLabel(DMaxNum) As System.Windows.Forms.Label
20
21
  private DText(DMaxNum) As System.Windows.Forms.TextBox
21
- Private DWBtn(DmCountMax) As System.Windows.Forms.Button
22
+ Private DWBtn(DMaxNum) As System.Windows.Forms.Button
22
- Private DRBtn(DmCountMax) As System.Windows.Forms.Button
23
+ Private DRBtn(DMaxNum) As System.Windows.Forms.Button
23
24
 
24
25
  Private Sub plcForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
25
26
 
@@ -32,7 +33,7 @@
32
33
  ''' UI関係の初期化
33
34
  ''' </summary>
34
35
  Private Sub InitControl()
35
- Dim DMaxNum As Integer = 200
36
+ Dim i As Integer
36
37
  For i = 1 To DMaxNum
37
38
  DLabel(i) = New System.Windows.Forms.Label
38
39
  DText(i) = New System.Windows.Forms.TextBox

2

コードの修正

2021/01/05 23:41

投稿

TEC_S
TEC_S

スコア79

title CHANGED
File without changes
body CHANGED
@@ -16,6 +16,11 @@
16
16
  ### 該当のソースコード
17
17
 
18
18
  ```VBNET
19
+ private DLabel(DMaxNum) As System.Windows.Forms.Label
20
+ private DText(DMaxNum) As System.Windows.Forms.TextBox
21
+ Private DWBtn(DmCountMax) As System.Windows.Forms.Button
22
+ Private DRBtn(DmCountMax) As System.Windows.Forms.Button
23
+
19
24
  Private Sub plcForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
20
25
 
21
26
  'UI初期化

1

コードの修正

2021/01/05 23:38

投稿

TEC_S
TEC_S

スコア79

title CHANGED
File without changes
body CHANGED
@@ -35,8 +35,8 @@
35
35
  DLabel(i).Name = "lbl" & eName
36
36
  DLabel(i).Text = "D" & CInt(1000 + i)
37
37
  DLabel(i).Location = New Point(sx + Num * IpArea_X, sy + YIdx * Yohaku)
38
- DmLabel(i).Size = New System.Drawing.Size(230, 18)
38
+ DLabel(i).Size = New System.Drawing.Size(230, 18)
39
- DmLabel(i).Text = String.Format("DM{0} {1}", CInt(i), eName)
39
+ DLabel(i).Text = String.Format("DM{0} {1}", CInt(i), eName)
40
40
 
41
41
  DText(i).Name = "txtD" & eName
42
42
  DText(i).Location = New Point(sx + TextAStart + Num * IpArea_X, sy + YIdx * Yohaku)