TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rightthen
NA
31
14.9k
BeginInvoke on PropertyInfo of Items property for ComboBox
Jul 8 2013 4:43 AM
Dear Fellows,
The below written code works when i try to take the items Collection
as a whole and then apply index to it. outside of
BeginInvoke
.
//propName = ComboBoxProperties.Items;
PropertyInfo
comboItems =
typeof
(
ComboBox
).GetProperty( propName.ToString().Trim() ) ;
var
a = comBox_.BeginInvoke(
new
Func
<
object
,
Object
>(comboItems.GetValue), comBox_);
object
c =
null
;
c = comBox_.EndInvoke(a);
retVal = (((
ComboBox
.
ObjectCollection
)c)[(
int
)propIndex]);
but when i try to apply index inside
BeginInvoke
itself it does not work gives an exception of
An unhandled exception of type '
System.Reflection.TargetInvocationException
' occurred in mscorlib.dll
Additional information: Exception has been thrown by the target of an invocation.
i.e when i do like this
delegate
object
getItemDlg
(
object
comBox,
object
[] index );
PropertyInfo
comboItems =
typeof
(
ComboBox
).GetProperty( propName.ToString().Trim() ) ;
object
[] index = { propIndex };
var
a = comBox_.BeginInvoke(
new
getItemDlg
(comboItems.GetValue), comBox_, index );
object
c =
null
;
c = comBox_.EndInvoke(a);
retVal = c;
i have tried using
Func
<
object
,
object
[],
object
> and
var
a = comBox_.BeginInvoke(
new
getItemDlg
(comboItems.GetValue),
new
object
[]{ comBox_, index });
but to no avail
specifically i would like to know how does one get indexed properties with begin invoke
Thanks
Regards
Reply
Answers (
2
)
drop down dependency for contry,state in javascript using C#
SYNAX OF FROM DATE AND TODATE IN SQL2005