Microsoft Visual C # Express
Mostrar más instrucciones
1
Abra Microsoft Visual C # Express y seleccione "Nuevo proyecto ... " en el panel izquierdo de la pantalla. Haga clic en " Visual C # " en " Plantillas instaladas " doble -click " Formularios de Solicitud de Windows. " Haga doble clic en cualquier lugar en el formulario para abrir el módulo " Form1.cs "
2
Copia y pega el siguiente código al llamar a las funciones dentro del procedimiento " Form1_Load ": .
SetUpDataGridView ();
PopulateDataGridView ();
3
Copia y pega el código siguiente para crear un nuevo procedimiento que crea un nuevo control Grid y define los nombres de las columnas :
private void = 5 ;
songsDataGridView.Name = " songsDataGridView " ;
songsDataGridView.Columns [ 0 ] Name = " Fecha de publicación " ; .
SongsDataGridView.Columns [ 1 ] . Name = " Track" ;
songsDataGridView.Columns [ 2 ] Name = " Title" ; .
songsDataGridView.Columns [ 3 ] Name = " artista " ; .
songsDataGridView.Columns [ 4 ] Name = " Album" ;
}
4
Copia y pega el siguiente código para rellenar el control de cuadrícula con información: .
void PopulateDataGridView privada ()
{
string [ ] row0 = {" 22/11/1968 ", " 29 ", " Revolution 9 " ,
" Beatles " , "The Beatles [ The White Album ] "} ;
string [ ] fila1 = {" 1960 ", " 6 ", " Fools Rush In " ,
" Frank Sinatra " , "Nice 'N ' Easy "} ;
string [ ] fila2 = {" 11/11/1971 "," 1 "," One of These Days " ,
" Pink Floyd "," Meddle "} ;
string [ ] Row3 = {" 1988 "," 7 "," Where Is My Mind " ,
" Pixies " , " Surfer Rosa "? = 3 ;
songsDataGridView.Columns [ 1 ] DisplayIndex = 4 ; .
SongsDataGridView.Columns [ 2 ] DisplayIndex = 0 ; .
SongsDataGridView.Columns [ 3 ] . DisplayIndex = 1 ;
songsDataGridView.Columns [ 4 ] DisplayIndex = 2 ; .
}
5
Press "F5 " para ejecutar el programa. Usted verá un nuevo control DataGrid en el formulario.