十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
这个简单,看下面代码(适应各版本Excel,但前提是完整安装的excel )
创新互联公司成都企业网站建设服务,提供做网站、成都网站建设网站开发,网站定制,建网站,网站搭建,网站设计,响应式网站设计,网页设计师打造企业风格网站,提供周到的售前咨询和贴心的售后服务。欢迎咨询做网站需要多少钱:13518219792
Try
Dim excelObj As Object = GetObject(, "Excel.Application")
If excelObj.Workbooks.Count = 0 Then '注意,如果是新建未保存的工作簿不算打开
MsgBox("没有工作簿打开")
excelObj = Nothing
Exit Sub
End If
excelObj.Workbooks(1).Worksheets(1).Range("A1").Value = "123" '表示把已经打开的第一个工作簿的第一个工作表的A1单元格赋值为“123”
excelObj = Nothing
Catch ex As Exception
MsgBox(ex.Message)
End Try
工程属性里面,有个引用,看看那个引用到底在程序里用了没有,
如果没有使用(有个叉或者是空的),可以删它,就没事了。
如果使用了,那就表示=这个软件不能从高改到低,或,改低了之后,
也要把使用的引用改成低版本的。如下图:
vb.net编程工具是:Microsoft Visual Studio 2008
1、Microsoft Visual Studio 2008是面向Windows Vista、Office 2007、Web 2.0的下一代开发工具,代号“Orcas”,是对Visual Studio 2005一次及时、全面的升级。
2、VS2008引入了250多个新特性,整合了对象、关系型数据、XML访问方式,语言更简洁。
3、使用Visual Studio 2008可以高效开发Windows应用。
4、设计器中可以实时反映变更,XAML中智能感知功能可以提高开发效率。
5、Visual Studio 2008支持项目模板、调试器和部署程序。
6、Visual Studio 2008可以高效开发Web应用,集成了AJAX 1.0,包含AJAX项目模板,它还可以高效开发Office应用和Mobile应用。
Dim path As String = PDA_PATH "ife.XML" ’PDA_PATH 为路径
Dim ds As New DataSet
ds.ReadXml(path)
Dim dt As DataTable = ds.Tables.Item(0)
Dim blnY As Boolean = True
For Each row As DataRow In dt.Rows
If row.Item("Translation").ToString.ToUpper ="确认"Then
row.Item("Translation") =“替换”
blnY = False
Exit For
End If
Next
If blnY Then
MsgBox("输入的XXX不存在,请重新输入! ")
Return
End If
ds.WriteXml(path)
MessageBox.Show("修改数据并保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
或者
Dim xmlDoc As New XmlDocument()
'Dim nodeList As New XmlNodeList
xmlDoc.Load("life..xml") '加载
Dim nodeList As XmlNodeList = xmlDoc.SelectSingleNod.("UITranslations").ChildNodes '获取bookstore节点的所有子节点
Dim xn As XmlNode
For Each xn In nodeList '遍历所有子节点
Dim xe As XmlElement = CType(xn, XmlElement) '将子节点类型转换为XmlElement类型
Dim nls As XmlNodeList = xe.ChildNodes '继续获取xe子节点的所有子节点
Dim xn1 As XmlNode
For Each xn1 In nls '遍历
Dim xe2 As XmlElement = CType(xn1, XmlElement) '转换类型
If xe2.Name = "Translation" Then '如果找到
xe2.InnerText ="替换"则修改
'Exit For Each '找到退出来就可以了
End If
Next xn1
Next xn
xmlDoc.Save("life.xml") '保存。
MessageBox.Show("修改XML成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
看能不能帮到你!
一种方法是:textbox1.readonly = True textbox2.readonly = True......
另一种方法是:把textbox设成组,那么,textbox(i).textbox1.readonly = True。
现在:'readonly' is not a member of 'Control'。
将以下代码保存到模块中:
Declare Function GetPrivateProfileString Lib "kernel32" Alias _
"GetPrivateProfileStringA" (ByVal lpApplicationName As String, _
ByVal lpKeyName As Any, _
ByVal lpDefault As String, _
ByVal lpReturnedString As String, _
ByVal nSize As Long, _
ByVal lpFileName As String) As Long
Declare Function WritePrivateProfileStringByKeyName Lib "kernel32" Alias _
"WritePrivateProfileStringA" (ByVal lpApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpString As String, _
Public Function GetIniParam(NomFichier As String, NomSection As String, NomVariable As String) As String
Dim ReadString As String * 255
Dim returnv As String
Dim mResultLen As Integer
mResultLen = GetPrivateProfileString(NomSection, NomVariable, "(Unassigned)", ReadString, Len(ReadString) - 1, NomFichier)
If IsNull(ReadString) Or Left$(ReadString, 12) = "(Unassigned)" Then
Dim Tempvalue As Variant
Dim Message As String
Message = "配置文件 " NomFichier " 不存在."
returnv = ""
Else
returnv = Left$(ReadString, InStr(ReadString, Chr$(0)) - 1)
End If
GetIniParam = returnv
End Function
Public Function WriteWinIniParam(NomDuIni As String, sLaSection As String, sNouvelleCle As String, sNouvelleValeur As String)
Dim iSucccess As Integer
iSucccess = WritePrivateProfileStringByKeyName(sLaSection, sNouvelleCle, sNouvelleValeur, NomDuIni)
If iSucccess = 0 Then
WriteWinIniParam = False
Else
WriteWinIniParam = True
End If
End Function
调用方法:
Call WriteWinIniParam(App.Path "\LiveUpdate.ini", "LiveUpdate", "AppName", txtAppName.Text)
txtFile.Text = GetIniParam(App.Path "\LiveUpdate.ini", "LiveUpdate", "FILES1")