subscript out of range- datagrid

Submitted by jomblix on
dear all, i am a beginner in VB. When i put objects, datagrid and command button to form, and i put some codes to command1_click() like this datagrid1.columns(0).caption ="Name" datagrid1.columns(1),caption="Address" datagrid1.columns(2).caption="occupation" datagrid1.columns(3).caption="Age" when i click command1 there is an error message (run-time error 9) : "subscript out of range" my questions are ; why could it happens and what's the solution