问题描述
怎样通过XML保存和读取程序的设置呢?
解决方案
解决方案二:
哪位老兄说说!?
解决方案三:
参考下如下:'读XMLgdsConfig.ReadXml(gstrIniFileName)'XML文件路径TrygstrCompanyName=gdsConfig.Tables("Registration").Rows(0)("CompanyName")gstrServerIP=gdsConfig.Tables("socket").Rows(0)("ServerIP")gintPort=gdsConfig.Tables("socket").Rows(0)("port")IfgstrServerIP=""OrgintPort=0OrgstrCompanyName=""ThenstrError="读取配置文件信息失败。"EndIfCatchexAsExceptionstrError=ex.MessageFinallyEndTry'更新XMLDimstrServerIPAsStringDimstrPortAsStringTrygdsConfig.Tables("Socket").Rows(0)("ServerIP")=strServerIPgdsConfig.Tables("Socket").Rows(0)("Port")=strPortgdsConfig.WriteXml(gstrIniFileName,XmlWriteMode.IgnoreSchema)gstrServerIP=strServerIPgintPort=CInt(strPort)CatchexAsExceptionstrError=ex.MessageEndTry
时间: 2024-11-25 17:26:19