几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » ObjectARX(VB.NET/C#)
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-04-20, 02:24 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】vs里调试正常,cad里加载后运行出错,请高手出招

vs里调试正常,cad里加载后运行出错,请高手出招
www.dimcax.com
vs里调试正常,cad里加载后运行出错,请高手出招
, , , ,
//
using system;
using system.collections.generic;
using system.componentmodel;
using system.data;
using system.drawing;
using system.text;
using system.windows.forms;
using system.io;
using system.data.oledb;
using autodesk.autocad.applicationservices;
using autodesk.autocad.editorinput;
using autodesk.autocad.databaseservices;
using autodesk.autocad.geometry;
using autodesk.autocad.colors;
using system.text.regularexpressions;
using system.collections;
namespace cxwtool1
{
public partial class formdrawline : form
{
private string pathstring = "";
public formdrawline()
{
initializecomponent();
}
private void groupbox1_enter(object sender, eventargs e)
{
}
private void textbox4_textchanged(object sender, eventargs e)
{
}
/// <summary>
///1、 读数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttongetdata_click(object sender, eventargs e)
{
this.openfiledialogline.title = "选择数据文件";
this.openfiledialogline.filter = "txt 文件(*.txt)|*.txt|dat 文件(*.dat)|*.dat|excle 文件(*.xls)|*xls|access 文件(*.mdb)|*mdb";
this.openfiledialogline.filename = "";
if (this.openfiledialogline.showdialog() == dialogresult.ok)
{
string strlengthl = "";//声明变量,表示围岩分段长度
string strinformation = "";//声明变量,表示分段信息
string textstring;
int n = 0; //序号累加
pathstring = this.openfiledialogline.filename;
this.listview1.items.clear();
if (pathstring.toupper().indexof("dat") > 0 || pathstring.toupper().indexof("txt") > 0)
{
streamreader sr = new streamreader(pathstring, system.text.encoding.default);
// streamreader sr = new streamreader(pathstring);
while ((textstring = sr.readline()) != null)
{
try
{
textstring = textstring.tostring().trim();
if (textstring.length > 0)
{
string stridentify = "";//读取分隔符开始
if (textstring.indexof(",") >= 0)
{
stridentify = ",";
}
else if (textstring.indexof("\t") > 0)
{
stridentify = "\t";
}
else
{
stridentify = " ";
}//读取分隔符结束
//获取分段长度
int i = textstring.indexof(stridentify);
if (i > 0)
{
strlengthl = textstring.substring(0, i).trim();
textstring = textstring.substring(i + 1).trim();
if (lzxmodel.isnumber(strlengthl))
{
strlengthl = convert.todouble(strlengthl).tostring();
}
//获取分段信息
i = textstring.indexof(stridentify);
if (i > 0)
{
strinformation = textstring.substring(0, i).trim();
}
else
{ strinformation = textstring; }
}
else
{
strlengthl = textstring.trim();
if (lzxmodel.isnumber(strlengthl))
{
strlengthl = convert.todouble(strlengthl).tostring();
}
else
{
messagebox.show("分段长度不是数字,请核查");
}
strinformation = "";
}
n++;
listviewitem lv = new listviewitem(n.tostring());
lv.subitems.add(strlengthl);
lv.subitems.add(strinformation);
listview1.items.add(lv);
}
}
catch (nullreferenceexception)
{
continue;
}
}
sr.close();
}
}
}
复制代码
上面的代码没有贴完,现在全部发上来,在附件里
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭



所有的时间均为北京时间。 现在的时间是 04:08 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多