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

Need to re-create code in new control (please help)

Thanks for reading this...

Our current Win app employs a ListView control wherein the tag for an item
is, for example, "ContentManager.DataModel.PowerPointContent". The
following code exists (and works just fine) for when the user clicks on any
item within the ListView:

private void listView1_MouseClick( object sender, MouseEventArgs e )
{
Type listItemType = (Type)( ( sender as ListView ).FocusedItem.Tag );
Content newContent = (Content)Activator.CreateInstance( listItemType );
AddContent( newContent );
}

However, I'm now tasked with replacing the ListView control with ListBar
control from Infragistics. While I can easily determine which item is
clicked from e.Item.Tag, I'm not understanding how to write code in this
event:

private void ultraListBar1_ItemSelected(object sender,
Infragistics.Win.UltraWinListBar.ItemEventArgs e)
{
???
}

If anyone can help me out, I will gladly buy them a beer.

Thanks very much,
Ron
Jan 11 '06 #1
7 1636
What are you trying to achieve via that event?
Infragistics has its own NG, full of answers. Did you get the chance to try
that?
"Ronald S. Cook" <rc***@westinis.com> wrote in message
news:uL**************@TK2MSFTNGP09.phx.gbl...
Thanks for reading this...

Our current Win app employs a ListView control wherein the tag for an item
is, for example, "ContentManager.DataModel.PowerPointContent". The
following code exists (and works just fine) for when the user clicks on
any item within the ListView:

private void listView1_MouseClick( object sender, MouseEventArgs e )
{
Type listItemType = (Type)( ( sender as ListView ).FocusedItem.Tag );
Content newContent = (Content)Activator.CreateInstance( listItemType );
AddContent( newContent );
}

However, I'm now tasked with replacing the ListView control with ListBar
control from Infragistics. While I can easily determine which item is
clicked from e.Item.Tag, I'm not understanding how to write code in this
event:

private void ultraListBar1_ItemSelected(object sender,
Infragistics.Win.UltraWinListBar.ItemEventArgs e)
{
???
}

If anyone can help me out, I will gladly buy them a beer.

Thanks very much,
Ron

Jan 11 '06 #2
Something like this maybe...

private void ultraListBar1_ItemSelected (object sender, Infragistics.Win.UltraWinListBar.ItemEventArgs
e)
{
Content newContent = e.Item.Tag as Content;
if (newContent != null)
AddContent(newContent);
}
Thanks for reading this...

Our current Win app employs a ListView control wherein the tag for an
item is, for example, "ContentManager.DataModel.PowerPointContent".
The following code exists (and works just fine) for when the user
clicks on any item within the ListView:

private void listView1_MouseClick( object sender, MouseEventArgs e )
{
Type listItemType = (Type)( ( sender as ListView ).FocusedItem.Tag );
Content newContent = (Content)Activator.CreateInstance( listItemType
);
AddContent( newContent );
}
However, I'm now tasked with replacing the ListView control with
ListBar control from Infragistics. While I can easily determine which
item is clicked from e.Item.Tag, I'm not understanding how to write
code in this event:

private void ultraListBar1_ItemSelected(object sender,
Infragistics.Win.UltraWinListBar.ItemEventArgs e)
{
???
}
If anyone can help me out, I will gladly buy them a beer.

Thanks very much,
Ron

Jan 11 '06 #3

Ronald S. Cook wrote:
Thanks for reading this...

Our current Win app employs a ListView control wherein the tag for an item
is, for example, "ContentManager.DataModel.PowerPointContent". The
following code exists (and works just fine) for when the user clicks on any
item within the ListView:

private void listView1_MouseClick( object sender, MouseEventArgs e )
{
Type listItemType = (Type)( ( sender as ListView ).FocusedItem.Tag );
Content newContent = (Content)Activator.CreateInstance( listItemType );
AddContent( newContent );
}

However, I'm now tasked with replacing the ListView control with ListBar
control from Infragistics. While I can easily determine which item is
clicked from e.Item.Tag, I'm not understanding how to write code in this
event:

private void ultraListBar1_ItemSelected(object sender,
Infragistics.Win.UltraWinListBar.ItemEventArgs e)
{
???
}

If anyone can help me out, I will gladly buy them a beer.
Eh, keep the beer. I'd probably end up with Schlitz or something :)

Seriously, I have no idea what the Infragistics ListBar is. However,
assuming that
the Tag item is the same...

