473,396 Members | 1,933 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,396 software developers and data experts.

Re. Updating DataViews

Hi Nicholas,

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 #1
1 1197
Terry,

You can hook up to the RowChanged event to see when something new is
added, then invalidate your listview when you receive the RowChanged event.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Terry McNamee" <n/a> wrote in message
news:eR*************@TK2MSFTNGP12.phx.gbl...
Hi Nicholas,

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 #2

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

Similar topics

3
by: softengine | last post by:
Can and how do you alter a data view to include a look up field from another data table? The data table of the dataview only has the key, the value I need is in another data table. Can and how...
2
by: Pablo | last post by:
Hi people, Necesito crear n dataviews en tiempo de ejecucion. I need to create "n" DataViews in runtime. I tried creating an array this way: Dim LDView As Array =...
4
by: enrique | last post by:
Hi, I apologize for a newbie question, but my books/research have yielded me no examples and my time is now short. I simply want to update data from text boxes (fields). I'm not using a datagrid...
3
by: Jerry | last post by:
Hi, I have a couple of datagrids that are based on dataviews. If I filter dataview1 I would like to automatically filter dataview2. I posted something about this before but I think I didn't...
4
by: Bernie Hunt | last post by:
I currently have a datagrid that I'm feeding with a DataSet, which contains three tables. I would like to use a DataView to format the DataTables but I'm not sure how to go about this. Currently...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.