473,322 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Updating DataView

I have a DataTable which i have added data to.

I have a custom method that prints a DataView of the DataTable out on the
screen. The problem I'm having is, i need to call the custom method
whenever the DataTable is changed.

How can I do this? this is not a standard binding problem, since I need to
call a custom method to paint the items on the screen.

view.ListChanged += new ListChangedEventHandler(this.view_Changed);

private void view_Changed(object sender,
System.ComponentModel.ListChangedEventArgs e)

{

this.populateMenu(); //we want to populate the menu again.

}

Many thanks.
Nov 17 '05 #1
3 1680
Terry,

When the DataTable is changed, your event handler should call the
Invalidate method on the control you need repainted. Then, that control
should have an event handler for the Paint event, or an override of the
OnPaint method. In that, you will have your code that paints your screen
(this causes your screen to be painted correctly when needed).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Terry McNamee" <n/a> wrote in message
news:u%****************@TK2MSFTNGP12.phx.gbl...
I have a DataTable which i have added data to.

I have a custom method that prints a DataView of the DataTable out on the
screen. The problem I'm having is, i need to call the custom method
whenever the DataTable is changed.

How can I do this? this is not a standard binding problem, since I need
to call a custom method to paint the items on the screen.

view.ListChanged += new ListChangedEventHandler(this.view_Changed);

private void view_Changed(object sender,
System.ComponentModel.ListChangedEventArgs e)

{

this.populateMenu(); //we want to populate the menu again.

}

Many thanks.

Nov 17 '05 #2
Hi Nicholas,

How can I determine when the DataTable is changed ?

Basically what i need to do is call the populateMenu method once the
DataTable is changed.

I understand what you're saying about the paint methods, but the
populateMenu method goes through the view and adds each item to my
customised menu.

Thanks.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:OK**************@TK2MSFTNGP12.phx.gbl...
Terry,

When the DataTable is changed, your event handler should call the
Invalidate method on the control you need repainted. Then, that control
should have an event handler for the Paint event, or an override of the
OnPaint method. In that, you will have your code that paints your screen
(this causes your screen to be painted correctly when needed).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Terry McNamee" <n/a> wrote in message
news:u%****************@TK2MSFTNGP12.phx.gbl...
I have a DataTable which i have added data to.

I have a custom method that prints a DataView of the DataTable out on the
screen. The problem I'm having is, i need to call the custom method
whenever the DataTable is changed.

How can I do this? this is not a standard binding problem, since I need
to call a custom method to paint the items on the screen.

view.ListChanged += new ListChangedEventHandler(this.view_Changed);

private void view_Changed(object sender,
System.ComponentModel.ListChangedEventArgs e)

{

this.populateMenu(); //we want to populate the menu again.

}

Many thanks.


Nov 17 '05 #3
To give you a better understanding of what I'm doing...

I'm using a ownerdrawnlist control that is used as a menu on the smartphone.
To populate this menu, I iterate through the DataTable by:

foreach (DataRowView row in view)

{

dataMenu.Items.Add(new DataItem(row["Name"].ToString(),
row["File"].ToString()));

}

The trouble I'm experiencing, is when I add change the datatable in any way,
I need to update my ownerdrawnlist control. I'm using a view to sort the
datatable alphabetically, and then I want to iterate through the view
populating my table.

I appreciate your assistance.
"Terry McNamee" <n/a> wrote in message
news:Om****************@TK2MSFTNGP10.phx.gbl...
Hi Nicholas,

How can I determine when the DataTable is changed ?

Basically what i need to do is call the populateMenu method once the
DataTable is changed.

I understand what you're saying about the paint methods, but the
populateMenu method goes through the view and adds each item to my
customised menu.

Thanks.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in message news:OK**************@TK2MSFTNGP12.phx.gbl...
Terry,

When the DataTable is changed, your event handler should call the
Invalidate method on the control you need repainted. Then, that control
should have an event handler for the Paint event, or an override of the
OnPaint method. In that, you will have your code that paints your screen
(this causes your screen to be painted correctly when needed).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Terry McNamee" <n/a> wrote in message
news:u%****************@TK2MSFTNGP12.phx.gbl...
I have a DataTable which i have added data to.

I have a custom method that prints a DataView of the DataTable out on
the screen. The problem I'm having is, i need to call the custom method
whenever the DataTable is changed.

How can I do this? this is not a standard binding problem, since I need
to call a custom method to paint the items on the screen.

view.ListChanged += new ListChangedEventHandler(this.view_Changed);

private void view_Changed(object sender,
System.ComponentModel.ListChangedEventArgs e)

{

this.populateMenu(); //we want to populate the menu again.

}

Many thanks.



Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ben | last post by:
Dim dv As DataView = New DataView (DataSet11.Tables("InventoryTable")) dv.RowFilter = "ItemAuthor LIKE '" & ItemAuthor.Text & "%'" dv.RowStateFilter = DataViewRowState.ModifiedCurrent dv.Sort...
9
by: Bill Salling | last post by:
am trying to updated the source data(Access2000) for my data grid. But keep getting this error An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dl ...
2
by: Nanda | last post by:
hi, i have an editable datagrid. how can i update the database, When the user completes entering data for a row. i.e., data should be updated whenever user completes entering a row. Thanks in...
1
by: Tim | last post by:
Hi Guys, I have a situation where I have a grid loaded with data. It is not data bound. Clicking an image opens up another form that allows the change of the data in the grid. Right now the...
3
by: Colin Young | last post by:
I'm having a bit of a problem with my DataList when I try to update from the user's input. I've included relevant excerpts at the end of this message. In the UpdateCommand code, the...
0
by: VBNovice05 | last post by:
I am trying to update a DataSet and DataView without updating the database. I have two datasets. DataSet1: Name Size DataSet2: Name Size Path I want to look...
1
by: batista | last post by:
Hello all, I have a third praty grid control...named C1grid. Im using it in one of my apps.. Now, I have bind this grid to a custom dataset class named "DataViewEx". The code of the class is...
0
by: Chet | last post by:
I have a Datagrid that is bound to a Datatable at runtime. I allow the user to select a number of rows using the mouse and then click a button that says "check selected rows", which then cycles...
1
by: jaholm | last post by:
I have a datagridview bound to a dataview of a typed dataset. The binding is accomplished with a bindingsource object. When I programatically modify one of the datarows in the datatable of the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.