473,786 Members | 2,866 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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******** ********@TK2MSF TNGP10.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.c om> wrote
in message news:OK******** ******@TK2MSFTN GP12.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.co m

"Terry McNamee" <n/a> wrote in message
news:u%******** ********@TK2MSF TNGP12.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.ListChange d += new ListChangedEven tHandler(this.v iew_Changed);

private void view_Changed(ob ject sender,
System.Componen tModel.ListChan gedEventArgs e)

{

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

}

Many thanks.





Nov 17 '05 #1
1 1211
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.co m

"Terry McNamee" <n/a> wrote in message
news:eR******** *****@TK2MSFTNG P12.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******** ********@TK2MSF TNGP10.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.c om> wrote
in message news:OK******** ******@TK2MSFTN GP12.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.co m

"Terry McNamee" <n/a> wrote in message
news:u%******** ********@TK2MSF TNGP12.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.ListChange d += new ListChangedEven tHandler(this.v iew_Changed);

private void view_Changed(ob ject sender,
System.Componen tModel.ListChan gedEventArgs e)

{

this.populateMe nu(); //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
459
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 to you reference the value of a column in a data table/view from the row filter string of a different data view. I'm using a strongly typed dataset. Below is more info.
2
1491
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 = Array.CreateInstance(GetType(DataView), 10)
4
1365
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 or datalist I found plenty of examples of how to do that and can get that to work. I simply want to update my databound text boxes. I'm using visual studios DataAdapters, DataSets and Dataviews. I can insert to the database utilizing the...
3
1904
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 specifically focus about that I was using dataviews and just datagrids. Ken Tucker was nice enough to share an example using datagrids and relations/constraints from code (thanks ken). I was able to duplicate this example using components and...
4
1399
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 I have; dsVendorContacts is a DataSet with three tables and relational links dgVendors is a DataGrid With dgVendors
0
9650
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9497
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9962
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8992
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6748
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.