2012-05-24 2 views
1

나는 사용자 정의 I는 flowlayoutpanel의 번호를 추가 컨트롤이 있습니다업데이트 프로그램 추가 컨트롤

Dim drive As New WindowsControlLibrary1.UserControl1() 
drive.FileSystemlable = reader.GetString(2) 
drive.AbalableSpaceLable = Convert.ToInt32(reader.GetString(4)/1024) 
drive.TotalSpaceLable = Convert.ToInt32(reader.GetString(5)/1024) 
drive.SetVolumeLable = reader.GetString(3) 
Dim usedspace As Integer = Convert.ToInt32(reader.GetString(5)) - Convert.ToInt32(reader.GetString(4)) 
drive.BarValue = usedspace/1024 

Form1.FlowLayoutPanel1.Controls.Add(drive) 

가 어떻게 지금 이러한 컨트롤을 업데이트하는 대신이를 취소 할 수 있습니다 다시 모두를 다시 추가?

답변

3

에 한번 당신의 컨트롤을 제공하는 고유 한 이름 :

Dim drive As New WindowsControlLibrary1.UserControl1() 
drive.Name = "drive1" 

당신은 단지 이름으로 패널의 컨트롤 컬렉션을 참조 할 수 있습니다 :

With DirectCast(Form1.FlowLayoutPanel1.Controls("drive1"), WindowsControlLibrary1.UserControl1) 
    .BarValue = 50 
End With