求 vb6 高手 (解決!!)

Home Home
引用 | 編輯 zsx123665
2012-07-02 22:10
樓主
推文 x0
詳細專案:


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 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
Function GetIniS(ByVal inifilename As String, ByVal SectionName As String, ByVal KeyWord As String, Optional ByVal DefString As String) As String
    Dim ResultString As String * 128, Temp%
    Dim s$, i%
    Temp% = GetPrivateProfileString(SectionName, KeyWord, "", ResultString, 144, inifilename)
    If Temp% > 0 Then
        For i = 1 To 128
            If Asc(Mid$(ResultString, i, 1)) <> 0 Then
                s = s & Mid$(ResultString, i, 1)
            End If
        Next
    Else
        Temp% = WritePrivateProfileString(SectionName, KeyWord, DefString, inifilename)
        s = DefString
    End If
    GetIniS = s
End Function


Private Sub Command1_Click()
On Error GoTo wtf
Image1(0).Picture = LoadPicture(App.Path & "\Data\Background\Maps\kengdie.bmp")
Image1(1).Picture = LoadPicture(App.Path & "\Data\Background\Maps\kengdie.bmp")
Image1(2).Picture = LoadPicture(App.Path & "\Data\Background\Maps\kengdie.bmp")
Image1(3).Picture = LoadPicture(App.Path & "\Data\Background\Maps\kengdie.bmp")
Image1(4).Picture = LoadPicture(App.Path & "\Data\Background\Maps\kengdie.bmp")
Image1(5).Picture = LoadPicture(App.Path & "\Data\Background\Maps\kengdie.bmp")
Image1(6).Picture = LoadPicture(App.Path & "\Data\Background\Maps\kengdie.bmp")
Image1(7).Picture = LoadPicture(App.Path & "\Data\Background\Maps\kengdie.bmp")
Image1(8).Picture = LoadPicture(App.Path & "\Data\Background\Maps\kengdie.bmp")
Label1(9).Caption = "N/A"
Label1(10).Caption = "N/A"
Label1(11).Caption = "N/A"
Label1(12).Caption = "N/A"
Label1(14).Caption = "N/A"
Label1(15).Caption = "N/A"
Label1(16).Caption = "N/A"
Label1(17).Caption = "N/A"
Label1(13).Caption = "N/A"
Label3(0).Caption = Label3(0).Caption - 1
Timer1.Enabled = True
Image1(Index).Picture = LoadPicture(App.Path & "\Data\Background\Maps\kengdie.bmp")
Label1(Index).Caption = ""
Dim i As Integer
Label2.Caption = (Label3(0).Caption - 1) * 9
For x = 0 To 8
 Label1(i).Caption = Trim(GetIniS(App.Path & "\Data\Setting\Maps.LS", "maps", Label2.Caption))
 Label1(i + 9).Caption = Trim(GetIniS(App.Path & "\Data\Setting\Maps.ini", "name", Label1(i).Caption))
 If Len(Dir(App.Path & "\Data\Background\Maps\" + Label1(i ..

訪客只能看到部份內容,免費 加入會員



獻花 x0
引用 | 編輯 ebolaman
2012-07-03 22:44
1樓
  
表單的 Object 名稱要用 專案瀏覽器 表單左邊的名稱

Frist (Main.frm)

Frist 是 Object 名稱,Main.frm 是檔案名稱



因此將名稱改一下


Private Sub Image1_Click(Index As Integer)
Frist.Image1.Picture = Image1(Index).Picture
Frist.fk.Caption = Label1(Index).Caption
Dim y As Integer
y = Image1(Index).Tag + (Label3(0).Caption - 1) * 9
Dim z As String
z = y
x = WritePrivateProfileString("map", "lastchoice", z, App.Path & "\Data\Setting\Save.ini")
Unload Me
End Sub

獻花 x1
引用 | 編輯 zsx123665
2012-07-04 12:50
2樓
  
下面是引用 ebolaman 於 2012-07-03 22:44 發表的 : 到引言文
表單的 Object 名稱要用 專案瀏覽器 表單左邊的名稱
Frist (Main.frm)
Frist 是 Object 名稱,Main.frm 是檔案名稱

因此將名稱改一下
.......

你實在太強了 QAQ
原來是名稱搞錯 然怪一直找不到原因 Thx U (^_^) 

獻花 x0
引用 | 編輯 ebolaman
2012-07-04 18:52
3樓
  
下面是引用 zsx123665 於 2012-07-04 12:50 發表的 : 到引言文


你實在太強了 QAQ
原來是名稱搞錯 然怪一直找不到原因 Thx U (^_^) 


不客氣~

獻花 x0