vb6 - What is the equivalent for VB's CreateObject in c# 3.0? -
i have below code in vb
private sub refreshcharts() on error goto err_getichelper_refresh application.cursor = xlwait dim objoperationrefresh set objoperationrefresh = createobject("charting.automationproxy") dim variant set = application objoperationrefresh.refreshapplication application.statusbar = "refreshing .. " while len(objoperationrefresh.refreshstatus) = 0 doevents loop application.statusbar = "refreshing complete." set objoperationrefresh = nothing application.statusbar = "" exit sub err_getichelper_refresh:
i have done conversion in c# except createobject("charting.automationproxy").
equivalent of in c# 3.0?
thanks
you use reflection:
type type = type.gettypefromprogid("charting.automationproxy"); object instance = activator.createinstance(type);
contrary vb , vb.net, c# doesn't support dynamic types until c# 4.0. com object possibility generate typed wrapper simplify usage: in add reference dialog select component com components tab or use tlbimp.exe utility.
Comments
Post a Comment