[VB.NET]读写ini

前端之家收集整理的这篇文章主要介绍了[VB.NET]读写ini前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
  1. '引用读写ini
  2. PrivateDeclareFunctionGetPrivateProfileStringLib"kernel32"Alias"GetPrivateProfileStringA"(ByVallpApplicationNameAsString,ByVallpKeyNameAsString,ByVallpDefaultAsString,ByVallpReturnedStringAsString,ByValnSizeAsInt32,ByVallpFileNameAsString)AsInt32
  3. PrivateDeclareFunctionWritePrivateProfileStringLib"kernel32"Alias"WritePrivateProfileStringA"(ByVallpApplicationNameAsString,ByVallpStringAsString,ByVallpFileNameAsString)AsInt32
  4. PublicFunctionGetINI(ByValSectionAsString,ByValAppNameAsString,ByValFileNameAsString)AsString
  5. DimStrAsString=LSet(Str,256)
  6. GetPrivateProfileString(Section,AppName,lpDefault,Str,Len(Str),FileName)
  7. ReturnMicrosoft.VisualBasic.Left(Str,InStr(Str,Chr(0))-1)
  8. EndFunction
  9. PublicFunctionWriteINI(ByValSectionAsString,ByValFileNameAsString)AsLong
  10. WriteINI=WritePrivateProfileString(Section,FileName)
  11. EndFunction
  12. DimTempStrAsString=Application.StartupPath&"/Option.ini"'路径
  13. ValuesStr=GetINI("runoption","refresh","",TempStr)'读ini
  14. WriteINI("runoption","autoin",TempValues,TempStr)’写ini
原文链接:https://www.f2er.com/vb/264405.html

猜你在找的VB相关文章