Type listItemType = (Type)( ( e.Item.Tag ); Content newContent = (Content)Activator.CreateInstance( listItemType );
AddContent( newContent );


Is that what you are looking for?

Matt

Jan 11 '06 #4
Ron,
I've never used their control, but looking at the signature, shouldn't it be
something like:

private void ultraListBar1_ItemSelected(object sender,
Infragistics.Win.UltraWinListBar.ItemEventArgs e)
{
Type UltraListBar.Item = (Type)( ( sender as UltraListBar ).SelectedItem.Tag
);
Content newContent = (Content)Activator.CreateInstance( UlttraListBar.Item );
AddContent( newContent );
}

-- where UltraListBar.Item is whatever their defined ListBar item is.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Ronald S. Cook" wrote:
Thanks for reading this...

Our current Win app employs a ListView control wherein the tag for an item
is, for example, "ContentManager.DataModel.PowerPointContent". The
following code exists (and works just fine) for when the user clicks on any
item within the ListView:

private void listView1_MouseClick( object sender, MouseEventArgs e )
{
Type listItemType = (Type)( ( sender as ListView ).FocusedItem.Tag );
Content newContent = (Content)Activator.CreateInstance( listItemType );
AddContent( newContent );
}

However, I'm now tasked with replacing the ListView control with ListBar
control from Infragistics. While I can easily determine which item is
clicked from e.Item.Tag, I'm not understanding how to write code in this
event:

private void ultraListBar1_ItemSelected(object sender,
Infragistics.Win.UltraWinListBar.ItemEventArgs e)
{
???
}

If anyone can help me out, I will gladly buy them a beer.

Thanks very much,
Ron

Jan 11 '06 #5
Thanks for this code snippet, Matt, but it gives me the following error at
runtime:

Unable to cast object of type 'System.String' to type 'System.Type'.

Any thoughts? I sincerely appreciate the help.

Ron

"Matt" <ma********@sprynet.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...

Ronald S. Cook wrote:
Thanks for reading this...

Our current Win app employs a ListView control wherein the tag for an
item
is, for example, "ContentManager.DataModel.PowerPointContent". The
following code exists (and works just fine) for when the user clicks on
any
item within the ListView:

private void listView1_MouseClick( object sender, MouseEventArgs e )
{
Type listItemType = (Type)( ( sender as ListView ).FocusedItem.Tag );
Content newContent = (Content)Activator.CreateInstance( listItemType );
AddContent( newContent );
}

However, I'm now tasked with replacing the ListView control with ListBar
control from Infragistics. While I can easily determine which item is
clicked from e.Item.Tag, I'm not understanding how to write code in this
event:

private void ultraListBar1_ItemSelected(object sender,
Infragistics.Win.UltraWinListBar.ItemEventArgs e)
{
???
}

If anyone can help me out, I will gladly buy them a beer.


Eh, keep the beer. I'd probably end up with Schlitz or something :)

Seriously, I have no idea what the Infragistics ListBar is. However,
assuming that
the Tag item is the same...

Type listItemType = (Type)( ( e.Item.Tag );
Content newContent = (Content)Activator.CreateInstance( listItemType );
AddContent( newContent );


Is that what you are looking for?

Matt

Jan 11 '06 #6
Thanks so much, Peter. I tried the following code (which did build
successfully):

Type UltraWinListBar = (Type)((sender as
Infragistics.Win.UltraWinListBar.Item).Tag);
Content newContent = (Content)Activator.CreateInstance(UltraWinListBar) ;
AddContent(newContent);

But got the following error at runtime:

"Object reference not set to an instance of an object."

Any thoughts? I greatly appreciate the help!

Ron

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:AD**********************************@microsof t.com...
Ron,
I've never used their control, but looking at the signature, shouldn't it
be
something like:

private void ultraListBar1_ItemSelected(object sender,
Infragistics.Win.UltraWinListBar.ItemEventArgs e)
{
Type UltraListBar.Item = (Type)( ( sender as
UltraListBar ).SelectedItem.Tag
);
Content newContent = (Content)Activator.CreateInstance(
UlttraListBar.Item );
AddContent( newContent );
}

-- where UltraListBar.Item is whatever their defined ListBar item is.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Ronald S. Cook" wrote:
Thanks for reading this...

Our current Win app employs a ListView control wherein the tag for an
item
is, for example, "ContentManager.DataModel.PowerPointContent". The
following code exists (and works just fine) for when the user clicks on
any
item within the ListView:

private void listView1_MouseClick( object sender, MouseEventArgs e )
{
Type listItemType = (Type)( ( sender as ListView ).FocusedItem.Tag );
Content newContent = (Content)Activator.CreateInstance( listItemType );
AddContent( newContent );
}

However, I'm now tasked with replacing the ListView control with ListBar
control from Infragistics. While I can easily determine which item is
clicked from e.Item.Tag, I'm not understanding how to write code in this
event:

private void ultraListBar1_ItemSelected(object sender,
Infragistics.Win.UltraWinListBar.ItemEventArgs e)
{
???
}

If anyone can help me out, I will gladly buy them a beer.

Thanks very much,
Ron

Jan 11 '06 #7

Ronald S. Cook wrote:
Thanks for this code snippet, Matt, but it gives me the following error at
runtime:

Unable to cast object of type 'System.String' to type 'System.Type'.

Any thoughts? I sincerely appreciate the help.
Hm. Its telling you that the object stored in the Tag member is a
String,
rather than a type. This isn't really a problem, you can create an
object
from a NAME of a type.

Take a look at System.Activator.CreateInstance.

Matt

Ron

"Matt" <ma********@sprynet.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...

Ronald S. Cook wrote:
Thanks for reading this...

Our current Win app employs a ListView control wherein the tag for an
item
is, for example, "ContentManager.DataModel.PowerPointContent". The
following code exists (and works just fine) for when the user clicks on
any
item within the ListView:

private void listView1_MouseClick( object sender, MouseEventArgs e )
{
Type listItemType = (Type)( ( sender as ListView ).FocusedItem.Tag );
Content newContent = (Content)Activator.CreateInstance( listItemType );
AddContent( newContent );
}

However, I'm now tasked with replacing the ListView control with ListBar
control from Infragistics. While I can easily determine which item is
clicked from e.Item.Tag, I'm not understanding how to write code in this
event:

private void ultraListBar1_ItemSelected(object sender,
Infragistics.Win.UltraWinListBar.ItemEventArgs e)
{
???
}

If anyone can help me out, I will gladly buy them a beer.


Eh, keep the beer. I'd probably end up with Schlitz or something :)

Seriously, I have no idea what the Infragistics ListBar is. However,
assuming that
the Tag item is the same...

Type listItemType = (Type)( ( e.Item.Tag );
Content newContent = (Content)Activator.CreateInstance( listItemType );
AddContent( newContent );


Is that what you are looking for?

Matt


Jan 12 '06 #8

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

Similar topics

1
by: whisper | last post by:
Medium/small site with mod_python and sqllite or mySQL running Python 2.3.3 or later on Apache 2.x. I can do the python and CGI, but might need a _little_ hand holding for the rest. Will also...
2
by: AJ | last post by:
Currently I have a server that has two instances of SQL Server that are both heavily used. We are moving the databases that are on the default instance of this server to a new server. Since the...
30
by: nephish | last post by:
Hey there, i have tried about every graphing package for python i can get to work on my system. gnuplot, pychart, biggles, gdchart, etc.. (cant get matplot to work) so far, they all are working...
3
by: ChadDiesel | last post by:
Hello everyone. I need some advice on table structure for a new project I've been given. One of our customers sends us an Excel spreadsheet each week containing their order. Currently, someone...
0
by: Jennyfer J Barco | last post by:
Hello I have a datagrid and I'm showing many records. I need 2 things: I need that everytime they scroll down, the header stays lock so the user can see it all the time. I need to scroll only the...
1
by: Jennyfer J Barco | last post by:
Hello again I have a datagrid and I'm showing many records. I need 2 things: I need that everytime they scroll down, the header stays lock so the user can see it all the time. I need to scroll...
2
by: Peter | last post by:
Can i simply use Web Matrix to develop ASP.NET applications professionally, & not need to worry about my self with licensing issues? I just need to be able to develop professionally for my...
2
by: sunil | last post by:
Hi All, I'm need to PHP.. I need a quick information ... Are there any Registry function available in PHP for reading the registry key on the client machine(WindowsXP,Win2K).(I don't need any...
20
by: Tony | last post by:
I have a situation where I want to send data, but I have no need for a response. It seems to me that XMLHTTPRequest is the best way to send the data, but I don't need any response back from the...
1
by: Maryanne | last post by:
1) How do I display in a form a string of 1:M relationships? (or does it need to resort to multiple forms?) * Starts with Client that has consultant and consultation desk. Client has many...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
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...

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.