Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ComboBox to list the drives/folders of my computer
Message
 
 
To
30/10/2000 18:03:23
Bill Drew
Independent Consultant
Chicago, Illinois, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00435790
Message ID:
00436190
Views:
19
>>Can anybody tell me how to make a combo box which list out the local drives in my computer, whcih I can select from it for folder selection.
>>
>>Thank you for kind attention.
>I use a routine that finds removable drives and puts them in an option group. You might be able to adapt it for a combo box and for all types of drives. Or you might want to use getdir().
>
Hi Bill,

Just basic observation on this code (you have to read FAQ from David Fluker here): (see my comments in red)
>local nowno,i,curtop
>nowon=1
>curtop = 8
>for i = 65 to 92
>	if inlist(drivetype(chr(i)),2)
>		decl thisform.drives(nowon,2)
>		thisform.drives(nowon,1) = chr(i)
>		thisform.drives(nowon,2) = "Drive "+chr(i)
>		thisname = "opbutton"+allt(str(nowon))
>		thisform.optiongroup1.addobject(thisname,"optionbutton")

                
                local loOption
                loOption=evaluate('thisform.optiongroup1.optbutton'+transform(nowon))
                with loOption
                    .caption="Drive "+chr(i)
                    .width=100
                    .top=curtop
                    etc 
                endwith
   
See the difference?

>		thisform.optiongroup1.&thisname..caption = "Drive "+chr(i)
>		thisform.optiongroup1.&thisname..width = 100
>		thisform.optiongroup1.&thisname..top = curtop
>		thisform.optiongroup1.&thisname..visible = .t.
>		thisform.optiongroup1.&thisname..left = 10
>		curtop = curtop + 21
>		if nowon > 1
>			thisform.optiongroup1.height = thisform.optiongroup1.height+21
>		endi		
>		nowon = nowon + 1
>		if nowon = 5
>			exit
>		endi
>	endi
>
>endf
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform