PDA

Click to See Complete Forum and Search --> : How do i get this information into a datagrid control (datagrid)???


danyal711
Dec 4th, 1999, 10:09 AM
I have this information that i want to call out of a file and put into a data grid.
"AL","Alabama"
"AK","Alaska"
"AS","American Samoa"
"AZ","Arizona"
"AR","Arkanzas"
"CA","California"
"CZ","Canal Zone"
"CO","Colorado"
"CT","Connecticut"
"DE","Deleware"
"DC","District of Columbia"
"FL","Florida"
"GA","Georgia"
"GU","Guam"
"HI","Hawaii"
"ID","Idaho"
"IL","Illinois"
"IN","Indiana"
"IA","Iowa"
"KS","Kansas"
"KY","Kentucky"
"LA","Louisiana"
"ME","Maine"
"MD","Maryland"
"MA","Massachusetts"
"MI","Michigan"
"MN","Minnesota"
"MS","Mississippi"
"MO","Missouri"
"MT","Montana"
"NE","Nebraska"
"NV","Nevada"
"NH","New Hampshire"
"NJ","New Jersey"
"NM","New Mexico"
"NY","New York"
"NC","North Carolina"
"ND","North Dakota"
"OH","Ohio"
"OK","Oklahoma"
"OR","Oregon"
"PA","Pennsylvania"
"PR","Puerto Rico"
"RI","Rhode Island"
"SC","South Carolina"
"SD","South Dakota"
"TN","Tennessee"
"TX","Texas"
"TT","Trust Territories"
"UT","Utah"
"VT","Vermont"
"VA","Virginia"
"VI","Virgin Islands"
"WA","Washington"
"WV","West Virginia"
"WI","Wisconsin"
"WY","Wyoming"

And i want to get it into a data grid.
How do i do this??????

Gerald
Dec 4th, 1999, 10:23 PM
If you absolutely must use a grid control then I would read the file into an array and then use that array to supply the data for an unbound dbgrid control. You supply data to an unbound dbgrid by writing code for the UnboundReadData event of the dbgrid control. This is all rather complicated and may be more than what you require, but an example can be found and downloaded from the following site.
http://www.apexsc.com/dbgrid/survivalkit.html

If you really don't need the functionality of the dbgrid or datagrid control, then you could make it real easy on yourself by simply using a listbox control. Just open the file and read each line into variables and use the listbox's AddItem method to fill the list box with the data you've read into the variables.

Good luck, Gerald M.