473,387 Members | 1,517 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.

Can't determine correct type at runtime

I am trying to determine the type for ActiveControls using 3rd party
controls (Infragistics in this case) during runtime and getting a rather odd
return type at runtime for the UltraWinEditor.

Code shippet is as follows:

if ( ActiveControl.GetType() == typeof(UltraTextEditor))
{
UltraTextEditor tb = (UltraTextEditor) this.ActiveControl;
if (tb.Multiline == true)
return true;
}

I am expecting to see an UltraTextEditor for the ActiveControlType but,
instead, getting "Infragistics.Win.EmbeddableTextBoxWithUIPermissio ns", so
the "if" statement fails on the control.

If I modify the "if" statement to: "if (ActiveControl.GetType().ToString()
== "Infragistics.Win.EmbeddableTextBoxWithUIPermissio ns")", the subsequent
cast fails.

Does anyone know what would cause the control type to be different at
runtime than what it was built from?

(BTW, the test form is ONLY using UltraTextEditor controls, so the type
should be the same for each.)
Jun 27 '08 #1
4 2676
Bill Fuller wrote:
I am trying to determine the type for ActiveControls using 3rd party
controls (Infragistics in this case) during runtime and getting a rather odd
return type at runtime for the UltraWinEditor.

Code shippet is as follows:

if ( ActiveControl.GetType() == typeof(UltraTextEditor))
{
UltraTextEditor tb = (UltraTextEditor) this.ActiveControl;
if (tb.Multiline == true)
return true;
}

I am expecting to see an UltraTextEditor for the ActiveControlType but,
instead, getting "Infragistics.Win.EmbeddableTextBoxWithUIPermissio ns", so
the "if" statement fails on the control.

If I modify the "if" statement to: "if (ActiveControl.GetType().ToString()
== "Infragistics.Win.EmbeddableTextBoxWithUIPermissio ns")", the subsequent
cast fails.

Does anyone know what would cause the control type to be different at
runtime than what it was built from?

(BTW, the test form is ONLY using UltraTextEditor controls, so the type
should be the same for each.)

I'm going on assumptions here, but judging by the full name of that
control, I'd say you have focus to the editor, but it is actually
similar to a user control and what you're reading there is an embedded
editor inside what dropped on the form.

DevExpresses uses the same approach, with something like a
RepositoryTextEdit, which is then used internally in both grids and
normal droppable edit controls. I don't know if the DevExpress controls
would give me the same behavior as you're seeing though.

In any case, it's just a guess. I guess the best way to get a concrete
answer would be to ask the Infragistics guys about this.

Let me pose another question... What specifically are you trying to
accomplish with the code? Perhaps there's a different way to do what you
want to do than the one you're currently trying.

--
Lasse Vågsæther Karlsen
mailto:la***@vkarlsen.no
http://presentationmode.blogspot.com/
PGP KeyID: 0xBCDEA2E3
Jun 27 '08 #2
On Sun, 20 Apr 2008 09:50:57 -0700, "Bill Fuller" <so*****@nospam.com>
wrote:
>I am trying to determine the type for ActiveControls using 3rd party
controls (Infragistics in this case) during runtime and getting a rather odd
return type at runtime for the UltraWinEditor.

Code shippet is as follows:

if ( ActiveControl.GetType() == typeof(UltraTextEditor))
{
UltraTextEditor tb = (UltraTextEditor) this.ActiveControl;
if (tb.Multiline == true)
return true;
}

I am expecting to see an UltraTextEditor for the ActiveControlType but,
instead, getting "Infragistics.Win.EmbeddableTextBoxWithUIPermissio ns", so
the "if" statement fails on the control.

If I modify the "if" statement to: "if (ActiveControl.GetType().ToString()
== "Infragistics.Win.EmbeddableTextBoxWithUIPermissio ns")", the subsequent
cast fails.

Does anyone know what would cause the control type to be different at
runtime than what it was built from?

(BTW, the test form is ONLY using UltraTextEditor controls, so the type
should be the same for each.)
Hmm, could it be that UltraTextEditor is a composite control,
containing an Infragistics.Win.EmbeddableTextBoxWithUIPermission s at
runtime?

As the latter seems to be derived from TextBox according to:

http://help.infragistics.com/Help/Ne...hierarchy.html

what you could do instead of your if block above is this (untested):

TextBox tb = ActiveControl as TextBox;
if(tb != null) {
if(tb.Multiline) {
return true;
}
}

Regards,
Gilles.

Jun 27 '08 #3
"Lasse Vågsæther Karlsen" <la***@vkarlsen.nowrote in message
news:Oa**************@TK2MSFTNGP06.phx.gbl...
Bill Fuller wrote:
>I am trying to determine the type for ActiveControls using 3rd party
controls (Infragistics in this case) during runtime and getting a rather
odd return type at runtime for the UltraWinEditor.

Code shippet is as follows:

if ( ActiveControl.GetType() == typeof(UltraTextEditor))
{
UltraTextEditor tb = (UltraTextEditor) this.ActiveControl;
if (tb.Multiline == true)
return true;
}

I am expecting to see an UltraTextEditor for the ActiveControlType but,
instead, getting "Infragistics.Win.EmbeddableTextBoxWithUIPermissio ns",
so the "if" statement fails on the control.

