体育资讯网

您现在的位置是:首页 > 分类14 > 正文

分类14

vb保存通用格式源码(vbs代码格式)

hacker2022-06-11 20:52:18分类1448
本文目录一览:1、vb实现保存程序的代码2、

本文目录一览:

vb实现保存程序的代码

VB是编译型的程序设计语言,也就是说它在运行时是使用编译后的机器代码,与文本形式的源程序之间是不再存在任何关联的(除非是在VB环境中调试运行,但这不属于真正的运行),因此不可能有所谓保存程序的代码的。你可以想象一下,VB程序最终是要编译为exe可执行程序的,而且是可以复制到别的电脑上运行的,这个时候跟源程序还有什么关系呢?

如果你的目的是想在VB环境中运行程序时自动保存源程序,以防止程序出错造成崩溃时丢失源代码,那么你可以在菜单--工具--选项--环境--启动程序时--设为“保存改变”或“提示保存改变”。

vb文件保存源码下载

CommonDialog1.Filter = "bmpfile|*.bmp"

CommonDialog1.FileName = ""

CommonDialog1.ShowSave

If CommonDialog1.FileName "" Then

SavePicture Picture1.Image, CommonDialog1.FileName

End If

VB中如何使用ini文件保存MSHFlexGrid的列宽,加载窗体时,从ini文件读取各列列宽?

在窗体加载时从ini文件中读取并加载列宽vb保存通用格式源码,在窗体卸载时vb保存通用格式源码,保存列宽到ini。一个网上找到的ini操作类vb保存通用格式源码

Option Explicit

'--------classIniFile.cls 代码----------------

'这里定义vb保存通用格式源码了一个classIniFile类

'一个绝对经典的在VB中操作.ini文件的通用类源代码

'程序编写:中国青岛·许家国

' 2002.6.16

'E-Mail: goj2000@163.com

'HomePage:

'

'Private member that holds a reference to

'the path of our ini file

Private Declare Sub InitCommonControls Lib "comctl32.dll" ()

Private strINI As String

'Windows API Declares

Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" _

(ByVal lpApplicationName As String, _

ByVal lpKeyName As Any, _

ByVal lpString As Any, _

ByVal lpFileName As String) As Long

Private 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

Private Function MakePath(ByVal strDrv As String, ByVal strDir As String) As String

' Makes an INI file: Guarantees a sub dir

Do While Right$(strDrv, 1) = "\"

strDrv = Left$(strDrv, Len(strDrv) - 1)

Loop

Do While Left$(strDir, 1) = "\"

strDir = Mid$(strDir, 2)

Loop

' Return the path

MakePath = strDrv "\" strDir

End Function

Private Sub Form_Initialize()

InitCommonControls

End Sub

Private Sub CreateIni(strDrv As String, strDir As String)

' Make a new ini file

strINI = MakePath(strDrv, strDir)

End Sub

Public Sub WriteIniKey(strSection As String, strKey As String, strValue As String)

' Write to strINI

WritePrivateProfileString strSection, strKey, strValue, strINI

End Sub

Public Function GetIniKey(strSection As String, strKey As String) As String

Dim strTmp As String

Dim lngRet As String

Dim I As Integer

Dim strTmp2 As String

strTmp = String$(1024, Chr(32))

lngRet = GetPrivateProfileString(strSection, strKey, "", strTmp, Len(strTmp), strINI)

strTmp = Trim(strTmp)

strTmp2 = ""

For I = 1 To Len(strTmp)

If Asc(Mid(strTmp, I, 1)) 0 Then

strTmp2 = strTmp2 + Mid(strTmp, I, 1)

End If

Next I

strTmp = strTmp2

GetIniKey = strTmp

End Function

Public Property Let INIFileName(ByVal New_IniPath As String)

' Sets the new ini path

strINI = New_IniPath

End Property

Public Property Get INIFileName() As String

' Returns the current ini path

INIFileName = strINI

End Property

'***************************************清除KeyWord"键"(Sub)********

Public Function DelIniKey(ByVal SectionName As String, ByVal KeyWord As String)

Dim RetVal As Integer

RetVal = WritePrivateProfileString(SectionName, KeyWord, 0, strINI)

End Function

'如果是清除section就少写一个Key多一个""。

'**************************************清除 Section"段"(Sub)********

Public Function DelIniSec(ByVal SectionName As String) '清除section

Dim RetVal As Integer

RetVal = WritePrivateProfileString(SectionName, 0, "", strINI)

End Function

如何在win7系统下保存VB运行后的源代码?

点上面的文件-选那个保存工程。不是保存文件。会有几个让vb保存通用格式源码你保存vb保存通用格式源码,点保存就行,最好不改名。

它会自动用工程名的。

发表评论

评论列表

  • 只酷初霁(2022-06-11 21:16:34)回复取消回复

    Public Sub WriteIniKey(strSection As String, strKey As String, strValue As String) ' Write to strINI WritePrivateProfileString strSection, s

  • 怎忘叙詓(2022-06-12 05:17:15)回复取消回复

    存源码下载CommonDialog1.Filter = "bmpfile|*.bmp"CommonDialog1.FileName = ""CommonDialog1.ShowSaveIf

  • 莣萳辞慾(2022-06-12 04:16:06)回复取消回复

    ey(strSection As String, strKey As String) As String Dim strTmp As String Dim lngRet As String Dim I As Integer Dim strTmp2 As String