TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Andrzej Wegierski
NA
705
0
FreeForm on DataGrid project
Sep 19 2003 4:46 AM
I create a FreeForm object from DataGrid. It use a UserControl object with TextBoxes etc. multiplied by DataGrid screen rows and added to Controls[] and custom DataGridColumnStyles to link UserControls to DataGrid. My informations are wery short - but the project is quite big, sorry. I don't use data binding because of it doesn't work in all cases. So I use:
protected override void Paint(Graphics gr,Rectangle rc,CurrencyManager cm,int row,Brush bb,Brush fb,bool rtl)
method to set values in TextBoxes on UserControls. property
Text
and
TextChanged
event to save changes in DataGrid.DataSource (DataView) View:
public void SaveCell(int row,object val) { DataView dv=((FreeDataGrid)this.DataGridTableStyle.DataGrid).View; try { // null test if(val==null || val.ToString().Trim()=="" || NullText.Equals(val)) val=DBNull.Value; // saving dv[row][this.MappingName]=val; dv[row].EndEdit(); } catch {} }
It doesn't work in one case, too: when I try to add new row with primary case similar to existing one (first keys identical, one - the last - different) EndEdit method generates exception, so during the next Paint() these fields are cleared. Saving to DataView and EndEdit it's generally an error I think. But what I can do in this matter? May be use another events or methods or save to DataGrid cells? May be someone can help me ... Thx in adv
Reply
Answers (
1
)
Usage Collection Item in Property Grid.
Multiple file selection in fileDialog