If I modify the "if" statement to: "if
(ActiveControl.GetType().ToString() ==
"Infragistics.Win.EmbeddableTextBoxWithUIPermissi ons")", the subsequent
cast fails.

Does anyone know what would cause the control type to be different at
runtime than what it was built from?

(BTW, the test form is ONLY using UltraTextEditor controls, so the type
should be the same for each.)


I'm going on assumptions here, but judging by the full name of that
control, I'd say you have focus to the editor, but it is actually similar
to a user control and what you're reading there is an embedded editor
inside what dropped on the form.

DevExpresses uses the same approach, with something like a
RepositoryTextEdit, which is then used internally in both grids and normal
droppable edit controls. I don't know if the DevExpress controls would
give me the same behavior as you're seeing though.

In any case, it's just a guess. I guess the best way to get a concrete
answer would be to ask the Infragistics guys about this.

Let me pose another question... What specifically are you trying to
accomplish with the code? Perhaps there's a different way to do what you
want to do than the one you're currently trying.

--
Lasse Vågsæther Karlsen
mailto:la***@vkarlsen.no
http://presentationmode.blogspot.com/
PGP KeyID: 0xBCDEA2E3
It sounds like you are pointing me in the right direction as to the source
of my problem. I did post the question to Infragistics, but need to find an
answer ASAP, if possible, and I have found them to be rather slow in
responding.

What I am trying to do (and it is working for the most part) is set a global
hook via IMessageFilter to convert the ENTER key to a TAB key for the entire
application, which is largely data entry type forms. However, I have also
set a virtual method for this that can be overridden in instances where the
Enter key on a particular form needs to be processed rather than use the
default, such as in the case where a multiline textbox that allows Enter key
handling may be on the form... or perhaps a button key. This code would
process the override if I can get it to work... was taken by surprise with
the type return as a standard Microsoft textbox works as expected.
Jun 27 '08 #4
"Gilles Kohl [MVP]" <no_email_available@wrote in message
news:0l********************************@4ax.com...
On Sun, 20 Apr 2008 09:50:57 -0700, "Bill Fuller" <so*****@nospam.com>
wrote:
>>I am trying to determine the type for ActiveControls using 3rd party
controls (Infragistics in this case) during runtime and getting a rather
odd
return type at runtime for the UltraWinEditor.

Code shippet is as follows:

if ( ActiveControl.GetType() == typeof(UltraTextEditor))
{
UltraTextEditor tb = (UltraTextEditor) this.ActiveControl;
if (tb.Multiline == true)
return true;
}

I am expecting to see an UltraTextEditor for the ActiveControlType but,
instead, getting "Infragistics.Win.EmbeddableTextBoxWithUIPermissio ns", so
the "if" statement fails on the control.

If I modify the "if" statement to: "if (ActiveControl.GetType().ToString()
== "Infragistics.Win.EmbeddableTextBoxWithUIPermissio ns")", the subsequent
cast fails.

Does anyone know what would cause the control type to be different at
runtime than what it was built from?

(BTW, the test form is ONLY using UltraTextEditor controls, so the type
should be the same for each.)

Hmm, could it be that UltraTextEditor is a composite control,
containing an Infragistics.Win.EmbeddableTextBoxWithUIPermission s at
runtime?

As the latter seems to be derived from TextBox according to:

http://help.infragistics.com/Help/Ne...hierarchy.html

what you could do instead of your if block above is this (untested):

TextBox tb = ActiveControl as TextBox;
if(tb != null) {
if(tb.Multiline) {
return true;
}
}

Regards,
Gilles.
Your untested code fix did the trick...thanks.
Jun 27 '08 #5

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

Similar topics

21
by: dkcpub | last post by:
I'm very new to Python, but I couldn't find anything in the docs or faq about this. And I fished around in the IDLE menus but didn't see anything. Is there a tool that can determine all the...
0
by: Ken Durden | last post by:
I'm getting the following exception coming out of a block of unmanaged C++ code. Thread executed for 1.03 sec and died with the following exception: External component has thrown an exception. ...
3
by: TS | last post by:
Is there a way to convert a variable from 1 type to another type that you determine at runtime? I'm trying to pull a value from a ListDictionary's key. The datatype of that key must be identical to...
2
by: William Morgan | last post by:
Public Declare Sub ydec_set_callback Lib "yDecLib.dll" (ByVal CallbackFunc As Long) Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByVal lpvDest As String, ByVal lpvSource As...
4
by: neil brown | last post by:
Whenever I try and run a project in VB.NET 2003, all i get is: "An unhandled exception of type 'System.ArgumentException' occurred in Unknown Module. Additional information: The parameter is...
2
by: TimJR | last post by:
I am looking for a way to determine in RunTime if a given object is Xml Serializable (short of trying to serialize it to xml and catching the exception). Is this possible? Since an object...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
3
by: Giampaolo Rodola' | last post by:
Hi there, since the socket.socket.family attribute has been introduced only in Python 2.5 and I need to have my application to be backward compatible with Python 2.3 and 2.4 I'd like to know how...
4
by: Salad | last post by:
I have a situation where some, not all, users get the message "Couldn't find file "F:\AccessApps\AppName.mdw". This file is required for startup". My app the users are attempting to access is...
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: 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
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
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...
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.