0


Visual Basic 2010 はまだ初心者です
。常に次の行に移動するため、ナビゲーターをバインドするオプションを変更したいと考えています。
次の9行に移動するにはどうすればよいですか?
たとえば、次のようになります。
フォームのメインをロードし、コードを追加して 9 行のデータを入力します。

Dim inc As Integer =  0 
label1.Text = dataSet.Tables("DPT").Rows(inc + 0).Items(2) 
label2.Text = dataSet.Tables("DPT").Rows(inc + 1).Items(2) 
.....
label9.Text = dataSet.Tables("DPT").Rows(inc + 8).Items(2)

しかし、デバッグして次の項目を押すと、すべての値が label1.Text ---> label9.Text
行番号2で埋められます....助けてもらえますか?

4

1 に答える 1

0

あなたがここで行っているのを見るのは間違っていることがたくさんあります...私の編集をチェックしてください...

 Dim inc As Integer = 0 'This isn't doing anything...

 label1.Text = dataSet.Tables("DPT").Rows(inc + 0).Items(2) 'Your always referencing item 2
 label2.Text = dataSet.Tables("DPT").Rows(inc + 1).Items(2)

 label9.Text = dataSet.Tables("DPT").Rows(inc + 8).Items(2) 

まず、すべてのラベル テキストをこれに変更します...

 label1.Text = dataSet.Tables("DPT").Rows(1).Item(1) 'Change the number for your row and item as you go down... Or better yet use your Item name instead of the number...
于 2013-03-01T06:44:07.173 に答える