Click here to Skip to main content
13,046,533 members (74,423 online)
Click here to Skip to main content
Add your own
alternative version

Stats

128.8K views
6.7K downloads
52 bookmarked
Posted 17 Nov 2003

C# grid control

, 17 Nov 2003
Rate this:
Please Sign up or sign in to vote.
A C# grid control.

Sample Image - grid_control.jpg

Introduction

This is a simple C# grid control. The control provides a way to display and edit string’s collection. When your program wants to get input from user, generally, you can put EditBox control on your form. But when you need to get a set of dates, the EditBox control is not the best choice. Do we have another choice? Try this, maybe it is appropriate for you.

The control features

  • In-place edit
  • Insert rows and columns
  • Cell copy and paste
  • Line copy and paste
  • Multi-line copy and paste
  • Mark a line
  • Display multi-line in a cell
  • Changing column width with mouse at runtime
  • VS.NET IDE integration

How to use?

Simply add the control to you VS.NET Toolbox, then you can drop it to your form. That’s all, no other. Once you create an instance of this control in your form, you can add columns in IDE environment or dynamically add columns at run-time.

Properties

TypeNameDescription
CellActivateCellReturn or specify current active cell
ColumnCollectionColumnsColumns collection
FontFont 
FontHeaderFontThe header font
RowCollectionRowsRows collection
BoolHasGridLineWhether display table lines
BoolReadOnly 

Methods

Return TypeNameParameterDescription
VoidAppendRow Append a black row
VoidAppendRowString[] valAppend a row with specified value
VoidInsertRowInt indexInsert a row at the position that is specified by index parameter
VoidInsertRow

Int index

String[] val

Insert a row at the position that is specified by index parameter and fill the cell value with val parameter
Void ClearAll Empty all cell content
VoidRefresh Force grid control repaint
VoidRemoveRowInt indexRemove the row that is specified by index parameter
VoidSetCell

Int row

Int col

String val

Set the value of the cell which is specified by row and col parameter to val
VoidSetCell

Int row

Int col

String[] val

Set the value of the cell which is specified by row and col parameter to val
StringGetCell

Int row

Int col

Get the value of the cell which is specified by row and col parameters
VoidMarkRowInt indexDraw an arrow at the left of the row specified by index

Events

NameDescription
RowSelectedWhen a row is selected it throws this event
ActiveCellChangedWhen the ActiveCell changes, it throws this event

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

linjie
Web Developer
China China
He's in the dust

You may also be interested in...

Pro

Comments and Discussions

 
GeneralMouseWheel event Pin
kostickaa1-Apr-08 14:45
memberkostickaa1-Apr-08 14:45 
GeneralRe: MouseWheel event Pin
linjie1-Apr-08 17:03
memberlinjie1-Apr-08 17:03 
QuestionInsert row into database Pin
peperoneca15-Aug-06 3:03
memberpeperoneca15-Aug-06 3:03 
General你的个人网站怎么上不去啊?? Pin
Jack.Yao19-Apr-04 23:04
memberJack.Yao19-Apr-04 23:04 
GeneralRe: 你的个人网站怎么上不去啊?? Pin
linjie26-Jun-04 16:35
memberlinjie26-Jun-04 16:35 
Generalnot fully tested... Pin
Alex Kucherenko25-Nov-03 4:21
memberAlex Kucherenko25-Nov-03 4:21 
GeneralRe: not fully tested... Pin
linjie25-Nov-03 15:14
memberlinjie25-Nov-03 15:14 
GeneralRe: not fully tested... Pin
elitecommerceserver26-Nov-03 5:06
memberelitecommerceserver26-Nov-03 5:06 
GeneralRe: not fully tested... Pin
linjie26-Nov-03 21:49
memberlinjie26-Nov-03 21:49 
Generalamazing work ! Pin
Retish P19-Nov-03 12:19
memberRetish P19-Nov-03 12:19 
Generallink is ok now. Pin
linjie19-Nov-03 4:37
memberlinjie19-Nov-03 4:37 
Generalcodejock Pin
Gnupe19-Nov-03 1:39
sussGnupe19-Nov-03 1:39 
GeneralRe: codejock Pin
linjie19-Nov-03 4:21
memberlinjie19-Nov-03 4:21 
General*tut* + *sigh* Pin
dog_spawn19-Nov-03 12:02
memberdog_spawn19-Nov-03 12:02 
GeneralRe: codejock Pin
RabidKangaroo19-Nov-03 11:41
memberRabidKangaroo19-Nov-03 11:41 
GeneralUnworked Link to SouceCode Pin
tim_mcgwyn19-Nov-03 0:58
membertim_mcgwyn19-Nov-03 0:58 
GeneralLink to the Source Pin
Sanjay Rastogi19-Nov-03 0:43
memberSanjay Rastogi19-Nov-03 0:43 
GeneralLink to the source Pin
Juergen Posny19-Nov-03 0:20
memberJuergen Posny19-Nov-03 0:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170713.1 | Last Updated 18 Nov 2003
Article Copyright 2003 by linjie
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid