DataGrid Control For Visual Basic 6
DataGrid Control For Visual Basic 6
Conceptual Differences
Data Binding
The Vi al Ba ic 2005 DataGridView con ol doe no need da a- pecific me hod o e en beca e all ac ion a e pe fo med h o gh he da a o ce. Beca e of hi epa a ion of p e en a ion and da a f nc ionali , he da a o ce can be changed i h o i ho e in e face inp . Al o, m l iple con ol bo nd o he ame da a o ce ill al a a in nc.
Navigation
P ope ie fo ie ing and na iga ion in he DataGrid con ol ( ch a TabAction, EnterAction, AllowArrows, WrapCellPointer, and Scrollable) a e no longe needed. Fo e ample, he g id f nc ion a ho gh he Scrollable p ope i e o True: If mo e da a e i han can be di pla ed, a c oll ba appea a oma icall . E celle na iga ion h o gh he g id i he defa l , allo ing he e o mo e fo a d i h he TAB ke and back a d i h he SHIFT+TAB ke combina ion. Fo mo e info ma ion, ee Defa l Ke boa d and Mo e Handling in he Windo Fo m Da aG idVie Con ol.
Caption Propert
In Vi al Ba ic 6.0, he Caption p ope i ed o di pla Caption p ope i lef emp , no i le ba i di pla ed. The Vi al Ba ic 2005 DataGridView con ol doe no achie e he ame effec ing a Label con ol. a i le ba abo e he g id; if he a i le ba . Ho e e , o can
ppo
Data Formatting
In Vi al Ba ic 6.0, fo ma ing da a in he DataGrid con ol i handled ing he DataFormat p ope and a StdDataFormat objec . Fo ma ing i applied on a col mn-b -col mn ba i . In he Vi al Ba ic 2005 DataGridView con ol, fo ma ing i accompli hed ing he Fo ma p ope of a Da aG idVie CellS le objec . Fo ma ing can be applied o indi id al cell , col mn , o o . Fo mo e info ma ion, ee Da a Fo ma ing in he Windo Fo m Da aG idVie Con ol.
hWndEditor Propert
In Vi al Ba ic 6.0, he hWndEditor p ope i DataGrid con ol' edi ing indo o a Windo ed o pa API call. he indo handle a igned o a
The Vi al Ba ic 2005 DataGridView con ol doe no ha e a epa a e indo handle hen in edi mode; in ead, e he Handle p ope of he DataGridView con ol o an embedded edi con ol .
MarqueeSt le Propert
In Vi al Ba ic 6.0, he MarqueeSt le p ope con ol he appea ance of a elec ed cell o o b changing he bo de le, in e ing he fo eg o nd and backg o nd colo , o in oking an edi indo .
msdn.microsoft.com/en-us/librar / 4ddh1ac(v=vs.80).asp 1/10
1/3/12
Split Vie s
The Vi a Ba ic 6.0 DataGrid c a i ie , a i g he e di da a ide-b - ide. The Split bjec a d he Split, Splits, a d TabAcrossSplits he abi i di a a i ie . I he Vi a Ba ic 2005 DataGridVie c , he e e ie achie e he a e effec i g e e S i C ai e c c . T d ica e he f c i a i f he TabAcrossSplits S a da dTab e f he DataGridVie c . a he a e e ie c ca
ge e i . H e e , a d i e DataGridVie e , ca e he
'Vsa Bsc60 iul ai . PiaeSbDtGi1Cik) rvt u aard_lc( DtGi1Sltr aard.eSat 1 DtGi1Slegh DtGi1Tx aard.eLnt aard.et Mgo(Teslce tx i "&DtGi1Slet sBx"h eetd et s aard.eTx) EdSb n u
VB 'Vsa Bsc20 iul ai 05 PiaeSbDtGiVe1EiigotoSoig _ rvt u aardiw_dtnCnrlhwn( BVlsne A Ojc,BVleA Sse.idw.om._ ya edr s bet ya s ytmWnosFrs DtGiVeEiigotoSoigvnAg)_ aardiwdtnCnrlhwnEetrs HnlsDtGiVe1EiigotoSoig ade aardiw.dtnCnrlhwn CyeeCnrl TxBx.eetoSat 0 Tp(.oto, eto)Slcintr CyeeCnrl TxBx.eetoLnt Tp(.oto, eto)Slcinegh LnCyeeCnrl _ e(Tp(.oto, TxBx.et eto)Tx) Mgo(Teslce tx i "&CyeeCnrl _ sBx"h eetd et s Tp(.oto, TxBx.eetdet eto)SlceTx) EdSb n u
msdn.microsoft.com/en-us/librar / 4ddh1ac(v=vs.80).asp
2/10
1/3/12
Properties Vi al Ba ic 6.0
AddNewMode
Vi al Ba ic 2005 Eq i alen
N , C . A N (BindingSource) ; , F D R U E T R G V C D . K M H . F W . D D . F G V
D A N
A A A N P N
(BindingSource) R
(BindingSource) . F B . D D , 6.0 U . . F G V A B S
ApproxCount
, C BackColor B . C
Note
C C B V B V B 6.0 U 2005. F . ,
Bookmark Caption
N N
. Y . U Label
. .
3/10
msdn.microsoft.com/en-us/librar / 4ddh1ac(v=vs.80).asp
1/3/12
Selec edCol mn Col mnHeade Vi ible Pa en ; inhe i ed f om Control. en CellDi en Cell , I C en CellInEdi Mode
CurrentCellModified I C CurrentCellVisible C
No e
If he CurrentCell p ope i e o a cell ha i no i ible, he g id c oll o ho ha cell ( imila o e ing CurrentCellVisible = True).
DataChanged DataFormats
IsCurrentCellDirt , I C
en Ro Di
DataGridViewCellSt le.objec .
No e
Fo ma ing can be e fo an indi id al cell, col mn, o o .
DefColWidth DragIcon DragMode EditActive FirstRow Font FontBold FontItalic FontName FontSi e FontStrikethrough FontUnderline ForeColor
No e
Fon a e handled diffe en l in Vi al Ba ic 2005. Fo mo e info ma ion, ee Fon Handling fo Vi al Ba ic 6.0 U e .
Fo eColo
No e
msdn.microsoft.com/en-us/librar / 4ddh1ac(v=vs.80).asp 4/10
1/3/12
e i f
a i
HeadFont
DataGridVie CellSt le
bjec .
No e
F a e ha d ed diffe e i Vi a Ba ic 2005. F ee F Objec f Vi a Ba ic 6.0 U e . e i f a i ,
HeadLines
f he i hC
Heade Heigh .
Height
No e
C i f di a e a e ha d ed diffe e i Vi a Ba ic 2005. F a i , ee C di a e S e f Vi a Ba ic 6.0 U e . e
HelpConte tID
Ne i e e a i Ba ic 6.0 U e . Handle Ne i e e a i
. F
e i f
a i
, ee He
Vi
. U e Handle. . F e i f a i , ee C A a f Vi a
Ne i e e a i Ba ic 6.0 U e . Lef , i he i ed f
Left
Control c a
No e
C i f di a e a e ha d ed diffe e i Vi a Ba ic 2005. F a i , ee C di a e S e f Vi a Ba ic 6.0 U e . e
LeftCol MarqueeSt le
Fi
Di
a edSc
i gC
I de
N di ec e Format R
RecordSelectors Ro
Heade Vi ib e
Se ec edR
5/10
msdn.microsoft.com/en-us/librar / 4ddh1ac(v=vs.80).asp
1/3/12
Ro Di ide S
le
GridColor, CellBo de S le, RowHeadersBorderSt le, ColumnHeadersBorderSt le properties. Height New implementation. You can now directl access an item. SelectedCells, Selec edCol mn
No direct equivalent. Use the Selec ionLeng h propert Edi ingCon olSho ing event handler. No direct equivalent. Use the Selec ionS a Edi ingCon olSho ing event handler. No direct equivalent. Use the Selec edTe Edi ingCon olSho ing event handler. propert
in the
SelS a
in the
SelTe
propert
in the
New implementation. Split views are not directl supported; use a Spli Con aine control.
No e
The Val e propert returns an Objec ; use CS convert it to a S ing. or ToS ing to
ToolTipTe
ToolTip component For more information, see ToolTip Support for Visual Basic 6.0 Users.
Top
Top
No e
Coordinates are handled differentl in Visual Basic 2005. For more information, see Coordinate S stem for Visual Basic 6.0 Users.
Vi ibleCol
msdn.microsoft.com/en-us/librar / 4ddh1ac(v=vs.80).asp
1/3/12
No e
In Vi al Ba ic 6.0, pa iall i ible col mn a e al a incl ded in he co n ; he Displa edColumnCount me hod e a Boolean includePartialColumns pa ame e o de e mine he he pa iall i ible col mn a e incl ded.
VisibleRo s
No e
In Vi al Ba ic 6.0, pa iall i ible o a e al a incl ded in he co n ; he Displa edRo Count me hod e a Boolean includePartialRo s pa ame e o de e mine he he pa iall i ible o a e incl ded.
WhatsThisHelpID
Ne implemen a ion. Fo mo e info ma ion, ee Help S ppo Ba ic 6.0 U e . Wid h, inhe i ed f om Control cla .
fo Vi
al
Width
No e
Coo dina e a e handled diffe en l in Vi al Ba ic 2005. Fo mo e info ma ion, ee Coo dina e S em fo Vi al Ba ic 6.0 U e .
WrapCellPointer
able p ope
Me hod Vi al Ba ic 6.0
CaptureImage
Vi al Ba ic 2005 Eq i alen
Ne implemen a ion. Cap PictureBo con ol i no Ne ing he con en ppo ed. of a DataGridVie con ol o a
oma ic
hen e-binding.
Clea Selec ion Inde Of (DataGridVie ColumnCollection) Ne implemen a ion. Fo mo e info ma ion, ee D ag and D op fo Vi 6.0 U e .. Ne implemen a ion. Bookma k a e no longe ppo ed.
7/10
al Ba ic
GetBookmark
msdn.microsoft.com/en-us/librar / 4ddh1ac(v=vs.80).asp
1/3/12
HoldField Mo e
Ne
ed
hen ebinding.
Note
Coo dina e a e handled diffe en l in Vi al Ba ic 2005. Fo mo e info ma ion, eeCoo dina e S em fo Vi al Ba ic 6.0 U e .
Rebind Ro Bookma k Ro Con aining Ro Top Sc oll Se Foc Sho Wha Thi
. ppo ed.
Inde Of (Da aG idVie Col mnCollec ion) Ge Con en Bo nd (Da aG idVie Cell) Ne Foc Ne implemen a ion. Fo mo e info ma ion, ee Help S ppo U e . ie a e no di ec l ppo ed; fo Vi al Ba ic 6.0 implemen a ion me hod. U e he C en Cell p ope .
Spli Con aining Ne implemen a ion. Spli Spli Con aine con ol. ZO de
e a
E ents Vi al Ba ic 6.0
Af e ColEdi Af e ColUpda e Af e Dele e Af e Upda e Befo eColEdi Befo eColUpda e Befo eDele e Befo eIn e Befo eUpda e
msdn.microsoft.com/en-us/librar / 4ddh1ac(v=vs.80).asp 8/10
Vi al Ba ic 2005 Eq i alen
CellEndEdi Ne implemen a ion. Da a ope a ion a e handled in he da a o ce. Fo mo e info ma ion, ee Di pla ing Da a in he Windo Fo m Da aG idVie Con ol. Ro Added
CellBeginEdi Ne implemen a ion. Da a ope a ion a e handled in he da a o ce. Fo mo e info ma ion, ee Di pla ing Da a in he Windo Fo m Da aG idVie Con ol.
1/3/12
ButtonClick Change
No e
The beha io of he TextChanged e en i ligh l diffe en . Fo mo e info ma ion, ee ComboBo Con ol Change E en fo Vi al Ba ic 6.0 U e .
Click ColEdit ColResi e DblClick DragDrop DragOver Error HeadClick MouseDown MouseMove MouseUp
Selec edInde Changed CellBeginEdit Col mnWid hChanged CellMo eDo bleClick al Ba ic
OLECompleteDrag Ne implemen a ion. Fo mo e info ma ion, ee D ag and D op fo Vi 6.0 U e . OLEDragDrop OLEDragOver OLEGiveFeedback OLESetData OLEStartDrag
OnAddNew RowColChange
RowsAdded C en CellChanged
9/10
msdn.microsoft.com/en-us/librar / 4ddh1ac(v=vs.80).asp
1/3/12
RowHeightChanged SelectionChanged New implementation. Split views are not directly supported; use a SplitContainer control. Validating
Validate
Upgrade Notes
When a Visual Basic 6.0 project is upgraded to Visual Basic 2005, the Change event of the DataGrid control is mapped to the TextChanged event of the Visual Basic 2005 DataGridView control. The behavior of the TextChanged event differs from that of the Change event; this difference may cause unintended results in your code. Any code related to data-specific methods or events is not upgraded. Warning comments are added to the code, and the code must be removed or modified before compiling the application.
See Also
Reference DataGridView Control Overview (Windows Forms) Controls and Programmable Objects Compared in Different Languages and Libraries Concepts DataGridView Control Technology Summary (Windows Forms) What's New in Windows Forms and Windows Forms Controls Other Resources DataGridView Control (Windows Forms) Windows Forms Controls for Visual Basic 6.0 Users Windows Forms Data Binding
Communit Content
2012 Microsoft. All rights reserved.
msdn.microsoft.com/en-us/librar / 4ddh1ac(v=vs.80).asp
10/10