私はタブコントロールを持っています。タブコントロールの各タブページには、データグリッドビューが含まれています。これらはプログラムで作成されます。
後で、datagridviews から値を読み取り、それらを Word 文書に書き込みます。
ユーザーがタブ ページをクリックすると、datagridview は正しい行数を報告します。
ユーザーがタブ ページを表示していない場合、datagridview .rowcount = 0
データグリッドビューに実際の行数を強制的に反映させるためにできることはありますか?
次のコードを使用して、名前 (tcPlanFeeTab) で datagridview を含むタブに移動しています。
For Each tp As TabPage In frmSvcFee.tcPlanFee.TabPages
'find the fee tab
If tp.Text = tcPlanFeeTab Then 'this is the fee tab
'select the tp so the datagridview is activated
tp.Select()
For Each ctl As Control In tp.Controls 'find the datagridview on the rates tab
If TypeOf ctl Is DataGridView Then
Dim D As DataGridView = ctl
MessageBox.Show(D.RowCount)