VB 怎么用vb读取INI里的内容并判断
Private Sub Form_Load()
Dim x As Object
On Error Resume Next
Set x = CreateObject("wscript.shell")
x.RegRead "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\" & App.EXEName
If Err Then
Image10.Visible = False '不存在
Image12.Visible = True
Else
Image12.Visible = False '存在
Image10.Visible = True
End If
Dim inistring As String
inistring = Space$(254)
Dim sstr As String
GetPrivateProfileString "vp", "yfy", "", inistring, 255, "c:\1010.ini"
If Left(inistring, 2) = "1" Then'这里处的问题,不能判断!
Image6.Visible = False
Image5.Visible = True
Else
Image5.Visible = False
Image6.Visible = True
End If
End Sub
答案:GetPrivateProfileString "vp", "yfy", "", inistring, 255, "c:\1010.ini"
其他:朋友你不理解VB的Left()函数啊?
Left(x,n)函数是从字符串x里取出左边的n位,
你要做
是否等于“1”的判断,就应该取左边的1位呀???
If Left(inistring, 1) = "1" Then
上一个:VB程序分析题。。。求解。。.
下一个:vb运行时出现子函数或函数未定义该怎么解决?