问题描述
请教高手:VB2010有驱动器控件吗,如何在窗体上设置驱动器!!!
解决方案
解决方案二:
添加ComboBox控件。然后直接复制下面的代码。PrivateSubForm1_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadDimdrivesAsSystem.IO.DriveInfo()=System.IO.DriveInfo.GetDrives()ForEachCiPanAsSystem.IO.DriveInfoIndrivesComboBox1.Items.Add(CiPan.Name)NextComboBox1.SelectedIndex=0EndSub
解决方案三:
放一个listboxprivatevoidForm1_Load(objectsender,EventArgse){DriveInfo[]di=DriveInfo.GetDrives();foreach(DriveInfoitemDriveindi){listBox1.Items.Add(itemDrive.Name);}}privatevoidlistBox1_SelectedIndexChanged(objectsender,EventArgse){DriveInfodi=newDriveInfo(listBox1.SelectedIndex.ToString());MessageBox.Show("AvailableFreeSpace:"+di.AvailableFreeSpace+"/n"+"DriverFormat:"+di.DriveFormat+"/n"+"DriverType:"+di.DriveType+"/n"+"IsReady:"+di.IsReady.ToString()+"/n"+"Name:"+di.Name+"/n"+"RootDirectory:"+di.RootDirectory+"/n"+"ToString()Value:"+di.ToString()+"/n"+"TotalFreeSpace:"+di.TotalFreeSpace+"/n"+"VolumeLable:"+di.VolumeLabel.ToString(),di.Name+"DRIVERINFO");}
http://www.cnblogs.com/zhwx/archive/2012/02/19/2358318.html参考
解决方案四:
该回复于2012-04-17 10:37:09被版主删除