几何尺寸与公差论坛

 找回密码
 注册
查看: 863|回复: 0

【转帖】how to add a .net user control

[复制链接]
发表于 2009-4-12 21:12:36 | 显示全部楼层 |阅读模式
how to add a .net user control
hi,
i've benn trying to create an addin for sw2009 using .net 2005 c# to manage documents (assembly and parts) with company data (products, materials, ...).
my addin works fine if i create forms called by menu or toolbar buttons.
now i would like to create a user control to search data in a sql server database.
is there an example on how to create a .net user control and use it in a pmp or in task pane ? i found examples about activex but this is an older tecnique, how to manage .net assemblies ?
thank you.
hello gianni,
i am trying the same exercise in c#.net2.0. i have created the custom control and tested in web page which worls fine. i tried this following code to add the activex control in the task pan.
which i tookas a vb reference to generate this piece of code.
string parttemplate = swapp.getuserpreferencestringvalue((int)swconst.swuserpreferencestringvalue_e.swdefaulttemplatepart);
swdoc = (imodeldoc2)swapp.newdocument(parttemplate, (int)swdwgpapersizes_e.swdwgpapera4size, 0, 0);
mdliewmgr = swdoc.modelviewmanager;
object xcont = taskpan.addcontrol("activexcontrol_test.activexcontrol_test")
if (xcont == null)
messagebox.show("unable to insert xcontrol");
but the problem is that it wont add the control and the api has no any return error code to undersatnd what's going wrong.
if you got any solution please let me know as well at rbelkh@clydeunion.com
thanks in advance
team- together each achieve more
ravi belkhindi
clydeunion
automation engineer
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-23 06:19 , Processed in 0.034644 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表